summaryrefslogtreecommitdiffstats
path: root/EssentialsProtect/src/com/earth2me/essentials
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-11-28 06:15:51 +0100
committersnowleo <schneeleo@gmail.com>2011-11-28 06:15:51 +0100
commit5ff17f0682c655bed27cffb80de28f8541536d73 (patch)
treea7f0e6a443cbade1975b80233c2a064197d9551c /EssentialsProtect/src/com/earth2me/essentials
parentd228d2f0a5c4d6c6fe6c203212923e90fd9b68a6 (diff)
downloadEssentials-5ff17f0682c655bed27cffb80de28f8541536d73.tar
Essentials-5ff17f0682c655bed27cffb80de28f8541536d73.tar.gz
Essentials-5ff17f0682c655bed27cffb80de28f8541536d73.tar.lz
Essentials-5ff17f0682c655bed27cffb80de28f8541536d73.tar.xz
Essentials-5ff17f0682c655bed27cffb80de28f8541536d73.zip
New option for EssProtect: Prevent villager death.
Diffstat (limited to 'EssentialsProtect/src/com/earth2me/essentials')
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java7
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java1
2 files changed, 8 insertions, 0 deletions
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
index 2c4d1dbab..cd054d732 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
@@ -32,6 +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)
{
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java b/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java
index 369e988ae..817ad66af 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java
@@ -40,6 +40,7 @@ public enum ProtectConfig
prevent_creeper_playerdmg("protect.prevent.creeper-playerdamage", false),
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_entitytarget("protect.prevent.entitytarget", false),
protect_rails("protect.protect.rails", true),
protect_below_rails("protect.protect.block-below", true),