Cosmetic Update 2

+ Item Coal
+ Freeze Cannon
+ Party Popper / Party Bomb
+ Snowball
+ Coal Fumes Particle
+ Snowman sneak trail/glide
+ Teaked stuff
This commit is contained in:
xGamingDudex 2015-12-08 00:50:08 +01:00
parent c36182b8d4
commit b1536547d3
13 changed files with 720 additions and 31 deletions

View File

@ -249,12 +249,30 @@ public class UtilParticle
public static void PlayParticleToAll(ParticleType type, Location location, Vector offset, float speed, int count, ViewDist dist)
{
PlayParticle(type, location, (float) offset.getX(), (float) offset.getY(), (float) offset.getZ(), speed, count, dist, UtilServer.getPlayers());
float x = 0;
float y = 0;
float z = 0;
if(offset != null)
{
x = (float) offset.getX();
y = (float) offset.getY();
z = (float) offset.getZ();
}
PlayParticle(type, location, x, y, z, speed, count, dist, UtilServer.getPlayers());
}
public static void PlayParticle(ParticleType type, Location location, Vector offset, float speed, int count, ViewDist dist, Player... players)
{
PlayParticle(type, location, (float) offset.getX(), (float) offset.getY(), (float) offset.getZ(), speed, count, dist, players);
float x = 0;
float y = 0;
float z = 0;
if(offset != null)
{
x = (float) offset.getX();
y = (float) offset.getY();
z = (float) offset.getZ();
}
PlayParticle(type, location, x, y, z, speed, count, dist, players);
}
public static void PlayParticleToAll(ParticleType type, Location location, float offsetX, float offsetY, float offsetZ,
@ -286,7 +304,16 @@ public class UtilParticle
public static void PlayParticleToAll(String particle, Location location, Vector offset, float speed, int count, ViewDist dist)
{
PlayParticle(particle, location, (float) offset.getX(), (float) offset.getY(), (float) offset.getZ(), speed, count, dist, UtilServer.getPlayers());
float x = 0;
float y = 0;
float z = 0;
if(offset != null)
{
x = (float) offset.getX();
y = (float) offset.getY();
z = (float) offset.getZ();
}
PlayParticle(particle, location, x, y, z, speed, count, dist, UtilServer.getPlayers());
}
public static void PlayParticleToAll(String particle, Location location, float offsetX, float offsetY, float offsetZ,

View File

@ -39,15 +39,18 @@ import mineplex.core.gadget.gadgets.doublejump.DoubleJumpCandyCane;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFrostLord;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpTitan;
import mineplex.core.gadget.gadgets.item.ItemBatGun;
import mineplex.core.gadget.gadgets.item.ItemCoal;
import mineplex.core.gadget.gadgets.item.ItemCoinBomb;
import mineplex.core.gadget.gadgets.item.ItemDuelingSword;
import mineplex.core.gadget.gadgets.item.ItemEtherealPearl;
import mineplex.core.gadget.gadgets.item.ItemFirework;
import mineplex.core.gadget.gadgets.item.ItemFleshHook;
import mineplex.core.gadget.gadgets.item.ItemFreezeCannon;
import mineplex.core.gadget.gadgets.item.ItemMelonLauncher;
import mineplex.core.gadget.gadgets.item.ItemPaintballGun;
import mineplex.core.gadget.gadgets.item.ItemPaintbrush;
import mineplex.core.gadget.gadgets.item.ItemPartyPopper;
import mineplex.core.gadget.gadgets.item.ItemSnowball;
import mineplex.core.gadget.gadgets.item.ItemTNT;
import mineplex.core.gadget.gadgets.morph.MorphBat;
import mineplex.core.gadget.gadgets.morph.MorphBlaze;
@ -68,6 +71,7 @@ import mineplex.core.gadget.gadgets.outfit.OutfitRaveSuit;
import mineplex.core.gadget.gadgets.outfit.OutfitSpaceSuit;
import mineplex.core.gadget.gadgets.outfit.OutfitTeam;
import mineplex.core.gadget.gadgets.particle.ParticleCandyCane;
import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes;
import mineplex.core.gadget.gadgets.particle.ParticleEnchant;
import mineplex.core.gadget.gadgets.particle.ParticleFairy;
import mineplex.core.gadget.gadgets.particle.ParticleFireRings;
@ -147,6 +151,9 @@ public class GadgetManager extends MiniPlugin
addGadget(new ItemPaintbrush(this));
addGadget(new ItemDuelingSword(this));
addGadget(new ItemPartyPopper(this));
addGadget(new ItemCoal(this));
addGadget(new ItemFreezeCannon(this));
addGadget(new ItemSnowball(this));
// Costume
addGadget(new OutfitRaveSuit(this, "Rave Hat", -2, ArmorSlot.Helmet, Material.LEATHER_HELMET, (byte)0));
@ -194,6 +201,7 @@ public class GadgetManager extends MiniPlugin
addGadget(new ParticleFrostLord(this));
addGadget(new ParticleTitan(this));
addGadget(new ParticleCandyCane(this));
addGadget(new ParticleCoalFumes(this));
// Arrow Trails
addGadget(new ArrowTrailFrostLord(this));

View File

@ -0,0 +1,126 @@
package mineplex.core.gadget.gadgets.item;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.event.ItemGadgetOutOfAmmoEvent;
import mineplex.core.gadget.gadgets.Ammo;
import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
public class ItemCoal extends ItemGadget
{
public String[] Messages = new String[]
{
"Maybe you could.... eat it?",
"Yep, you're holding some coal...",
"This sure is a nice piece of coal!",
"Na na na na Na na na na " + C.cDGray + "BLACK COAL" + C.mBody + "!",
"Did you know that coal can be used for " + C.Scramble + "nothing" + C.mBody + "!",
};
public ItemCoal(GadgetManager manager)
{
super(manager, "Coal", new String[]
{
C.cDGray + "Exclusive Coal!",
C.cDGray + "Earned by beeing naughty"
}
, -1, Material.COAL, (byte) 0, 1000, new Ammo("Coal", "1 Piece of Coal", Material.COAL, (byte) 0, new String[]
{
C.cDGray + "Exclusive Coal!",
C.cDGray + "Earned by beeing naughty"
}
, 100, 100));
}
@Override
public void ActivateCustom(final Player player)
{
if(Manager.getInventoryManager().Get(player).getItemCount(GetName()) >= 1000)
{
player.sendMessage(F.main("Coal", "You unlocked " + C.cDGray + "COAL FUMES!"));
UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getLocation().add(0, 0.5, 0), 0.2f, 0.5f, 0.2f, 0, 500, ViewDist.LONG);
UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getLocation(), 1.5f, 0.0f, 1.5f, 0, 500, ViewDist.LONG);
player.getWorld().playSound(player.getLocation(), Sound.WITHER_DEATH, 0.8f, 0);
Manager.getInventoryManager().addItemToInventory(new Callback<Boolean>()
{
@Override
public void run(Boolean data)
{
Manager.getInventoryManager().addItemToInventory(player, GetName(), -1000);
player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName())));
}
}, player, "Coal Fumes", 1);
return;
}
int i = UtilMath.r(Messages.length);
String msg = Messages[i];
player.sendMessage(F.main("Coal", msg));
player.playSound(player.getLocation(), Sound.GHAST_FIREBALL, 0.2f, 1.5f*(i/(float)Messages.length));
}
@EventHandler @Override
public void Activate(PlayerInteractEvent event)
{
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
if (!UtilGear.isMat(event.getPlayer().getItemInHand(), this.GetDisplayMaterial()))
return;
Player player = event.getPlayer();
if (!IsActive(player))
return;
event.setCancelled(true);
//Stock
if (Manager.getInventoryManager().Get(player).getItemCount(GetName()) <= 0)
{
UtilPlayer.message(player, F.main("Gadget", "You do not have any " + GetName() + " left."));
ItemGadgetOutOfAmmoEvent ammoEvent = new ItemGadgetOutOfAmmoEvent(event.getPlayer(), this);
Bukkit.getServer().getPluginManager().callEvent(ammoEvent);
return;
}
//Recharge
if (!Recharge.Instance.use(player, GetName(), GetName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics"))
{
UtilInv.Update(player);
return;
}
player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName())));
ActivateCustom(event.getPlayer());
}
}

