Gadget Paintball: Add particles on impact, change block break effect to stone break sound.

This commit is contained in:
libraryaddict 2015-08-12 06:23:13 +12:00
parent 18843c2cc6
commit 72adf21bff

View File

@ -18,9 +18,15 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
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.common.util.UtilServer;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.event.GadgetBlockEvent; import mineplex.core.gadget.event.GadgetBlockEvent;
import mineplex.core.gadget.types.ItemGadget; import mineplex.core.gadget.types.ItemGadget;
@ -36,10 +42,11 @@ public class ItemPaintballGun extends ItemGadget
super(manager, "Paintball Gun", new String[] super(manager, "Paintball Gun", new String[]
{ {
C.cWhite + "PEW PEW PEW PEW!", C.cWhite + "PEW PEW PEW PEW!",
}, }, -1, Material.GOLD_BARDING, (byte) 0, 200, new Ammo("Paintball Gun", "100 Paintballs", Material.GOLD_BARDING,
-1, (byte) 0, new String[]
Material.GOLD_BARDING, (byte)0, {
200, new Ammo("Paintball Gun", "100 Paintballs", Material.GOLD_BARDING, (byte)0, new String[] { C.cWhite + "100 Paintballs for you to shoot!" }, 500, 100)); C.cWhite + "100 Paintballs for you to shoot!"
}, 500, 100));
} }
@Override @Override
@ -59,8 +66,26 @@ public class ItemPaintballGun extends ItemGadget
if (!_balls.remove(event.getEntity())) if (!_balls.remove(event.getEntity()))
return; return;
Location loc = event.getEntity().getLocation().add(event.getEntity().getVelocity()); Location loc = event.getEntity().getLocation();
loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 49);
Vector vec = event.getEntity().getVelocity().normalize().multiply(0.05);
if (vec.length() > 0)
{
int i = 0;
while (UtilBlock.airFoliage(loc.getBlock()))
{
loc.add(vec);
if (i++ > 50)
break;
}
}
loc.getWorld().playSound(loc, Sound.DIG_STONE, 1.3F, 1.3F);
UtilParticle.PlayParticle(ParticleType.RED_DUST, loc, 0.2F, 0.2F, 0.2F, 1, 70, ViewDist.LONG, UtilServer.getPlayers());
} }
@EventHandler @EventHandler