diff options
-rw-r--r-- | Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java index 8dbd02a38..aa23970bc 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java @@ -7,6 +7,7 @@ import java.util.logging.Logger; import org.bukkit.Material; import org.bukkit.entity.Ageable; import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -14,6 +15,8 @@ import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; import org.bukkit.event.entity.*; import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; public class EssentialsEntityListener implements Listener @@ -161,4 +164,15 @@ public class EssentialsEntityListener implements Listener event.setCancelled(true); } } + + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) + public void onPotionSplashEvent(final PotionSplashEvent event) + { + LivingEntity[] entities = event.getAffectedEntities().toArray(new LivingEntity[event.getAffectedEntities().size()]); + for(int i = 0; i < entities.length; i++) + { + if (entities[i] instanceof Player && ess.getUser(entities[i]).isGodModeEnabled()) + event.setIntensity(entities[i], 0); + } + } } |