Move additional permission check
This commit is contained in:
parent
e86a0ccbae
commit
b420e44ff8
@ -63,7 +63,7 @@ public class EventListener implements Listener {
|
|||||||
plugin.unSitPlayer(player);
|
plugin.unSitPlayer(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
@ -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,15 +114,18 @@ 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();
|
||||||
} else if (block.getState().getData() instanceof Step) {
|
} else if (block.getState().getData() instanceof Step) {
|
||||||
|
Loading…
Reference in New Issue
Block a user