Fixed sign edits being logged even if no changes were made

This commit is contained in:
Intelli 2023-07-14 15:27:30 -06:00
parent c6a0f20fff
commit e501046073
1 changed files with 19 additions and 9 deletions

View File

@ -27,6 +27,10 @@ public final class SignChangeListener extends Queue implements Listener {
Location location = block.getLocation();
BlockState blockState = block.getState();
String edit1 = event.getLine(0);
String edit2 = event.getLine(1);
String edit3 = event.getLine(2);
String edit4 = event.getLine(3);
String line1 = "";
String line2 = "";
String line3 = "";
@ -59,7 +63,13 @@ public final class SignChangeListener extends Queue implements Listener {
backGlowing = BukkitAdapter.ADAPTER.isGlowing(sign, false);
isWaxed = BukkitAdapter.ADAPTER.isWaxed(sign);
if (line1.length() > 0 || line2.length() > 0 || line3.length() > 0 || line4.length() > 0 || line5.length() > 0 || line6.length() > 0 || line7.length() > 0 || line8.length() > 0) {
if (isFront && line1.equals(edit1) && line2.equals(edit2) && line3.equals(edit3) && line4.equals(edit4)) {
return;
}
else if (!isFront && line5.equals(edit1) && line6.equals(edit2) && line7.equals(edit3) && line8.equals(edit4)) {
return;
}
else if (line1.length() > 0 || line2.length() > 0 || line3.length() > 0 || line4.length() > 0 || line5.length() > 0 || line6.length() > 0 || line7.length() > 0 || line8.length() > 0) {
existingText = true;
Queue.queueSignText(player, location, 0, color, colorSecondary, frontGlowing, backGlowing, isWaxed, isFront, line1, line2, line3, line4, line5, line6, line7, line8, 1);
Queue.queueBlockPlace(player, blockState, block.getType(), blockState, block.getType(), -1, 0, blockState.getBlockData().getAsString());
@ -67,16 +77,16 @@ public final class SignChangeListener extends Queue implements Listener {
}
if (isFront) {
line1 = event.getLine(0);
line2 = event.getLine(1);
line3 = event.getLine(2);
line4 = event.getLine(3);
line1 = edit1;
line2 = edit2;
line3 = edit3;
line4 = edit4;
}
else {
line5 = event.getLine(0);
line6 = event.getLine(1);
line7 = event.getLine(2);
line8 = event.getLine(3);
line5 = edit1;
line6 = edit2;
line7 = edit3;
line8 = edit4;
}
if (existingText || line1.length() > 0 || line2.length() > 0 || line3.length() > 0 || line4.length() > 0 || line5.length() > 0 || line6.length() > 0 || line7.length() > 0 || line8.length() > 0) {