add ProjectileLaunch listener.

This commit is contained in:
DNx5 2015-09-20 23:17:03 +07:00
parent accd209e84
commit b9dce03af5

View File

@ -8,6 +8,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.*;
import org.bukkit.event.player.PlayerEggThrowEvent;
public class AuthMeEntityListener implements Listener {
@ -119,4 +120,18 @@ public class AuthMeEntityListener implements Listener {
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onProjectileLaunch(ProjectileLaunchEvent event) {
Entity entity = (Entity) event.getEntity().getShooter();
if (entity == null || !(entity instanceof Player)) {
return;
}
if (Utils.checkAuth((Player) entity)) {
return;
}
event.setCancelled(true);
}
}