diff options
author | Chris Ward <chris@chrisgward.com> | 2013-01-11 21:54:52 +1100 |
---|---|---|
committer | Chris Ward <chris@chrisgward.com> | 2013-01-11 21:54:52 +1100 |
commit | f3812786d0c0eb416f62f1a58f9b4d317954bce3 (patch) | |
tree | 16c24d0b7ec13739b83c2651383f2034bd9ba34b /EssentialsAntiBuild/src/com | |
parent | 5c99eee0c0f7ced5ab4615b4edec66651156aaf7 (diff) | |
download | Essentials-f3812786d0c0eb416f62f1a58f9b4d317954bce3.tar Essentials-f3812786d0c0eb416f62f1a58f9b4d317954bce3.tar.gz Essentials-f3812786d0c0eb416f62f1a58f9b4d317954bce3.tar.lz Essentials-f3812786d0c0eb416f62f1a58f9b4d317954bce3.tar.xz Essentials-f3812786d0c0eb416f62f1a58f9b4d317954bce3.zip |
Fixes Item Frames being linked to Paintings when breaking
Diffstat (limited to 'EssentialsAntiBuild/src/com')
-rw-r--r-- | EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java index 76089505c..67995c955 100644 --- a/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java +++ b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java @@ -7,6 +7,7 @@ import java.util.logging.Level; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; import org.bukkit.entity.HumanEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -151,14 +152,26 @@ public class EssentialsAntiBuildListener implements Listener if (entity instanceof Player) { final User user = ess.getUser(entity); - if (prot.getSettingBool(AntiBuildConfig.disable_build) && !user.canBuild() && !user.isAuthorized("essentials.build") - && !metaPermCheck(user, "break", Material.PAINTING.getId())) + final EntityType type = event.getEntity().getType(); + final boolean warn = ess.getSettings().warnOnBuildDisallow(); + if (prot.getSettingBool(AntiBuildConfig.disable_build) && !user.canBuild() && !user.isAuthorized("essentials.build")) { - if (ess.getSettings().warnOnBuildDisallow()) + if (type == EntityType.PAINTING && !metaPermCheck(user, "break", Material.PAINTING.getId())) { - user.sendMessage(_("antiBuildBreak", Material.PAINTING.toString())); + if (warn) + { + user.sendMessage(_("antiBuildBreak", Material.PAINTING.toString())); + } + event.setCancelled(true); + } + else if(type == EntityType.ITEM_FRAME && !metaPermCheck(user, "break", Material.ITEM_FRAME.getId())) + { + if (warn) + { + user.sendMessage(_("antiBuildBreak", Material.ITEM_FRAME.toString())); + } + event.setCancelled(true); } - event.setCancelled(true); } } } |