From a0031d1d4511870fbeb16edc232f683492d0ad03 Mon Sep 17 00:00:00 2001 From: snowleo Date: Wed, 21 Sep 2011 02:30:58 +0200 Subject: New config setting: protect.prevent.enderman-pickup Defaults to false --- Essentials/src/config.yml | 1 + .../com/earth2me/essentials/protect/EssentialsProtect.java | 1 + .../essentials/protect/EssentialsProtectEntityListener.java | 13 +++++++++++++ .../src/com/earth2me/essentials/protect/ProtectConfig.java | 1 + 4 files changed, 16 insertions(+) diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index d2c12be0e..6edf0244d 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -401,6 +401,7 @@ protect: creeper-explosion: false creeper-playerdamage: false creeper-blockdamage: false + enderman-pickup: false # Monsters won't follow players # permission essentials.protect.entitytarget.bypass disables this entitytarget: false diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java index fa1fadad6..98daf26cb 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java @@ -70,6 +70,7 @@ public class EssentialsProtect extends JavaPlugin implements IConf, IProtect pm.registerEvent(Type.CREATURE_SPAWN, entityListener, Priority.Highest, this); pm.registerEvent(Type.ENTITY_TARGET, entityListener, Priority.Highest, this); pm.registerEvent(Type.EXPLOSION_PRIME, entityListener, Priority.Highest, this); + pm.registerEvent(Type.ENDERMAN_PICKUP, entityListener, Priority.Highest, this); final EssentialsProtectWeatherListener weatherListener = new EssentialsProtectWeatherListener(this); pm.registerEvent(Type.LIGHTNING_STRIKE, weatherListener, Priority.Highest, this); diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java index f28fd1185..c0e568578 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java @@ -22,6 +22,7 @@ import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; import org.bukkit.entity.TNTPrimed; import org.bukkit.event.entity.CreatureSpawnEvent; +import org.bukkit.event.entity.EndermanPickupEvent; import org.bukkit.event.entity.EntityDamageByBlockEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageEvent; @@ -352,4 +353,16 @@ public class EssentialsProtectEntityListener extends EntityListener event.setFire(false); } } + + @Override + public void onEndermanPickup(EndermanPickupEvent event) + { + if (event.isCancelled()) { + return; + } + if (prot.getSettingBool(ProtectConfig.prevent_enderman_pickup)) { + 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 9959db8c6..5d93fe0ea 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java @@ -39,6 +39,7 @@ public enum ProtectConfig prevent_creeper_explosion("protect.prevent.creeper-explosion", true), 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_entitytarget("protect.prevent.entitytarget", false), protect_rails("protect.protect.rails", true), protect_below_rails("protect.protect.block-below", true), -- cgit v1.2.3