summaryrefslogtreecommitdiffstats
path: root/EssentialsProtect/src/com/earth2me/essentials
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-12-08 00:48:53 +0100
committersnowleo <schneeleo@gmail.com>2011-12-08 00:48:53 +0100
commit5002e7a6ad13295ed85d5758da5a739ade116a72 (patch)
tree528fa73bc0fd82a3c450c5d7a8602c60c95abc26 /EssentialsProtect/src/com/earth2me/essentials
parent13a42d1937a608669dae53f19adf8e1e3508d6be (diff)
downloadEssentials-5002e7a6ad13295ed85d5758da5a739ade116a72.tar
Essentials-5002e7a6ad13295ed85d5758da5a739ade116a72.tar.gz
Essentials-5002e7a6ad13295ed85d5758da5a739ade116a72.tar.lz
Essentials-5002e7a6ad13295ed85d5758da5a739ade116a72.tar.xz
Essentials-5002e7a6ad13295ed85d5758da5a739ade116a72.zip
Prevent blockdamage by enderdragon (default true) in EssentialsProtect CB#1566 B#1058
Diffstat (limited to 'EssentialsProtect/src/com/earth2me/essentials')
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java25
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java2
2 files changed, 20 insertions, 7 deletions
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
index fbbb321f3..89167b2b9 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
@@ -32,13 +32,13 @@ public class EssentialsProtectEntityListener extends EntityListener
return;
}
final Entity target = event.getEntity();
-
+
if (target instanceof Villager && prot.getSettingBool(ProtectConfig.prevent_villager_death))
{
event.setCancelled(true);
return;
}
-
+
final User user = ess.getUser(target);
if (event instanceof EntityDamageByBlockEvent)
{
@@ -197,12 +197,23 @@ public class EssentialsProtectEntityListener extends EntityListener
return;
}
final int maxHeight = ess.getSettings().getProtectCreeperMaxHeight();
- //Nicccccccccce plaaacccccccccce..
- if (event.getEntity() instanceof LivingEntity
- && (prot.getSettingBool(ProtectConfig.prevent_creeper_explosion)
- || prot.getSettingBool(ProtectConfig.prevent_creeper_blockdmg)
- || (maxHeight >= 0 && event.getLocation().getBlockY() > maxHeight)))
+
+ if (event.getEntity() instanceof EnderDragon
+ && prot.getSettingBool(ProtectConfig.prevent_enderdragon_blockdmg))
+ {
+ if (prot.getSettingBool(ProtectConfig.enderdragon_fakeexplosions))
+ {
+ FakeExplosion.createExplosion(event, ess.getServer(), ess.getServer().getOnlinePlayers());
+ }
+ event.setCancelled(true);
+ return;
+ }
+ else if (event.getEntity() instanceof Creeper
+ && (prot.getSettingBool(ProtectConfig.prevent_creeper_explosion)
+ || prot.getSettingBool(ProtectConfig.prevent_creeper_blockdmg)
+ || (maxHeight >= 0 && event.getLocation().getBlockY() > maxHeight)))
{
+ //Nicccccccccce plaaacccccccccce..
FakeExplosion.createExplosion(event, ess.getServer(), ess.getServer().getOnlinePlayers());
event.setCancelled(true);
return;
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java b/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java
index 817ad66af..bee8d0f4d 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java
@@ -41,11 +41,13 @@ public enum ProtectConfig
prevent_creeper_blockdmg("protect.prevent.creeper-blockdamage", false),
prevent_enderman_pickup("protect.prevent.enderman-pickup", false),
prevent_villager_death("protect.prevent.villager-death", false),
+ prevent_enderdragon_blockdmg("protect.prevent.enderdragon-blockdamage", true),
prevent_entitytarget("protect.prevent.entitytarget", false),
protect_rails("protect.protect.rails", true),
protect_below_rails("protect.protect.block-below", true),
protect_signs("protect.protect.signs", true),
protect_against_signs("protect.protect.block-below", true),
+ enderdragon_fakeexplosions("protect.enderdragon-fakeexplosions", false),
alert_on_placement("protect.alert.on-placement"),
alert_on_use("protect.alert.on-use"),
alert_on_break("protect.alert.on-break"),