From 13fbd311249a18d76eae9e1b87628bd7267f62cd Mon Sep 17 00:00:00 2001 From: Ashazi Date: Sat, 12 Aug 2017 09:27:51 -0400 Subject: [PATCH] Prevent flaming arrows damage from vanished and godmode players. (#1462) --- .../essentials/EssentialsEntityListener.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java index 4e50ebe3a..02157a64a 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java @@ -120,6 +120,22 @@ public class EssentialsEntityListener implements Listener { } } + @EventHandler(priority = EventPriority.MONITOR) + public void onEntityCombustByEntity(final EntityCombustByEntityEvent event) { + if (event.getCombuster() instanceof Arrow) { + Arrow combuster = (Arrow) event.getCombuster(); + if (combuster.getShooter() instanceof Player) { + final User srcCombuster = ess.getUser(((Player) combuster.getShooter()).getUniqueId()); + if (srcCombuster.isGodModeEnabled() && !srcCombuster.isAuthorized("essentials.god.pvp")) { + event.setCancelled(true); + } + if (srcCombuster.isHidden() && !srcCombuster.isAuthorized("essentials.vanish.pvp")) { + event.setCancelled(true); + } + } + } + } + @EventHandler(priority = EventPriority.LOWEST) public void onPlayerDeathEvent(final PlayerDeathEvent event) { final User user = ess.getUser(event.getEntity());