Prevents a permission error message when not trying to edit a sign
All checks were successful
KnarCraft/PlaceholderSigns/pipeline/head This commit looks good

This commit is contained in:
Kristian Knarvik 2024-04-23 14:42:53 +02:00
parent 598b6c9cb9
commit b33f514dca

View File

@ -59,15 +59,15 @@ public class SignClickListener implements Listener {
return; return;
} }
if (sign.isWaxed() && !player.hasPermission("placeholdersigns.edit.bypass-waxed")) {
PlaceholderSigns.getInstance().getStringFormatter().displayErrorMessage(player,
PlaceholderSignMessage.ERROR_WAXED_NO_PERMISSION);
return;
}
// Check if the player has run the /editSign command // Check if the player has run the /editSign command
SignLineChangeRequest request = requestHandler.getSignChangeRequest(player); SignLineChangeRequest request = requestHandler.getSignChangeRequest(player);
if (request != null) { if (request != null) {
if (sign.isWaxed() && !player.hasPermission("placeholdersigns.edit.bypass-waxed")) {
PlaceholderSigns.getInstance().getStringFormatter().displayErrorMessage(player,
PlaceholderSignMessage.ERROR_WAXED_NO_PERMISSION);
return;
}
SignSide standingOn = sign.getTargetSide(player); SignSide standingOn = sign.getTargetSide(player);
Side side = sign.getSide(Side.FRONT).equals(standingOn) ? Side.FRONT : Side.BACK; Side side = sign.getSide(Side.FRONT).equals(standingOn) ? Side.FRONT : Side.BACK;
doSignChange(sign, request, event, player, side); doSignChange(sign, request, event, player, side);
@ -90,7 +90,7 @@ public class SignClickListener implements Listener {
getSignText(front.getLines(), raw); getSignText(front.getLines(), raw);
String backLines = showPlaceholders ? getPlaceholderSignText(location, back, Side.BACK, raw) : String backLines = showPlaceholders ? getPlaceholderSignText(location, back, Side.BACK, raw) :
getSignText(back.getLines(), raw); getSignText(back.getLines(), raw);
StringFormatter stringFormatter = PlaceholderSigns.getInstance().getStringFormatter(); StringFormatter stringFormatter = PlaceholderSigns.getInstance().getStringFormatter();
StringReplacer replacer = new StringReplacer(stringFormatter.getUnformattedColoredMessage( StringReplacer replacer = new StringReplacer(stringFormatter.getUnformattedColoredMessage(
PlaceholderSignMessage.SUCCESS_SIGN_CONTENTS)); PlaceholderSignMessage.SUCCESS_SIGN_CONTENTS));