Use durability instead of itemdata for antibuild checks.

Fixes potion blocking using antibuild.
This commit is contained in:
KHobbits 2012-11-04 18:02:36 +00:00
parent 10244d5f90
commit 587f532991

View File

@ -51,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;
@ -219,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())
@ -251,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())
@ -272,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);
@ -289,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();