Prevent /editsign on waxed signs (#5492)

This commit is contained in:
ThiagoROX 2023-08-28 18:04:15 -03:00 committed by GitHub
parent ee1111f6aa
commit 72ba87c509
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

View File

@ -119,6 +119,9 @@ public class Commandeditsign extends EssentialsCommand {
private boolean callSignEvent(final ModifiableSign sign, final Player player, final String[] lines) {
final SignChangeEvent event;
if (VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_20_1_R01)) {
if (sign.isWaxed() && !player.hasPermission("essentials.editsign.waxed.exempt")) {
return true;
}
event = new SignChangeEvent(sign.getBlock(), player, lines, sign.isFront() ? Side.FRONT : Side.BACK);
} else {
//noinspection deprecation
@ -199,6 +202,11 @@ public class Commandeditsign extends EssentialsCommand {
boolean isFront() {
return side == Side.FRONT;
}
@Override
boolean isWaxed() {
return sign.isWaxed();
}
};
}
return new ModifiableSign(sign) {
@ -221,6 +229,11 @@ public class Commandeditsign extends EssentialsCommand {
boolean isFront() {
return true;
}
@Override
boolean isWaxed() {
return false;
}
};
}
@ -239,6 +252,8 @@ public class Commandeditsign extends EssentialsCommand {
abstract boolean isFront();
abstract boolean isWaxed();
Block getBlock() {
return sign.getBlock();
}

View File

@ -714,6 +714,7 @@ permissions:
essentials.sudo.exempt: true
essentials.tempban.exempt: true
essentials.exempt.protect: true
essentials.editsign.waxed.exempt: true
essentials.nick.hideprefix:
default: false
description: Players with this permission will not have the nickname prefix applied to them