From fec4fb29138686674241fc2a6f471bf20dedf46b Mon Sep 17 00:00:00 2001 From: DNx5 Date: Wed, 23 Sep 2015 17:55:56 +0700 Subject: [PATCH] projectile issue --- .../fr/xephi/authme/listener/AuthMeEntityListener.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java index da4b43ea2..34b3b0f24 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java @@ -9,6 +9,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.entity.*; +import org.bukkit.projectiles.ProjectileSource; public class AuthMeEntityListener implements Listener { @@ -121,13 +122,14 @@ public class AuthMeEntityListener implements Listener { event.setCancelled(true); } - @EventHandler(priority = EventPriority.HIGHEST) + // TODO: Need to check this, player can't throw snowball but the item is taken. + @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onProjectileLaunch(ProjectileLaunchEvent event) { Projectile projectile = event.getEntity(); if (projectile == null) return; - Entity shooter = (Entity) projectile.getShooter(); + ProjectileSource shooter = projectile.getShooter(); if (shooter == null || !(shooter instanceof Player)) { return; } @@ -139,7 +141,7 @@ public class AuthMeEntityListener implements Listener { event.setCancelled(true); } - @EventHandler + @EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL) public void onShoot(EntityShootBowEvent event) { Entity entity = event.getEntity(); if (entity == null || !(entity instanceof Player)) {