View File

@ -2,9 +2,9 @@ package mineplex.core.gadget.gadgets.item;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
@ -17,7 +17,6 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.Ammo;
import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.recharge.Recharge;
public class ItemFirework extends ItemGadget
{

View File

@ -0,0 +1,197 @@
package mineplex.core.gadget.gadgets.item;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.EntityEffect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.Ammo;
import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class ItemFreezeCannon extends ItemGadget implements IThrown
{
private HashMap<Player, Long> _playerMap = new HashMap<>();
public ItemFreezeCannon(GadgetManager manager)
{
super(manager, "Freeze Cannon", new String[]
{
C.cWhite + "Freeze your nemesis inside a block of ice!"
}
, -1, Material.ICE, (byte) 0, 2000, new Ammo("Freeze Cannon", "100 Ice Blocks", Material.ICE, (byte) 0, new String[]
{
C.cWhite + "100 Ice Blocks for you to launch!"
}, 500, 100));
}
@Override
public void ActivateCustom(Player player)
{
Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), new ItemStack(Material.ICE));
UtilAction.velocity(item, player.getLocation().getDirection(),
1, false, 0, 0.2, 10, false);
Manager.getProjectileManager().AddThrow(item, player, this, 5000, true, true, true, true,
null, 1f, 1f, null, null, 0, UpdateType.TICK, 0.5f);
//Inform
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
//Effect
item.getWorld().playSound(item.getLocation(), Sound.EXPLODE, 0.5f, 0.5f);
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
if (target instanceof Player)
{
Player p = (Player) target;
int ticks = 4 * 20;
if(isClear(p.getLocation()))
{
Manager.getBlockRestore().add(p.getLocation().getBlock(), Material.STAINED_GLASS.getId(), (byte)5, 0, (byte)0, ticks*50);
Manager.getBlockRestore().add(p.getLocation().getBlock().getRelative(BlockFace.UP), Material.STAINED_GLASS.getId(), (byte)5, 0, (byte)0, ticks*50);
if(p.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.AIR)
{
Manager.getBlockRestore().add(p.getLocation().getBlock().getRelative(BlockFace.DOWN), Material.STAINED_GLASS.getId(), (byte)5, 0, (byte)0, ticks*50);
}
p.setWalkSpeed(0);
_playerMap.put(p, System.currentTimeMillis() + (ticks * 50));
p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, ticks, 250, true, false));
p.teleport(target.getLocation().getBlock().getLocation().add(0.5, 0, 0.5));
Recharge.Instance.useForce(p, "Double Jump", ticks*50);
p.setAllowFlight(false);
p.getWorld().playSound(p.getLocation(), Sound.FIZZ, 0.25f, 0.75f);
}
//Effect
target.playEffect(EntityEffect.HURT);
}
smash(data.GetThrown());
}
@EventHandler
public void onMove(PlayerMoveEvent event)
{
if(!_playerMap.containsKey(event.getPlayer())) return;
if(event.getFrom().distanceSquared(event.getTo()) > 0.3)
{
event.setCancelled(true);
}
}
public boolean isClear(Location loc)
{
Block b = loc.getBlock();
ArrayList<Block> blocks = UtilBlock.getInBoundingBox(b.getLocation().subtract(1, 0, 1), b.getLocation().add(1, 1, 1));
for(Block test : blocks)
{
if(test.getType() == Material.PORTAL) return false;
}
if(b.getType() != Material.AIR) return false;
if(b.getRelative(BlockFace.UP).getType() != Material.AIR) return false;
return true;
}
@EventHandler
public void cleanup(UpdateEvent event)
{
if(event.getType() == UpdateType.FAST)
{
for(Iterator<Player> it = _playerMap.keySet().iterator(); it.hasNext();)
{
Player p = it.next();
Long time = _playerMap.get(p);
if(time == null)
{
p.setWalkSpeed(0.2f);
p.setAllowFlight(false);
it.remove();
continue;
}
if(time < System.currentTimeMillis())
{
p.setWalkSpeed(0.2f);
p.setAllowFlight(false);
it.remove();
continue;
}
}
}
if(event.getType() == UpdateType.TICK)
{
for(Player p : _playerMap.keySet())
{
Long time = _playerMap.get(p);
if(time <= System.currentTimeMillis()) continue;
for(Player op : UtilServer.getPlayers())
{
if(op.equals(p)) continue;
op.sendBlockChange(p.getLocation(), Material.ICE, (byte) 0);
op.sendBlockChange(p.getLocation().add(0, 1, 0), Material.ICE, (byte) 0);
}
}
}
}
@Override
public void Idle(ProjectileUser data)
{
smash(data.GetThrown());
}
@Override
public void Expire(ProjectileUser data)
{
smash(data.GetThrown());
}
public void smash(Entity ent)
{
//Effect
ent.getWorld().playEffect(ent.getLocation(), Effect.STEP_SOUND, Material.ICE);
//Remove
ent.remove();
}
}

