summaryrefslogtreecommitdiffstats
path: root/EssentialsProtect/src/com/earth2me/essentials
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-09-21 02:30:58 +0200
committersnowleo <schneeleo@gmail.com>2011-09-21 02:30:58 +0200
commita2950c74cb5731e32e7e7bbec97cf8292645f586 (patch)
tree92a0eeb70e537256cc0830781b31a823dd9ae69c /EssentialsProtect/src/com/earth2me/essentials
parent86aabb7a95fae8a0a8a77ba35d6df2ef0b3d8ec0 (diff)
downloadEssentials-a2950c74cb5731e32e7e7bbec97cf8292645f586.tar
Essentials-a2950c74cb5731e32e7e7bbec97cf8292645f586.tar.gz
Essentials-a2950c74cb5731e32e7e7bbec97cf8292645f586.tar.lz
Essentials-a2950c74cb5731e32e7e7bbec97cf8292645f586.tar.xz
Essentials-a2950c74cb5731e32e7e7bbec97cf8292645f586.zip
New config setting: protect.prevent.enderman-pickup
Defaults to false
Diffstat (limited to 'EssentialsProtect/src/com/earth2me/essentials')
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java1
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java13
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java1
3 files changed, 15 insertions, 0 deletions
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),