Adds a small check to prevent dual clicks when holding an item
This commit is contained in:
parent
dbd4593931
commit
42f82e2357
@ -19,6 +19,7 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@ -49,7 +50,9 @@ public class SignListener implements Listener {
|
||||
}
|
||||
|
||||
Sign sign = (Sign) block.getState();
|
||||
handleSignClick(sign, player, event.getAction(), event);
|
||||
if (event.getHand() == EquipmentSlot.HAND) {
|
||||
handleSignClick(sign, player, event.getAction(), event);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -64,6 +67,7 @@ public class SignListener implements Listener {
|
||||
//Check if the sign is a registered permission sign
|
||||
PermissionSign permissionSign = SignManager.getSign(sign.getLocation());
|
||||
if (permissionSign != null) {
|
||||
//Allow creative users to destroy the sign
|
||||
if (player.getGameMode() == GameMode.CREATIVE && action == Action.LEFT_CLICK_BLOCK) {
|
||||
return;
|
||||
}
|
||||
@ -72,6 +76,7 @@ public class SignListener implements Listener {
|
||||
return;
|
||||
}
|
||||
if (player.isSneaking()) {
|
||||
//Prevent placement of any blocks
|
||||
event.setCancelled(true);
|
||||
handlePermissionSignInteract(permissionSign, player);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user