diff options
author | ementalo <ementalodev@gmx.co.uk> | 2013-02-25 22:43:05 +0000 |
---|---|---|
committer | ementalo <ementalodev@gmx.co.uk> | 2013-02-25 22:43:05 +0000 |
commit | 46b721c2a78d29ba576536f73327609361f21f2b (patch) | |
tree | 7731b956c727401222957618b2cc45c335040c12 /EssentialsProtect/src/net/ess3/protect | |
parent | b2ff27cde2273ac6b2682cea1d4dbaa601831cf6 (diff) | |
download | Essentials-46b721c2a78d29ba576536f73327609361f21f2b.tar Essentials-46b721c2a78d29ba576536f73327609361f21f2b.tar.gz Essentials-46b721c2a78d29ba576536f73327609361f21f2b.tar.lz Essentials-46b721c2a78d29ba576536f73327609361f21f2b.tar.xz Essentials-46b721c2a78d29ba576536f73327609361f21f2b.zip |
[Protect] Prevent creepers from breaking paintings if their explosions are disabled.
Diffstat (limited to 'EssentialsProtect/src/net/ess3/protect')
-rw-r--r-- | EssentialsProtect/src/net/ess3/protect/EssentialsProtectEntityListener.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/EssentialsProtect/src/net/ess3/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/net/ess3/protect/EssentialsProtectEntityListener.java index 0c7eb0654..a6a172685 100644 --- a/EssentialsProtect/src/net/ess3/protect/EssentialsProtectEntityListener.java +++ b/EssentialsProtect/src/net/ess3/protect/EssentialsProtectEntityListener.java @@ -7,6 +7,8 @@ import org.bukkit.event.Listener; import org.bukkit.event.entity.*; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityTargetEvent.TargetReason; +import org.bukkit.event.hanging.HangingBreakByEntityEvent; +import org.bukkit.event.hanging.HangingBreakEvent; //TODO: remove unnecessary return statements public class EssentialsProtectEntityListener implements Listener @@ -227,4 +229,17 @@ public class EssentialsProtectEntityListener implements Listener return; } } + + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled=true) + public void onPaintingBreak(final HangingBreakByEntityEvent event) + { + final ProtectHolder settings = prot.getSettings(); + if (event.getCause() == HangingBreakEvent.RemoveCause.ENTITY + && event.getRemover() instanceof Creeper + && settings.getData().getPrevent().isCreeperBlockdamage() ) + { + event.setCancelled(true); + return; + } + } } |