From c51612d9984cdc54b8e43bbf3e27cb5ea5d85100 Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 15 May 2011 12:33:17 +0000 Subject: Added permissions to bypass EssentialsProtect damage protection. Change for admin! Since we don't want to murder all admins, I added another permission: essentials.protect.damage.disable Since all admins get this by using '*', all those damage permissions are disabled Don't use - -essentials.protect.damage.* as I stated in the last commit. git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1479 e251c2fe-e539-e718-e476-b85c1f46cddb --- .../protect/EssentialsProtectEntityListener.java | 33 ++++++++++++++-------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'EssentialsProtect') diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java index fa61b5b83..114dd0cb4 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java @@ -53,21 +53,24 @@ public class EssentialsProtectEntityListener extends EntityListener if (EssentialsProtect.playerSettings.get("protect.disable.contactdmg") && cause == DamageCause.CONTACT && !(event.getEntity() instanceof Player - && Essentials.getStatic().getUser(event.getEntity()).isAuthorized("essentials.protect.damage.contact"))) + && Essentials.getStatic().getUser(event.getEntity()).isAuthorized("essentials.protect.damage.contact") + && !Essentials.getStatic().getUser(event.getEntity()).isAuthorized("essentials.protect.damage.disable"))) { event.setCancelled(true); return; } if (EssentialsProtect.playerSettings.get("protect.disable.lavadmg") && cause == DamageCause.LAVA && !(event.getEntity() instanceof Player - && Essentials.getStatic().getUser(event.getEntity()).isAuthorized("essentials.protect.damage.lava"))) + && Essentials.getStatic().getUser(event.getEntity()).isAuthorized("essentials.protect.damage.lava") + && !Essentials.getStatic().getUser(event.getEntity()).isAuthorized("essentials.protect.damage.disable"))) { event.setCancelled(true); return; } if (EssentialsProtect.guardSettings.get("protect.prevent.tnt-explosion") && cause == DamageCause.BLOCK_EXPLOSION && !(event.getEntity() instanceof Player - && Essentials.getStatic().getUser(event.getEntity()).isAuthorized("essentials.protect.damage.tnt"))) + && Essentials.getStatic().getUser(event.getEntity()).isAuthorized("essentials.protect.damage.tnt") + && !Essentials.getStatic().getUser(event.getEntity()).isAuthorized("essentials.protect.damage.disable"))) { event.setCancelled(true); return; @@ -100,7 +103,8 @@ public class EssentialsProtectEntityListener extends EntityListener { if (eAttack instanceof Creeper && EssentialsProtect.guardSettings.get("protect.prevent.creeper-explosion") && !(event.getEntity() instanceof Player - && Essentials.getStatic().getUser(event.getEntity()).isAuthorized("essentials.protect.damage.creeper"))) + && Essentials.getStatic().getUser(event.getEntity()).isAuthorized("essentials.protect.damage.creeper") + && !Essentials.getStatic().getUser(event.getEntity()).isAuthorized("essentials.protect.damage.disable"))) { event.setCancelled(true); return; @@ -108,7 +112,8 @@ public class EssentialsProtectEntityListener extends EntityListener if (eAttack instanceof Creeper && EssentialsProtect.guardSettings.get("protect.prevent.creeper-playerdamage") && !(event.getEntity() instanceof Player - && Essentials.getStatic().getUser(event.getEntity()).isAuthorized("essentials.protect.damage.creeper"))) + && Essentials.getStatic().getUser(event.getEntity()).isAuthorized("essentials.protect.damage.creeper") + && !Essentials.getStatic().getUser(event.getEntity()).isAuthorized("essentials.protect.damage.disable"))) { event.setCancelled(true); return; @@ -120,7 +125,8 @@ public class EssentialsProtectEntityListener extends EntityListener { if (event.getEntity() instanceof Player && EssentialsProtect.playerSettings.get("protect.disable.projectiles") - && !Essentials.getStatic().getUser(event.getEntity()).isAuthorized("essentials.protect.damage.projectiles")) + && !Essentials.getStatic().getUser(event.getEntity()).isAuthorized("essentials.protect.damage.projectiles") + && !Essentials.getStatic().getUser(event.getEntity()).isAuthorized("essentials.protect.damage.disable")) { event.setCancelled(true); return; @@ -132,33 +138,38 @@ public class EssentialsProtectEntityListener extends EntityListener if (casualty instanceof Player) { if (EssentialsProtect.playerSettings.get("protect.disable.fall") && cause == DamageCause.FALL - && !(Essentials.getStatic().getUser(casualty).isAuthorized("essentials.protect.damage.fall"))) + && !(Essentials.getStatic().getUser(casualty).isAuthorized("essentials.protect.damage.fall") + && !Essentials.getStatic().getUser(event.getEntity()).isAuthorized("essentials.protect.damage.disable"))) { event.setCancelled(true); return; } if (EssentialsProtect.playerSettings.get("protect.disable.suffocate") && cause == DamageCause.SUFFOCATION - && !(Essentials.getStatic().getUser(casualty).isAuthorized("essentials.protect.damage.suffocation"))) + && !(Essentials.getStatic().getUser(casualty).isAuthorized("essentials.protect.damage.suffocation") + && !Essentials.getStatic().getUser(event.getEntity()).isAuthorized("essentials.protect.damage.disable"))) { event.setCancelled(true); return; } if (EssentialsProtect.playerSettings.get("protect.disable.firedmg") && (cause == DamageCause.FIRE || cause == DamageCause.FIRE_TICK) - && !(Essentials.getStatic().getUser(casualty).isAuthorized("essentials.protect.damage.fire"))) + && !(Essentials.getStatic().getUser(casualty).isAuthorized("essentials.protect.damage.fire") + && !Essentials.getStatic().getUser(event.getEntity()).isAuthorized("essentials.protect.damage.disable"))) { event.setCancelled(true); return; } if (EssentialsProtect.playerSettings.get("protect.disable.drown") && cause == DamageCause.DROWNING - && !(Essentials.getStatic().getUser(casualty).isAuthorized("essentials.protect.damage.drowning"))) + && !(Essentials.getStatic().getUser(casualty).isAuthorized("essentials.protect.damage.drowning") + && !Essentials.getStatic().getUser(event.getEntity()).isAuthorized("essentials.protect.damage.disable"))) { event.setCancelled(true); return; } if (EssentialsProtect.playerSettings.get("protect.disable.lightning") && cause == DamageCause.LIGHTNING - && !(Essentials.getStatic().getUser(casualty).isAuthorized("essentials.protect.damage.lightning"))) + && !(Essentials.getStatic().getUser(casualty).isAuthorized("essentials.protect.damage.lightning") + && !Essentials.getStatic().getUser(event.getEntity()).isAuthorized("essentials.protect.damage.disable"))) { event.setCancelled(true); return; -- cgit v1.2.3