Makes sure to cancel placing events when a permission sign is interacted with

This commit is contained in:
Kristian Knarvik 2022-01-22 15:38:59 +01:00
parent e6672fc2e2
commit 0e8f2bd066
2 changed files with 9 additions and 3 deletions

View File

@ -50,7 +50,7 @@ public class SignListener implements Listener {
}
Sign sign = (Sign) block.getState();
handleSignClick(sign, player, event.getAction());
handleSignClick(sign, player, event.getAction(), event);
}
/**
@ -59,8 +59,9 @@ public class SignListener implements Listener {
* @param sign <p>The clicked sign</p>
* @param player <p>The player that clicked the sign</p>
* @param action <p>The hand the player used to interact with the sign</p>
* @param event <p>The player interact event which was triggered</p>
*/
private void handleSignClick(Sign sign, Player player, Action action) {
private void handleSignClick(Sign sign, Player player, Action action, PlayerInteractEvent event) {
//Check if the sign is a registered permission sign
PermissionSign permissionSign = SignManager.getSign(sign.getLocation());
if (permissionSign != null) {
@ -72,6 +73,7 @@ public class SignListener implements Listener {
return;
}
if (player.isSneaking()) {
event.setCancelled(true);
handlePermissionSignInteract(permissionSign, player);
} else {
player.sendMessage(getSignInfoText(permissionSign));

View File

@ -9,7 +9,11 @@ import java.nio.charset.StandardCharsets;
/**
* A helper class for dealing with files
*/
public class FileHelper {
public final class FileHelper {
private FileHelper() {
}
/**
* Gets a buffered reader for