Dont send unnecessary sign update

This commit is contained in:
Nassim Jahnke
2021-09-11 11:56:51 +02:00
parent 2cb6b995cc
commit ccc1107255

View File

@@ -63,7 +63,7 @@
} catch (CommandSyntaxException commandsyntaxexception) { } catch (CommandSyntaxException commandsyntaxexception) {
; ;
} }
@@ -170,15 +176,16 @@ @@ -170,15 +176,17 @@
return text; return text;
} }
@@ -78,11 +78,12 @@
this.level.sendBlockUpdated(this.getBlockPos(), this.getBlockState(), this.getBlockState(), 3); this.level.sendBlockUpdated(this.getBlockPos(), this.getBlockState(), this.getBlockState(), 3);
} else { } else {
SignBlockEntity.LOGGER.warn("Player {} just tried to change non-editable sign", player.getName().getString()); SignBlockEntity.LOGGER.warn("Player {} just tried to change non-editable sign", player.getName().getString());
+ if (player.distanceToSqr(this.getBlockPos().getX(), this.getBlockPos().getY(), this.getBlockPos().getZ()) < 32 * 32) // Paper - Dont send far away sign update
+ ((ServerPlayer) player).connection.send(this.getUpdatePacket()); // CraftBukkit + ((ServerPlayer) player).connection.send(this.getUpdatePacket()); // CraftBukkit
} }
} }
@@ -188,19 +195,43 @@ @@ -188,19 +196,43 @@
return this.setText((SignText) textChanger.apply(signtext), front); return this.setText((SignText) textChanger.apply(signtext), front);
} }
@@ -134,7 +135,7 @@
} }
public boolean setText(SignText text, boolean front) { public boolean setText(SignText text, boolean front) {
@@ -227,11 +258,11 @@ @@ -227,11 +259,11 @@
} }
} }
@@ -148,7 +149,7 @@
boolean flag1 = false; boolean flag1 = false;
Component[] aichatbasecomponent = this.getText(front).getMessages(player.isTextFilteringEnabled()); Component[] aichatbasecomponent = this.getText(front).getMessages(player.isTextFilteringEnabled());
int i = aichatbasecomponent.length; int i = aichatbasecomponent.length;
@@ -242,7 +273,7 @@ @@ -242,7 +274,7 @@
ClickEvent chatclickable = chatmodifier.getClickEvent(); ClickEvent chatclickable = chatmodifier.getClickEvent();
if (chatclickable != null && chatclickable.getAction() == ClickEvent.Action.RUN_COMMAND) { if (chatclickable != null && chatclickable.getAction() == ClickEvent.Action.RUN_COMMAND) {
@@ -157,7 +158,7 @@
flag1 = true; flag1 = true;
} }
} }
@@ -250,11 +281,40 @@ @@ -250,11 +282,40 @@
return flag1; return flag1;
} }
@@ -200,7 +201,7 @@
} }
@Override @Override
@@ -273,12 +333,17 @@ @@ -273,12 +334,17 @@
@Nullable @Nullable
public UUID getPlayerWhoMayEdit() { public UUID getPlayerWhoMayEdit() {
@@ -219,7 +220,7 @@
} }
public boolean isWaxed() { public boolean isWaxed() {
@@ -296,7 +361,7 @@ @@ -296,7 +362,7 @@
} }
public boolean playerIsTooFarAwayToEdit(UUID uuid) { public boolean playerIsTooFarAwayToEdit(UUID uuid) {