View File

@ -0,0 +1,141 @@
package mineplex.core.gadget.gadgets.item;
import java.util.HashSet;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.Ammo;
import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class ItemPartyPopper extends ItemGadget implements IThrown
{
HashSet<Item> _items = new HashSet<>();
public ItemPartyPopper(GadgetManager manager)
{
super(manager, "Confetti Bomb", new String[]
{
C.cWhite + "POP BANG!",
}, -1, Material.GOLDEN_CARROT, (byte) 0, 1000, new Ammo("Confetti Bomb", "100 Party Poppers", Material.DIAMOND_BARDING,
(byte) 0, new String[]
{
C.cWhite + "100 Party Poppers for you to shoot!"
}, 500, 100));
}
@Override
public void ActivateCustom(Player player)
{
Item ent = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()),
ItemStackFactory.Instance.CreateStack(Material.REDSTONE_LAMP_OFF, (byte)0, 1, "Lamp" + Math.random()));
UtilAction.velocity(ent, player.getLocation().getDirection().normalize().multiply(0.1), 1, false, 0, 0.2, 10, false);
Manager.getProjectileManager().AddThrow(ent, player, this, 3000, false, false, true, true, 0.5f);
/*
for(int data : new int[]{1,2,4,5,6,9,10,11,12,13,14,15})
{
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, data), player.getEyeLocation(), null, 0.4f, 50, ViewDist.LONG);
/*
for(int i = 0; i < 10; i++)
{
Vector v = new Vector(Math.random() - 0.5, Math.random() - 0.3, Math.random() - 0.5);
v.normalize();
v.multiply(0.2);
v.add(player.getLocation().getDirection());
v.normalize().multiply(Math.random()*0.4 + 0.4);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, data), player.getEyeLocation(), v, 1, 0, ViewDist.LONG);
}
/*
Item ent = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()),
ItemStackFactory.Instance.CreateStack(Material.INK_SACK, (byte)data, 1, "Ink" + Math.random()));
_items.add(ent);
Vector random = new Vector(Math.random() - 0.5, Math.random() - 0.3, Math.random() - 0.5);
random.normalize();
random.multiply(0.05);
UtilAction.velocity(ent, player.getLocation().getDirection().normalize().multiply(0.3).add(random), 1 + 0.4 * Math.random(), false, 0, 0.2, 10, false);
Manager.getProjectileManager().AddThrow(ent, player, this, 3000, false, false, true, true, 0.5f);
*/
// }
// Sound
for(int i = 0; i < 3; i++)
{
player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 2.0f, 0.8f);
}
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
Explode(data);
}
@Override
public void Idle(ProjectileUser data)
{
Explode(data);
}
@Override
public void Expire(ProjectileUser data)
{
Explode(data);
}
@EventHandler
public void particleTrail(UpdateEvent event)
{
if(event.getType() != UpdateType.TICK) return;
for(Item item : _items)
{
byte data = item.getItemStack().getData().getData();
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, data), item.getLocation(), 0, 0, 0, 0.0f, 3, ViewDist.LONG);
}
}
public void Explode(ProjectileUser data)
{
for(int type : new int[]{1,2,4,5,6,9,10,11,12,13,14,15})
{
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, type), data.GetThrown().getLocation(), null, 0.4f, 50, ViewDist.LONG);
}
data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.LAVA_POP, 0.75f, 1.25f);
data.GetThrown().remove();
/*
if (data.GetThrown() instanceof Item)
{
Item item = (Item) data.GetThrown();
byte b = item.getItemStack().getData().getData();
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, b), item.getLocation(), 0, 0, 0, 0.2f, 80, ViewDist.LONG);
_items.remove(item);
}
data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.LAVA_POP, 0.75f, 1.25f);
data.GetThrown().remove();
*/
}
}

