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 | bbb48d8698204617e3cf782310645d6cd1617c46 (patch) | |
tree | e60190132b00a273dc898ebdd04973680cd7b8b7 /EssentialsAntiBuild/src/com/earth2me | |
parent | 8722bb84d92990f19e08a4f3e8f900cc6735f8ee (diff) | |
download | Essentials-bbb48d8698204617e3cf782310645d6cd1617c46.tar Essentials-bbb48d8698204617e3cf782310645d6cd1617c46.tar.gz Essentials-bbb48d8698204617e3cf782310645d6cd1617c46.tar.lz Essentials-bbb48d8698204617e3cf782310645d6cd1617c46.tar.xz Essentials-bbb48d8698204617e3cf782310645d6cd1617c46.zip |
Fixes Item Frames being linked to Paintings when breaking
Diffstat (limited to 'EssentialsAntiBuild/src/com/earth2me')
-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); } } } |