diff options
Diffstat (limited to 'EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java')
-rw-r--r-- | EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java index d2f46586f..7e5c60476 100644 --- a/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java +++ b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java @@ -36,6 +36,10 @@ public class EssentialsAntiBuildListener implements Listener { if (block == null) { + if (ess.getSettings().isDebug()) + { + ess.getLogger().log(Level.INFO, "AntiBuild permission check failed, invalid block."); + } return false; } return metaPermCheck(user, action, block.getTypeId(), block.getData()); @@ -47,7 +51,7 @@ public class EssentialsAntiBuildListener implements Listener return user.isAuthorized(blockPerm); } - private boolean metaPermCheck(final User user, final String action, final int blockId, final byte data) + private boolean metaPermCheck(final User user, final String action, final int blockId, final short data) { final String blockPerm = "essentials.build." + action + "." + blockId; final String dataPerm = blockPerm + ":" + data; @@ -215,7 +219,7 @@ public class EssentialsAntiBuildListener implements Listener if (prot.getSettingBool(AntiBuildConfig.disable_use) && !user.canBuild() && !user.isAuthorized("essentials.build")) { - if (event.hasItem() && !metaPermCheck(user, "interact", item.getTypeId(), item.getData().getData())) + if (event.hasItem() && !metaPermCheck(user, "interact", item.getTypeId(), item.getDurability())) { event.setCancelled(true); if (ess.getSettings().warnOnBuildDisallow()) @@ -247,7 +251,7 @@ public class EssentialsAntiBuildListener implements Listener if (prot.getSettingBool(AntiBuildConfig.disable_use) && !user.canBuild() && !user.isAuthorized("essentials.build")) { - if (!metaPermCheck(user, "craft", item.getTypeId(), item.getData().getData())) + if (!metaPermCheck(user, "craft", item.getTypeId(), item.getDurability())) { event.setCancelled(true); if (ess.getSettings().warnOnBuildDisallow()) @@ -268,7 +272,7 @@ public class EssentialsAntiBuildListener implements Listener if (prot.getSettingBool(AntiBuildConfig.disable_use) && !user.canBuild() && !user.isAuthorized("essentials.build")) { - if (!metaPermCheck(user, "pickup", item.getTypeId(), item.getData().getData())) + if (!metaPermCheck(user, "pickup", item.getTypeId(), item.getDurability())) { event.setCancelled(true); event.getItem().setPickupDelay(50); @@ -285,7 +289,7 @@ public class EssentialsAntiBuildListener implements Listener if (prot.getSettingBool(AntiBuildConfig.disable_use) && !user.canBuild() && !user.isAuthorized("essentials.build")) { - if (!metaPermCheck(user, "drop", item.getTypeId(), item.getData().getData())) + if (!metaPermCheck(user, "drop", item.getTypeId(), item.getDurability())) { event.setCancelled(true); user.updateInventory(); |