summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2012-09-28 20:45:56 +0100
committerKHobbits <rob@khobbits.co.uk>2012-09-28 20:45:56 +0100
commitdb6512b70258845ebcc9c81db7fb8ae9f61797a5 (patch)
treeda2d6bd7ff97e156af3b034afe50af55d1c273b3
parent46d3f0827a91b36947b757f5d93aef051cde7886 (diff)
downloadEssentials-db6512b70258845ebcc9c81db7fb8ae9f61797a5.tar
Essentials-db6512b70258845ebcc9c81db7fb8ae9f61797a5.tar.gz
Essentials-db6512b70258845ebcc9c81db7fb8ae9f61797a5.tar.lz
Essentials-db6512b70258845ebcc9c81db7fb8ae9f61797a5.tar.xz
Essentials-db6512b70258845ebcc9c81db7fb8ae9f61797a5.zip
Cleanup of god mode effects, suggested by gravypod.
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java17
1 files changed, 11 insertions, 6 deletions
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java
index aa23970bc..0dfff355c 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java
@@ -49,7 +49,7 @@ public class EssentialsEntityListener implements Listener
{
event.setCancelled(true);
}
-
+
if (attacker.isGodModeEnabled() && !attacker.isAuthorized("essentials.god.pvp"))
{
event.setCancelled(true);
@@ -168,11 +168,16 @@ public class EssentialsEntityListener implements Listener
@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++)
+ for (LivingEntity entity : event.getAffectedEntities())
{
- if (entities[i] instanceof Player && ess.getUser(entities[i]).isGodModeEnabled())
- event.setIntensity(entities[i], 0);
+ if (entity instanceof Player)
+ {
+ User user = ess.getUser(entity);
+ if (user.isGodModeEnabled())
+ {
+ event.setIntensity(entity, 0d);
+ }
+ }
}
}
-}
+}