Catch desynced block breaks (#6193)

This commit is contained in:
Jake Potrebic
2021-07-15 16:00:58 -07:00
parent 83db66562f
commit 6602dc655e
2 changed files with 30 additions and 1 deletions

View File

@@ -209,6 +209,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return;
}
}
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
double blockDistanceSquared = this.player.distanceToSqr(blockposition.getX() + 0.5D, blockposition.getY() + 0.5D + 1.5D, blockposition.getZ() + 0.5D); // Copied from ServerPlayerGameMode#handleBlockBreakAction
if (blockDistanceSquared > 40 * 40) {
LOGGER.warn("{} tried to break a block {} square blocks away from their position", this.player.getScoreboardName(), blockDistanceSquared);
- this.disconnect("Invalid block break distance");
+ this.disconnect("Invalid block break distance", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION);
return;
}
if (this.player.level.getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) == null) {
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (packet.getAction() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) {