The player that interacted with the sign
*/ private void registerPermissionSign(Sign sign, SignCreationRequest request, Player player) { - String[] lines = sign.getLines(); + SignSide frontSide = sign.getSide(Side.FRONT); + String[] lines = frontSide.getLines(); //Don't allow non-empty signs to be overwritten if (!Arrays.stream(lines).allMatch(String::isEmpty)) { return; @@ -209,8 +212,9 @@ public class SignListener implements Listener { //Display the permission sign information on the sign String[] signLines = permissionSign.getSignLines(); for (int i = 0; i < signLines.length; i++) { - sign.setLine(i, signLines[i]); + frontSide.setLine(i, signLines[i]); } + sign.setWaxed(true); sign.update(); player.sendMessage(StringFormatter.getTranslatedInfoMessage(TranslatableMessage.PERMISSION_SIGN_CREATED)); } diff --git a/src/main/java/net/knarcraft/permissionsigns/manager/SignManager.java b/src/main/java/net/knarcraft/permissionsigns/manager/SignManager.java index 67cd763..133af72 100644 --- a/src/main/java/net/knarcraft/permissionsigns/manager/SignManager.java +++ b/src/main/java/net/knarcraft/permissionsigns/manager/SignManager.java @@ -7,6 +7,8 @@ import org.bukkit.Location; import org.bukkit.block.Block; import org.bukkit.block.BlockState; import org.bukkit.block.Sign; +import org.bukkit.block.sign.Side; +import org.bukkit.block.sign.SignSide; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.file.YamlConfiguration; @@ -127,12 +129,14 @@ public final class SignManager { continue; } String[] newLines = permissionSign.getSignLines(); - if (Arrays.equals(sign.getLines(), newLines)) { + SignSide frontSide = sign.getSide(Side.FRONT); + if (Arrays.equals(frontSide.getLines(), newLines)) { continue; } for (int i = 0; i < 4; i++) { - sign.setLine(i, newLines[i]); + frontSide.setLine(i, newLines[i]); } + sign.setWaxed(true); sign.update(); } for (Location signLocation : invalidPermissionSigns) { diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 870d4f4..dac0968 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,7 +1,7 @@ name: PermissionSigns version: 1.0.4 main: net.knarcraft.permissionsigns.PermissionSigns -api-version: 1.18 +api-version: '1.20' prefix: PermissionSigns depend: [ Vault ] authors: [ EpicKnarvik97 ]