diff options
author | KHobbits <rob@khobbits.co.uk> | 2012-09-28 20:35:13 +0100 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2012-09-28 20:35:13 +0100 |
commit | 46d3f0827a91b36947b757f5d93aef051cde7886 (patch) | |
tree | d0aa78a1741d98d30687b55a0ca0d52f38bd0cbd | |
parent | b9e5c8827fbf04396ef9e3c020d5b05ea35c748d (diff) | |
download | Essentials-46d3f0827a91b36947b757f5d93aef051cde7886.tar Essentials-46d3f0827a91b36947b757f5d93aef051cde7886.tar.gz Essentials-46d3f0827a91b36947b757f5d93aef051cde7886.tar.lz Essentials-46d3f0827a91b36947b757f5d93aef051cde7886.tar.xz Essentials-46d3f0827a91b36947b757f5d93aef051cde7886.zip |
God mode cancel potion effects - Chris ward
Revert heal changes.
-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); + } + } } |