View File

@ -0,0 +1,61 @@
package mineplex.core.gadget.gadgets.item;
import java.util.HashSet;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.entity.Snowball;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAction;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
import mineplex.core.gadget.gadgets.Ammo;
import mineplex.core.gadget.types.ItemGadget;
public class ItemSnowball extends ItemGadget
{
private HashSet<Snowball> _snowballs = new HashSet<>();
public ItemSnowball(GadgetManager manager)
{
super(manager, "Snowball", new String[]
{
C.cWhite + "Throw snowball!",
C.cWhite + "Start epic snowfights!"
}
, -1, Material.SNOW_BALL, (byte) 0, 1, new Ammo("Snowball", "50 Snowballs", Material.SNOW_BALL, (byte) 0, new String[]
{
C.cWhite + "50 Snowballs for you to throw!"
}
, 100, 50));
}
@Override
public void ActivateCustom(Player player)
{
Snowball ball = player.launchProjectile(Snowball.class);
_snowballs.add(ball);
ball.getWorld().playSound(ball.getLocation(), Sound.CHICKEN_EGG_POP, 1f, 0.3f);
}
@EventHandler
public void onHit(EntityDamageByEntityEvent event)
{
if(!_snowballs.contains(event.getDamager())) return;
GadgetCollideEntityEvent gevent = new GadgetCollideEntityEvent(this, event.getEntity());
if(gevent.isCancelled()) return;
UtilAction.velocity(event.getEntity(), event.getDamager().getVelocity().normalize().add(new Vector(0,0.5,0)));
event.getDamager().getWorld().playSound(event.getDamager().getLocation(), Sound.STEP_SNOW, 1, 0.5f);
}
}

