Skip to content

Commit

Permalink
Prevent /editsign on waxed signs (EssentialsX#5492)
Browse files Browse the repository at this point in the history
  • Loading branch information
SrBedrock authored and HarvelsX committed Jun 2, 2024
1 parent 533bffd commit 2b2994f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ protected void run(final Server server, final User user, final String commandLab
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
Expand Down Expand Up @@ -199,6 +202,11 @@ void setLine(int line, String text) {
boolean isFront() {
return side == Side.FRONT;
}

@Override
boolean isWaxed() {
return sign.isWaxed();
}
};
}
return new ModifiableSign(sign) {
Expand All @@ -221,6 +229,11 @@ void setLine(int line, String text) {
boolean isFront() {
return true;
}

@Override
boolean isWaxed() {
return false;
}
};
}

Expand All @@ -239,6 +252,8 @@ protected ModifiableSign(final Sign sign) {

abstract boolean isFront();

abstract boolean isWaxed();

Block getBlock() {
return sign.getBlock();
}
Expand Down
1 change: 1 addition & 0 deletions Essentials/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,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

0 comments on commit 2b2994f

Please sign in to comment.