Move additional permission check

This commit is contained in:
Shevchik 2013-09-30 13:01:20 +04:00
parent e86a0ccbae
commit b420e44ff8

View File

@ -79,9 +79,9 @@ public class EventListener implements Listener {
Block block = event.getClickedBlock(); Block block = event.getClickedBlock();
if (sitAllowed(player, block)) if (sitAllowed(player, block))
{ {
event.setCancelled(true);
Location sitLocation = getSitLocation(block, player.getLocation().getYaw()); Location sitLocation = getSitLocation(block, player.getLocation().getYaw());
sitPlayer(player, sitLocation); sitPlayer(player, sitLocation);
event.setCancelled(true);
} }
} }
} }
@ -114,14 +114,17 @@ public class EventListener implements Listener {
continue; continue;
} }
} }
if (blockOkay || if (
( player.hasPermission("chairs.sit." + block.getTypeId() + ":" + block.getData()) ||
player.hasPermission("chairs.sit." + block.getTypeId() + ":" + block.getData()) || player.hasPermission("chairs.sit." + block.getType().toString() + ":" + block.getData()) ||
player.hasPermission("chairs.sit." + block.getType().toString() + ":" + block.getData()) || player.hasPermission("chairs.sit." + block.getTypeId()) ||
player.hasPermission("chairs.sit." + block.getTypeId()) || player.hasPermission("chairs.sit." + block.getType().toString())
player.hasPermission("chairs.sit." + block.getType().toString()) ) {
) blockOkay = true;
) { }
if (blockOkay) {
System.out.println("block is okay");
if (block.getState().getData() instanceof Stairs) { if (block.getState().getData() instanceof Stairs) {
stairs = (Stairs) block.getState().getData(); stairs = (Stairs) block.getState().getData();