View File

@ -16,9 +16,13 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.disguise.disguises.DisguiseSnowman;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
@ -77,31 +81,45 @@ public class MorphSnowman extends MorphGadget
@EventHandler
public void Snow(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTEST)
return;
for (Player player : GetActive())
if (event.getType() == UpdateType.FASTEST)
{
NautHashMap<String, RechargeData> map = Recharge.Instance.Get(player);
if(map == null) continue;
RechargeData data = map.get("Blizzard");
if(data == null) continue;
if(data.GetRemaining() < 10000) continue;
for (int i=0 ; i<4 ; i++)
{
Snowball snow = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Snowball.class);
double x = 0.1 - (UtilMath.r(20)/100d);
double y = UtilMath.r(20)/100d;
double z = 0.1 - (UtilMath.r(20)/100d);
snow.setShooter(player);
snow.setVelocity(player.getLocation().getDirection().add(new Vector(x,y,z)).multiply(2));
_snowball.put(snow, player);
}
//Effect
player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 0.2f, 0.5f);
for (Player player : GetActive())
{
NautHashMap<String, RechargeData> map = Recharge.Instance.Get(player);
if(map == null) continue;
RechargeData data = map.get("Blizzard");
if(data == null) continue;
if(data.GetRemaining() < 10000) continue;
for (int i=0 ; i<4 ; i++)
{
Snowball snow = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Snowball.class);
double x = 0.1 - (UtilMath.r(20)/100d);
double y = UtilMath.r(20)/100d;
double z = 0.1 - (UtilMath.r(20)/100d);
snow.setShooter(player);
snow.setVelocity(player.getLocation().getDirection().add(new Vector(x,y,z)).multiply(2));
_snowball.put(snow, player);
}
//Effect
player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 0.2f, 0.5f);
}
}
if(event.getType() == UpdateType.TICK)
{
for (Player player : GetActive())
{
if(player.isSneaking() && UtilEnt.isGrounded(player))
{
player.setVelocity(player.getLocation().getDirection().setY(0).normalize());
UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, player.getLocation(), 0.3f, 0.1f, 0.3f, 0, 10, ViewDist.NORMAL);
player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 0.3f, 0.3f);
}
}
}
}

