Fixes the valid sign check not accounting for admin decryption prevention
All checks were successful
EpicKnarvik97/Books-Without-Borders/pipeline/head This commit looks good

This commit is contained in:
2026-01-08 12:50:11 +01:00
parent 51b77acb0c
commit 951a28d60c

View File

@@ -203,6 +203,8 @@ public class SignEventListener implements Listener {
if (encryptedBook != null) { if (encryptedBook != null) {
EncryptionUtil.markEncrypted(encryptedBook); EncryptionUtil.markEncrypted(encryptedBook);
player.getInventory().setItem(hand, encryptedBook); player.getInventory().setItem(hand, encryptedBook);
} else {
new FormatBuilder(Translatable.ERROR_DECRYPT_FAILED).error(player);
} }
} }
@@ -336,7 +338,10 @@ public class SignEventListener implements Listener {
return false; return false;
} }
boolean isValid = !getPassword(lines).isBlank() && (lines[3].isBlank() || boolean isValid = !getPassword(lines).isBlank() && (lines[3].isBlank() ||
EncryptionStyle.getFromString(getCleanLine(lines[3])) != null); ((lines[3].contains(" ") &&
EncryptionStyle.getFromString(getCleanLine(lines[3].split(" ")[0])) != null) ||
EncryptionStyle.getFromString(getCleanLine(lines[3])) != null));
if (markSign) { if (markSign) {
if (isValid) { if (isValid) {
markLine(lines, 2, PASSWORD_COLOR); markLine(lines, 2, PASSWORD_COLOR);