Catch desynced block breaks (#6193)

This commit is contained in:
Jake Potrebic 2021-07-15 16:00:58 -07:00 committed by GitHub
parent 2e3797945c
commit b41b5b5c7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 92 additions and 63 deletions

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Don't allow digging into unloaded chunks
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index 315dad4789f5f2582ee9b4fc176affd1f57537ef..f4a056185990181e486f452960159a5287947382 100644 index 315dad4789f5f2582ee9b4fc176affd1f57537ef..482eebf61944add9f1ad6abea6124a9f3191628e 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -119,8 +119,8 @@ public class ServerPlayerGameMode { @@ -119,8 +119,8 @@ public class ServerPlayerGameMode {
@ -34,7 +34,19 @@ index 315dad4789f5f2582ee9b4fc176affd1f57537ef..f4a056185990181e486f452960159a52
if (iblockdata.isAir()) { if (iblockdata.isAir()) {
this.level.destroyBlockProgress(this.player.getId(), this.destroyPos, -1); this.level.destroyBlockProgress(this.player.getId(), this.destroyPos, -1);
this.lastSentState = -1; this.lastSentState = -1;
@@ -295,10 +301,12 @@ public class ServerPlayerGameMode { @@ -161,6 +167,11 @@ public class ServerPlayerGameMode {
double d1 = this.player.getY() - ((double) pos.getY() + 0.5D) + 1.5D;
double d2 = this.player.getZ() - ((double) pos.getZ() + 0.5D);
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
+ // Paper start
+ this.handleBlockBreakAction(pos, action, direction, worldHeight, d3);
+ }
+ public void handleBlockBreakAction(BlockPos pos, ServerboundPlayerActionPacket.Action action, Direction direction, int worldHeight, double d3) {
+ // Paper end
if (d3 > 36.0D) {
this.player.connection.send(new ClientboundBlockBreakAckPacket(pos, this.level.getBlockState(pos), action, false, "too far"));
@@ -295,10 +306,12 @@ public class ServerPlayerGameMode {
this.player.connection.send(new ClientboundBlockBreakAckPacket(pos, this.level.getBlockState(pos), action, true, "stopped destroying")); this.player.connection.send(new ClientboundBlockBreakAckPacket(pos, this.level.getBlockState(pos), action, true, "stopped destroying"));
} else if (action == ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK) { } else if (action == ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK) {
this.isDestroyingBlock = false; this.isDestroyingBlock = false;
@ -51,18 +63,26 @@ index 315dad4789f5f2582ee9b4fc176affd1f57537ef..f4a056185990181e486f452960159a52
this.level.destroyBlockProgress(this.player.getId(), pos, -1); this.level.destroyBlockProgress(this.player.getId(), pos, -1);
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 38a48add445e8dd6888bc5bb22e7bf5482682536..12f722ad55abff59d133f91da804f7cfa09dbdb6 100644 index 38a48add445e8dd6888bc5bb22e7bf5482682536..e8d23504c02225713a01c4b34530b053685de63e 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1544,6 +1544,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1544,7 +1544,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
case START_DESTROY_BLOCK: case START_DESTROY_BLOCK:
case ABORT_DESTROY_BLOCK: case ABORT_DESTROY_BLOCK:
case STOP_DESTROY_BLOCK: case STOP_DESTROY_BLOCK:
- this.player.gameMode.handleBlockBreakAction(blockposition, packetplayinblockdig_enumplayerdigtype, packet.getDirection(), this.player.level.getMaxBuildHeight());
+ // Paper start - Don't allow digging in unloaded chunks + // Paper start - Don't allow digging in unloaded chunks
+ 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");
+ return;
+ }
+ if (this.player.level.getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) == null) { + if (this.player.level.getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) == null) {
+ return; + return;
+ } + }
+ this.player.gameMode.handleBlockBreakAction(blockposition, packetplayinblockdig_enumplayerdigtype, packet.getDirection(), this.player.level.getMaxBuildHeight(), blockDistanceSquared);
+ // Paper end - Don't allow digging in unloaded chunks + // Paper end - Don't allow digging in unloaded chunks
this.player.gameMode.handleBlockBreakAction(blockposition, packetplayinblockdig_enumplayerdigtype, packet.getDirection(), this.player.level.getMaxBuildHeight());
return; return;
default: default:
throw new IllegalArgumentException("Invalid player action");

View File

@ -22,7 +22,7 @@ it only impacts data sent from the client.
Set -DPaper.maxSignLength=XX to change limit or -1 to disable Set -DPaper.maxSignLength=XX to change limit or -1 to disable
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 9e85045638d3496c80a215d2b589033ed5169981..fee09331f7a65ca11827bff68bf19fbffdbaf67c 100644 index d016b1dc976d982320b1c08452dad8a1fccbed18..1bec16d210c1edc9e7d7547ad719e9a759e910d4 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -254,6 +254,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -254,6 +254,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@ -33,7 +33,7 @@ index 9e85045638d3496c80a215d2b589033ed5169981..fee09331f7a65ca11827bff68bf19fbf
private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) { public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) {
@@ -2847,10 +2848,20 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2853,10 +2854,20 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
List<net.kyori.adventure.text.Component> lines = new java.util.ArrayList<>(); List<net.kyori.adventure.text.Component> lines = new java.util.ArrayList<>();
for (int i = 0; i < list.size(); ++i) { for (int i = 0; i < list.size(); ++i) {

View File

@ -22,10 +22,10 @@ index f835ef1c7109f56f32da394c9afc9fd35b05b51a..58cae4202e61cded7d5dfa9652bbfb97
this.broadcast.accept(packet); this.broadcast.accept(packet);
if (this.entity instanceof ServerPlayer) { if (this.entity instanceof ServerPlayer) {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index fee09331f7a65ca11827bff68bf19fbffdbaf67c..921dbdec095b0e527865de86992a5867d3e288e6 100644 index 1bec16d210c1edc9e7d7547ad719e9a759e910d4..7b89b075de9181f6eac00141518e7702f88c2ae2 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2268,7 +2268,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2274,7 +2274,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem) { if (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem) {
// Refresh the current entity metadata // Refresh the current entity metadata

View File

@ -7,10 +7,10 @@ Fixes an AssertionError when setting the player's item in hand to null or a new
Fixes GH-2718 Fixes GH-2718
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index f83d2afc876031f479011a64884e53a6591999f2..4d3d6a7bb4be76004539fd33c06a421b7052f4f5 100644 index 31b61bcc7e899f77787c23db74a5641e58591aa9..e21d52e700cdc67547c2b116a4c8bb6bb6a1e650 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1720,6 +1720,10 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1726,6 +1726,10 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.player.getBukkitEntity().updateInventory(); // SPIGOT-2524 this.player.getBukkitEntity().updateInventory(); // SPIGOT-2524
return; return;
} }

View File

@ -1117,7 +1117,7 @@ index 60de95d72ca4e4b2e12a2b3363c59a08b75d0aae..fac80bdbf0fa68cd8e63130a6a9de3b6
this.convertable = convertable_conversionsession; this.convertable = convertable_conversionsession;
this.uuid = WorldUUID.getUUID(convertable_conversionsession.levelPath.toFile()); this.uuid = WorldUUID.getUUID(convertable_conversionsession.levelPath.toFile());
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index f4a056185990181e486f452960159a5287947382..b932580dc10703c8a7dbecd4cf38954872f1cab6 100644 index 482eebf61944add9f1ad6abea6124a9f3191628e..6007d9ac5b95b26e59c358710214708d521761e6 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -49,7 +49,7 @@ import org.bukkit.event.player.PlayerInteractEvent; @@ -49,7 +49,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
@ -1129,7 +1129,7 @@ index f4a056185990181e486f452960159a5287947382..b932580dc10703c8a7dbecd4cf389548
protected final ServerPlayer player; protected final ServerPlayer player;
private GameType gameModeForPlayer; private GameType gameModeForPlayer;
@Nullable @Nullable
@@ -314,6 +314,8 @@ public class ServerPlayerGameMode { @@ -319,6 +319,8 @@ public class ServerPlayerGameMode {
} }
} }

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add and implement PlayerRecipeBookClickEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index cfdf6e6e4ef5921bfcbb8a010ea42f0c182b344c..18392c098fb24ba0be7856dbd5ef946b41fab2cf 100644 index 61993c40a854f73ee3c3b8fb5e51c63cce21358c..b2e609f9e525ffe0ca5dd7112fb13f3473aeb3c0 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2763,9 +2763,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2769,9 +2769,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
this.player.resetLastActionTime(); this.player.resetLastActionTime();
if (!this.player.isSpectator() && this.player.containerMenu.containerId == packet.getContainerId() && this.player.containerMenu instanceof RecipeBookMenu) { if (!this.player.isSpectator() && this.player.containerMenu.containerId == packet.getContainerId() && this.player.containerMenu instanceof RecipeBookMenu) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add permission for command blocks
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index b932580dc10703c8a7dbecd4cf38954872f1cab6..51d7c59e6b3f4ca84905b186d9b173ec2c36a0b1 100644 index 6007d9ac5b95b26e59c358710214708d521761e6..e03ce8f89fcbfe6414877c0d1446865ee6474e38 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -391,7 +391,7 @@ public class ServerPlayerGameMode { @@ -396,7 +396,7 @@ public class ServerPlayerGameMode {
BlockEntity tileentity = this.level.getBlockEntity(pos); BlockEntity tileentity = this.level.getBlockEntity(pos);
Block block = iblockdata.getBlock(); Block block = iblockdata.getBlock();
@ -18,7 +18,7 @@ index b932580dc10703c8a7dbecd4cf38954872f1cab6..51d7c59e6b3f4ca84905b186d9b173ec
return false; return false;
} else if (this.player.blockActionRestricted((Level) this.level, pos, this.gameModeForPlayer)) { } else if (this.player.blockActionRestricted((Level) this.level, pos, this.gameModeForPlayer)) {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 15762cb1a627b4b23353a8e9c65465a9c44faaa0..f6f243552a73d17a5ac26a945822935a2562ba2e 100644 index 282d5d8db0cc15a7b81a08c721fb38777e0be89a..5d9446190e7a4062c91a2f6504224e2142de4181 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -787,7 +787,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -787,7 +787,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser

View File

@ -63,10 +63,10 @@ index a335d48467d1730bfed25eb5fd9046e115f23ed0..0a930147663850dc2ea7ffe9ced5611d
@Override @Override
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 32f61e884f191060da91ede87aba395441171446..d182b6ef4431c5ca291619bc8920a18cccad6327 100644 index aa237c12187e3ab852d495008d969c20f4166b64..9637ed4ead0a88be09c809a874281f75496ee75d 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3021,7 +3021,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -3027,7 +3027,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
public void handleChangeDifficulty(ServerboundChangeDifficultyPacket packet) { public void handleChangeDifficulty(ServerboundChangeDifficultyPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (this.player.hasPermissions(2) || this.isSingleplayerOwner()) { if (this.player.hasPermissions(2) || this.isSingleplayerOwner()) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Move range check for block placing up
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index aec4d7987ed168bc6a70c178d44b8d0d1822b845..2ebb62c1326e988d28d4fd608f3ee009a975397f 100644 index fbfe38f6fac250216e2029ce0ce0be85d83e59e1..75c7f93fdca73f84d38ba5ba30a4959b7fede0de 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1673,17 +1673,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1679,17 +1679,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
BlockPos blockposition = movingobjectpositionblock.getBlockPos(); BlockPos blockposition = movingobjectpositionblock.getBlockPos();
Direction enumdirection = movingobjectpositionblock.getDirection(); Direction enumdirection = movingobjectpositionblock.getDirection();

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Brand support
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 2ebb62c1326e988d28d4fd608f3ee009a975397f..00ce5bfdae67befdb72b01c152ab403fe60ab663 100644 index 75c7f93fdca73f84d38ba5ba30a4959b7fede0de..013a049dca56af91a2a2195933703bb97bfd3198 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -4,6 +4,7 @@ import com.google.common.collect.Lists; @@ -4,6 +4,7 @@ import com.google.common.collect.Lists;
@ -33,7 +33,7 @@ index 2ebb62c1326e988d28d4fd608f3ee009a975397f..00ce5bfdae67befdb72b01c152ab403f
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) { public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) {
this.server = server; this.server = server;
this.connection = connection; this.connection = connection;
@@ -2981,6 +2985,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2987,6 +2991,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
private static final ResourceLocation CUSTOM_REGISTER = new ResourceLocation("register"); private static final ResourceLocation CUSTOM_REGISTER = new ResourceLocation("register");
private static final ResourceLocation CUSTOM_UNREGISTER = new ResourceLocation("unregister"); private static final ResourceLocation CUSTOM_UNREGISTER = new ResourceLocation("unregister");
@ -42,7 +42,7 @@ index 2ebb62c1326e988d28d4fd608f3ee009a975397f..00ce5bfdae67befdb72b01c152ab403f
@Override @Override
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) { public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
@@ -3008,6 +3014,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -3014,6 +3020,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
try { try {
byte[] data = new byte[packet.data.readableBytes()]; byte[] data = new byte[packet.data.readableBytes()];
packet.data.readBytes(data); packet.data.readBytes(data);
@ -58,7 +58,7 @@ index 2ebb62c1326e988d28d4fd608f3ee009a975397f..00ce5bfdae67befdb72b01c152ab403f
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data); this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data);
} catch (Exception ex) { } catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex); ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
@@ -3017,6 +3032,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -3023,6 +3038,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
} }

View File

@ -24,7 +24,7 @@ index 3fc9847d26395a19abc5a16150ff8816a1b95dc8..c818a34e17718f0d60979aa24c7385ba
return false; return false;
} }
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index 51d7c59e6b3f4ca84905b186d9b173ec2c36a0b1..55d0b15a7ea1576af8045e84fe47eff696bb369f 100644 index e03ce8f89fcbfe6414877c0d1446865ee6474e38..ab1ac92ddd3810821e996426850c0cd11740fc2a 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -7,6 +7,7 @@ import net.minecraft.world.InteractionResult; @@ -7,6 +7,7 @@ import net.minecraft.world.InteractionResult;
@ -35,7 +35,7 @@ index 51d7c59e6b3f4ca84905b186d9b173ec2c36a0b1..55d0b15a7ea1576af8045e84fe47eff6
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.DoubleHighBlockItem; import net.minecraft.world.item.DoubleHighBlockItem;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
@@ -423,10 +424,12 @@ public class ServerPlayerGameMode { @@ -428,10 +429,12 @@ public class ServerPlayerGameMode {
// return true; // CraftBukkit // return true; // CraftBukkit
} }
// CraftBukkit start // CraftBukkit start

View File

@ -23,7 +23,7 @@ index 3e486376a49a61d52cdcd32ea877996d81186a73..e62bb33852b0dca346aeb3cb2747d1a5
public static boolean velocityOnlineMode; public static boolean velocityOnlineMode;
public static byte[] velocitySecretKey; public static byte[] velocitySecretKey;
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 6dccd2288e2fbce173fa60529ee161725e0f983c..11cc3a6f04371b9217c201fd5d583213c2fbe57d 100644 index f1dde77239f71d4c7300bd48512defea2886aeef..3f25e634cbe52f9ab208c02e7aa4d09bcaa27777 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -231,6 +231,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -231,6 +231,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@ -42,7 +42,7 @@ index 6dccd2288e2fbce173fa60529ee161725e0f983c..11cc3a6f04371b9217c201fd5d583213
/* Use thread-safe field access instead /* Use thread-safe field access instead
if (this.chatSpamTickCount > 0) { if (this.chatSpamTickCount > 0) {
--this.chatSpamTickCount; --this.chatSpamTickCount;
@@ -2780,6 +2782,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2786,6 +2788,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@Override @Override
public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) { public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) {

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Fix interact event not being called in adventure
Call PlayerInteractEvent when left-clicking on a block in adventure mode Call PlayerInteractEvent when left-clicking on a block in adventure mode
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 11cc3a6f04371b9217c201fd5d583213c2fbe57d..7318dc5e3ed94a00b675912e2c73c53aee9e93d4 100644 index 3f25e634cbe52f9ab208c02e7aa4d09bcaa27777..2437565e754414366ed76fa16c5a5f146647cb63 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1713,7 +1713,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1719,7 +1719,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
MutableComponent ichatmutablecomponent = (new TranslatableComponent("build.tooHigh", new Object[]{i - 1})).withStyle(ChatFormatting.RED); MutableComponent ichatmutablecomponent = (new TranslatableComponent("build.tooHigh", new Object[]{i - 1})).withStyle(ChatFormatting.RED);
this.player.sendMessage((Component) ichatmutablecomponent, ChatType.GAME_INFO, Util.NIL_UUID); this.player.sendMessage((Component) ichatmutablecomponent, ChatType.GAME_INFO, Util.NIL_UUID);
@ -18,7 +18,7 @@ index 11cc3a6f04371b9217c201fd5d583213c2fbe57d..7318dc5e3ed94a00b675912e2c73c53a
this.player.swing(enumhand, true); this.player.swing(enumhand, true);
} }
} }
@@ -2185,7 +2185,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2191,7 +2191,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
Vec3 vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3); Vec3 vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
HitResult movingobjectposition = this.player.level.clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, this.player)); HitResult movingobjectposition = this.player.level.clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, this.player));

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Implement API to expose exact interaction point
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index c3cdc5a7ae90b7d2dd5676d66086e1f0c5b23d0d..b096384cdc7596166e010e06272534b8001693c9 100644 index ab1ac92ddd3810821e996426850c0cd11740fc2a..78852ebbc57ead857f051edf49345466e250337d 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -500,7 +500,7 @@ public class ServerPlayerGameMode { @@ -505,7 +505,7 @@ public class ServerPlayerGameMode {
cancelledBlock = true; cancelledBlock = true;
} }
@ -18,7 +18,7 @@ index c3cdc5a7ae90b7d2dd5676d66086e1f0c5b23d0d..b096384cdc7596166e010e06272534b8
this.interactResult = event.useItemInHand() == Event.Result.DENY; this.interactResult = event.useItemInHand() == Event.Result.DENY;
this.interactPosition = blockposition.immutable(); this.interactPosition = blockposition.immutable();
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 9069fdc604cf3ba23dec46479c87b1311dec39e6..7823477b8fc18901014ba397f711de50cb9880f3 100644 index 03250ab358f46095c4fbe969d6d678d7e79b4a96..a2c8deb54e9a8448f2473b58a01329b44f6a3d8f 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -55,7 +55,9 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams; @@ -55,7 +55,9 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams;

View File

@ -20,10 +20,10 @@ index 20eb4aea24cc6699747b18b2c00e5b01dafb47c6..acd61a9033fdfb91e29a5fa6a10b8983
} }
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 7318dc5e3ed94a00b675912e2c73c53aee9e93d4..b77cd074a287d9db21819d950b1f158b8efcfd05 100644 index 2437565e754414366ed76fa16c5a5f146647cb63..1daeaddfb46b1e35c6ce1355c8c9ef2d45917fad 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1702,7 +1702,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1708,7 +1708,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
int i = this.player.level.getMaxBuildHeight(); int i = this.player.level.getMaxBuildHeight();
if (blockposition.getY() < i) { if (blockposition.getY() < i) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] fix PlayerItemHeldEvent firing twice
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 9038d3c5683588fc6b2e1ef6dacc3e889eeb05f0..d11282c6c39a90dfb4c773aced4b4f0ada33c5fb 100644 index d416f404c3a04627beb19909f1641f5673f2b110..664ae55e11910e5acc8b9ab0444d2377ab17dd53 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1906,6 +1906,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1912,6 +1912,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (this.player.isImmobile()) return; // CraftBukkit if (this.player.isImmobile()) return; // CraftBukkit
if (packet.getSlot() >= 0 && packet.getSlot() < Inventory.getSelectionSize()) { if (packet.getSlot() >= 0 && packet.getSlot() < Inventory.getSelectionSize()) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] add RespawnFlags to PlayerRespawnEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index d11282c6c39a90dfb4c773aced4b4f0ada33c5fb..351c293d794d77750740df2e64129786f47cd0fa 100644 index 664ae55e11910e5acc8b9ab0444d2377ab17dd53..9ffa79d11edc0baed397ade1fc77a336df34a252 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2440,7 +2440,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2446,7 +2446,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
case PERFORM_RESPAWN: case PERFORM_RESPAWN:
if (this.player.wonGame) { if (this.player.wonGame) {
this.player.wonGame = false; this.player.wonGame = false;

View File

@ -91,7 +91,7 @@ index 91a03f4ed215c882d2ae930402220e4cbbf1ea00..8e2bccc3a9ddb17a4978596056189eb7
} }
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index ddacf7ca035d4d0802572ce806e21b484c366550..b842de825c106d36512c17449ae6bda18f0ef5ba 100644 index 78852ebbc57ead857f051edf49345466e250337d..c607cbae6306bea4eaf9c7abc55c59e92e3304c8 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -74,18 +74,24 @@ public class ServerPlayerGameMode { @@ -74,18 +74,24 @@ public class ServerPlayerGameMode {
@ -124,10 +124,10 @@ index ddacf7ca035d4d0802572ce806e21b484c366550..b842de825c106d36512c17449ae6bda1
} }
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 351c293d794d77750740df2e64129786f47cd0fa..32538258b8af2a239f9ab6d6ab4eac7a1f517653 100644 index 9ffa79d11edc0baed397ade1fc77a336df34a252..083ae2f6356c08c5b4242f8e29d7741eb7f7ed9a 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2449,7 +2449,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2455,7 +2455,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.player = this.server.getPlayerList().respawn(this.player, false); this.player = this.server.getPlayerList().respawn(this.player, false);
if (this.server.isHardcore()) { if (this.server.isHardcore()) {

View File

@ -57,7 +57,7 @@ index 708ac03d5a849bf09c49547306e4a8c5a5ef8d91..5a8df368a4a25839cd4ac9be6972da2e
} }
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 32538258b8af2a239f9ab6d6ab4eac7a1f517653..784fc77a5b98f1e085edc4aea3c6bed524b1fb0e 100644 index 083ae2f6356c08c5b4242f8e29d7741eb7f7ed9a..6c8e36c8bf60522c499fbd2d7175afe05e4eb359 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -320,7 +320,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -320,7 +320,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@ -209,7 +209,16 @@ index 32538258b8af2a239f9ab6d6ab4eac7a1f517653..784fc77a5b98f1e085edc4aea3c6bed5
return; return;
} }
} }
@@ -1818,7 +1826,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1645,7 +1653,7 @@ 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) {
@@ -1824,7 +1832,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (packet.getAction() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) { if (packet.getAction() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) {
ServerGamePacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getName()); ServerGamePacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getName());
@ -218,7 +227,7 @@ index 32538258b8af2a239f9ab6d6ab4eac7a1f517653..784fc77a5b98f1e085edc4aea3c6bed5
} }
// Paper start // Paper start
PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packet.action.ordinal()]; PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packet.action.ordinal()];
@@ -1923,7 +1931,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1929,7 +1937,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.player.resetLastActionTime(); this.player.resetLastActionTime();
} else { } else {
ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString()); ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
@ -227,7 +236,7 @@ index 32538258b8af2a239f9ab6d6ab4eac7a1f517653..784fc77a5b98f1e085edc4aea3c6bed5
} }
} }
@@ -1939,7 +1947,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1945,7 +1953,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
for (int i = 0; i < s.length(); ++i) { for (int i = 0; i < s.length(); ++i) {
if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) { if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {
@ -236,7 +245,7 @@ index 32538258b8af2a239f9ab6d6ab4eac7a1f517653..784fc77a5b98f1e085edc4aea3c6bed5
return; return;
} }
} }
@@ -2012,7 +2020,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2018,7 +2026,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
Waitable waitable = new Waitable() { Waitable waitable = new Waitable() {
@Override @Override
protected Object evaluate() { protected Object evaluate() {
@ -245,7 +254,7 @@ index 32538258b8af2a239f9ab6d6ab4eac7a1f517653..784fc77a5b98f1e085edc4aea3c6bed5
return null; return null;
} }
}; };
@@ -2027,7 +2035,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2033,7 +2041,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} else { } else {
@ -254,7 +263,7 @@ index 32538258b8af2a239f9ab6d6ab4eac7a1f517653..784fc77a5b98f1e085edc4aea3c6bed5
} }
// CraftBukkit end // CraftBukkit end
} }
@@ -2300,7 +2308,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2306,7 +2314,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// Spigot Start // Spigot Start
if ( entity == this.player && !this.player.isSpectator() ) if ( entity == this.player && !this.player.isSpectator() )
{ {
@ -263,7 +272,7 @@ index 32538258b8af2a239f9ab6d6ab4eac7a1f517653..784fc77a5b98f1e085edc4aea3c6bed5
return; return;
} }
// Spigot End // Spigot End
@@ -2391,7 +2399,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2397,7 +2405,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
} }
// CraftBukkit end // CraftBukkit end
} else { } else {
@ -272,7 +281,7 @@ index 32538258b8af2a239f9ab6d6ab4eac7a1f517653..784fc77a5b98f1e085edc4aea3c6bed5
ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString()); ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString());
} }
} }
@@ -2791,7 +2799,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2797,7 +2805,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// Paper start // Paper start
if (!org.bukkit.Bukkit.isPrimaryThread()) { if (!org.bukkit.Bukkit.isPrimaryThread()) {
if (recipeSpamPackets.addAndGet(com.destroystokyo.paper.PaperConfig.autoRecipeIncrement) > com.destroystokyo.paper.PaperConfig.autoRecipeLimit) { if (recipeSpamPackets.addAndGet(com.destroystokyo.paper.PaperConfig.autoRecipeIncrement) > com.destroystokyo.paper.PaperConfig.autoRecipeLimit) {
@ -281,7 +290,7 @@ index 32538258b8af2a239f9ab6d6ab4eac7a1f517653..784fc77a5b98f1e085edc4aea3c6bed5
return; return;
} }
} }
@@ -2979,7 +2987,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2985,7 +2993,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
} else if (!this.isSingleplayerOwner()) { } else if (!this.isSingleplayerOwner()) {
// Paper start - This needs to be handled on the main thread for plugins // Paper start - This needs to be handled on the main thread for plugins
server.submit(() -> { server.submit(() -> {
@ -290,7 +299,7 @@ index 32538258b8af2a239f9ab6d6ab4eac7a1f517653..784fc77a5b98f1e085edc4aea3c6bed5
}); });
// Paper end // Paper end
} }
@@ -3025,7 +3033,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -3031,7 +3039,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
} }
} catch (Exception ex) { } catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex); ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex);
@ -299,7 +308,7 @@ index 32538258b8af2a239f9ab6d6ab4eac7a1f517653..784fc77a5b98f1e085edc4aea3c6bed5
} }
} else if (packet.identifier.equals(CUSTOM_UNREGISTER)) { } else if (packet.identifier.equals(CUSTOM_UNREGISTER)) {
try { try {
@@ -3035,7 +3043,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -3041,7 +3049,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
} }
} catch (Exception ex) { } catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex); ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex);
@ -308,7 +317,7 @@ index 32538258b8af2a239f9ab6d6ab4eac7a1f517653..784fc77a5b98f1e085edc4aea3c6bed5
} }
} else { } else {
try { try {
@@ -3053,7 +3061,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -3059,7 +3067,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data); this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data);
} catch (Exception ex) { } catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex); ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Adds PlayerArmSwingEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 6ff04fc7202a7eb1f2b5978a2e2a573945d9dde1..1befdf30aef80dd12f005df3a6b667162bbcc3c1 100644 index 4bd49df9e6ff108a8ae95f9924d1a701e22eea49..87388f6339d740544414c9c33237013bd26155b8 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2204,7 +2204,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2210,7 +2210,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
} }
// Arm swing animation // Arm swing animation

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Fixes kick event leave message not being sent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 6ff04fc7202a7eb1f2b5978a2e2a573945d9dde1..c42aca2c8e0631e4091fac6652c4f1e5968a7b63 100644 index 87388f6339d740544414c9c33237013bd26155b8..fa01e45afcc7f888e78ef95a5a4dbca373083ad0 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -457,7 +457,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -457,7 +457,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@ -17,7 +17,7 @@ index 6ff04fc7202a7eb1f2b5978a2e2a573945d9dde1..c42aca2c8e0631e4091fac6652c4f1e5
this.connection.setReadOnly(); this.connection.setReadOnly();
MinecraftServer minecraftserver = this.server; MinecraftServer minecraftserver = this.server;
Connection networkmanager = this.connection; Connection networkmanager = this.connection;
@@ -1851,6 +1851,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1857,6 +1857,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@Override @Override
public void onDisconnect(Component reason) { public void onDisconnect(Component reason) {
@ -29,7 +29,7 @@ index 6ff04fc7202a7eb1f2b5978a2e2a573945d9dde1..c42aca2c8e0631e4091fac6652c4f1e5
// CraftBukkit start - Rarely it would send a disconnect line twice // CraftBukkit start - Rarely it would send a disconnect line twice
if (this.processedDisconnect) { if (this.processedDisconnect) {
return; return;
@@ -1867,7 +1872,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1873,7 +1878,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.player.disconnect(); this.player.disconnect();
// Paper start - Adventure // Paper start - Adventure