View File

@ -0,0 +1,45 @@
package mineplex.core.gadget.gadgets.particle;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ParticleGadget;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class ParticleCoalFumes extends ParticleGadget
{
public ParticleCoalFumes(GadgetManager manager)
{
super(manager, "Coal Fumes", new String[]
{
C.cDGray + "Nothing to read here. Please move on."
}, -1, Material.COAL, (byte) 0);
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
if(event.getType() != UpdateType.TICK) return;
int dur = 200;
int tick = Math.abs(event.getTick()%dur);
double d = tick/(double)dur;
float xz = (float) Math.sin(d*Math.PI);
for(Player p : GetActive())
{
UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, p.getLocation(), xz, 0, xz, 0, 5, ViewDist.NORMAL);
}
}
}

View File

@ -354,7 +354,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
if(pet instanceof PigZombie)
{
UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, pet.getLocation(), 0.2f,0.0f,0.2f, 0.0f, 4, ViewDist.NORMAL);
if(event.getTick()%3 == 0) pet.getWorld().playSound(pet.getLocation(), Sound.BLAZE_BREATH, 0.1f, 0f);
if(event.getTick()%3 == 0) pet.getWorld().playSound(pet.getLocation(), Sound.BLAZE_BREATH, 0.03f, 0f);
if(!((CraftPigZombie)pet).getHandle().isSilent())
{
((CraftPigZombie)pet).getHandle().setSilent(true);

View File

@ -4,27 +4,93 @@ import mineplex.core.common.util.UtilTime;
public enum UpdateType
{
/**
* Once every 64 minutes
*/
MIN_64(3840000),
/**
* Once every 60 minutes
*/
HOUR_01(3600000),
/**
* Once every 32 minutes
*/
MIN_32(1920000),
/**
* Once every 30 minutes
*/
MIN_30(1800000),
/**
* Once every 16 minutes
*/
MIN_16(960000),
/**
* Once every 10 minutes
*/
MIN_10(600000),
/**
* Once every 8 minutes
*/
MIN_08(480000),
/**
* Once every 5 minutes
*/
MIN_05(300000),
/**
* Once every 4 minutes
*/
MIN_04(240000),
/**
* Once every 2 minutes
*/
MIN_02(120000),
/**
* Once every minute
*/
MIN_01(60000),
/**
* Once every 32 seconds
*/
SLOWEST(32000),
/**
* ONce every 30 seconds
*/
SEC_30(30000),
/**
* Once every 16 seconds
*/
SLOWER(16000),
/**
* Once every 8 seconds
*/
SEC_08(8000),
/**
* Once every 4 seconds
*/
SLOW(4000),
/**
* Once every 40 ticks
*/
TWOSEC(2000),
/**
* Once every 20 ticks
*/
SEC(1000),
/**
* Once every 10 ticks
*/
FAST(500),
/**
* Once every 5 ticks
*/
FASTER(250),
/**
* Once every 3 ticks
*/
FASTEST(125),
/**
* Once every tick
*/
TICK(49);
private long _time;

View File

@ -30,6 +30,7 @@ import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.event.GadgetActivateEvent;
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.giveaway.GiveawayManager;
import mineplex.core.hologram.HologramManager;
import mineplex.core.inventory.InventoryManager;
@ -279,7 +280,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
Player player = event.getPlayer();
_gadgetManager.RemoveItem(player);
_gadgetManager.removeGadetType(player, GadgetType.Item);
player.getInventory().setItem(3, new ItemStack(Material.SNOW_BALL, 16));
}

View File

@ -176,7 +176,7 @@ public class DisguiseCommand extends CommandBase<HubManager> implements Listener
changeName(caller, args[0]);
Plugin.GetGadget().RemoveItem(caller);
Plugin.GetGadget().removeGadetType(caller, GadgetType.Item);
UtilPlayer.message(caller, C.cGreen + C.Bold + "Disguise Active: " + ChatColor.RESET + args[0]);
} catch(Exception e)