summaryrefslogtreecommitdiffstats
path: root/EssentialsProtect/src/com
diff options
context:
space:
mode:
authorIaccidentally <coryhuckaby@gmail.com>2012-10-28 12:53:12 -0400
committerIaccidentally <coryhuckaby@gmail.com>2012-10-28 12:53:12 -0400
commit91c193b773e121fdf8da241b91adb475f3b12072 (patch)
treef57c18e555cf92f106a7bf7210c67002105f1a3d /EssentialsProtect/src/com
parent4a18130354547f3a9dc96d33b6793ab8e1fd1b05 (diff)
downloadEssentials-91c193b773e121fdf8da241b91adb475f3b12072.tar
Essentials-91c193b773e121fdf8da241b91adb475f3b12072.tar.gz
Essentials-91c193b773e121fdf8da241b91adb475f3b12072.tar.lz
Essentials-91c193b773e121fdf8da241b91adb475f3b12072.tar.xz
Essentials-91c193b773e121fdf8da241b91adb475f3b12072.zip
Fully support wither blocking in protect
Diffstat (limited to 'EssentialsProtect/src/com')
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java23
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java3
2 files changed, 26 insertions, 0 deletions
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
index 5ce7623b6..bb406ebf9 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
@@ -114,6 +114,16 @@ public class EssentialsProtectEntityListener implements Listener
event.setCancelled(true);
return;
}
+
+ if ((event.getEntity() instanceof WitherSkull
+ && prot.getSettingBool(ProtectConfig.prevent_witherskull_playerdmg)
+ && !(target instanceof Player
+ && user.isAuthorized("essentials.protect.damage.witherskull")
+ && !user.isAuthorized("essentials.protect.damage.disable"))))
+ {
+ event.setCancelled(true);
+ return;
+ }
if (eAttack instanceof TNTPrimed && prot.getSettingBool(ProtectConfig.prevent_tnt_playerdmg)
&& !(target instanceof Player
@@ -214,6 +224,12 @@ public class EssentialsProtectEntityListener implements Listener
}
return;
}
+ if (event.getEntity() instanceof WitherSkull
+ && prot.getSettingBool(ProtectConfig.prevent_witherskull_spawnexplosion))
+ {
+ event.setCancelled(true);
+ return;
+ }
else if (event.getEntity() instanceof Creeper
&& (prot.getSettingBool(ProtectConfig.prevent_creeper_explosion)
|| prot.getSettingBool(ProtectConfig.prevent_creeper_blockdmg)
@@ -236,6 +252,13 @@ public class EssentialsProtectEntityListener implements Listener
event.setCancelled(true);
return;
}
+ else if ((event.getEntity() instanceof WitherSkull)
+ && prot.getSettingBool(ProtectConfig.prevent_witherskull_explosion))
+ {
+ event.setCancelled(true);
+ return;
+ }
+
// This code will prevent explosions near protected rails, signs or protected chests
// TODO: Use protect db instead of this code
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java b/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java
index dda0060bf..c53e921d9 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java
@@ -35,6 +35,9 @@ public enum ProtectConfig
prevent_fireball_explosion("protect.prevent.fireball-explosion", false),
prevent_fireball_fire("protect.prevent.fireball-fire", false),
prevent_fireball_playerdmg("protect.prevent.fireball-playerdamage", false),
+ prevent_witherskull_explosion("protect.prevent.witherskull-explosion", false),
+ prevent_witherskull_playerdmg("protect.prevent.witherskull-playerdamage", false),
+ prevent_witherskull_spawnexplosion("protect.prevent.witherskull-spawnexplosion", false),
prevent_creeper_explosion("protect.prevent.creeper-explosion", true),
prevent_creeper_playerdmg("protect.prevent.creeper-playerdamage", false),
prevent_creeper_blockdmg("protect.prevent.creeper-blockdamage", false),