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) {
;
}
@@ -170,15 +176,16 @@
@@ -170,15 +176,17 @@
return text;
}
@ -78,11 +78,12 @@
this.level.sendBlockUpdated(this.getBlockPos(), this.getBlockState(), this.getBlockState(), 3);
} else {
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
}
}
@@ -188,19 +195,43 @@
@@ -188,19 +196,43 @@
return this.setText((SignText) textChanger.apply(signtext), front);
}
@ -134,7 +135,7 @@
}
public boolean setText(SignText text, boolean front) {
@@ -227,11 +258,11 @@
@@ -227,11 +259,11 @@
}
}
@ -148,7 +149,7 @@
boolean flag1 = false;
Component[] aichatbasecomponent = this.getText(front).getMessages(player.isTextFilteringEnabled());
int i = aichatbasecomponent.length;
@@ -242,7 +273,7 @@
@@ -242,7 +274,7 @@
ClickEvent chatclickable = chatmodifier.getClickEvent();
if (chatclickable != null && chatclickable.getAction() == ClickEvent.Action.RUN_COMMAND) {
@ -157,7 +158,7 @@
flag1 = true;
}
}
@@ -250,11 +281,40 @@
@@ -250,11 +282,40 @@
return flag1;
}
@ -200,7 +201,7 @@
}
@Override
@@ -273,12 +333,17 @@
@@ -273,12 +334,17 @@
@Nullable
public UUID getPlayerWhoMayEdit() {
@ -219,7 +220,7 @@
}
public boolean isWaxed() {
@@ -296,7 +361,7 @@
@@ -296,7 +362,7 @@
}
public boolean playerIsTooFarAwayToEdit(UUID uuid) {