Fix the paintball gun gadget teleporting players

This commit is contained in:
Sam 2017-12-21 16:23:58 +00:00 committed by Alexander Meech
parent 8ec7d92290
commit 90b4d003ec

View File

@ -11,8 +11,6 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
@ -31,7 +29,7 @@ import mineplex.core.updater.event.UpdateEvent;
public class ItemPaintballGun extends ItemGadget
{
private Set<Projectile> _balls = new HashSet<>();
private final Set<Projectile> _balls = new HashSet<>();
public ItemPaintballGun(GadgetManager manager)
{
@ -48,6 +46,7 @@ public class ItemPaintballGun extends ItemGadget
public void ActivateCustom(Player player)
{
Projectile proj = player.launchProjectile(EnderPearl.class);
proj.setShooter(null);
proj.setVelocity(proj.getVelocity().multiply(2));
_balls.add(proj);
@ -88,17 +87,6 @@ public class ItemPaintballGun extends ItemGadget
UtilParticle.PlayParticle(ParticleType.RED_DUST, loc, 0.2F, 0.2F, 0.2F, 1, 70, ViewDist.LONG, UtilServer.getPlayers());
}
@EventHandler
public void enderPearlTeleport(PlayerTeleportEvent event)
{
if (event.getCause() != TeleportCause.ENDER_PEARL && !isActive(event.getPlayer()))
{
return;
}
event.setCancelled(true);
}
@EventHandler
public void cleanupBalls(UpdateEvent event)
{