From e5bbb56ac63fc6ec25cab8105c029eab3067c53d Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Fri, 29 Jul 2022 09:31:02 -0700 Subject: [PATCH] Added 1.19 kick event causes (#8204) --- .../api/0307-Add-PlayerKickEvent-causes.patch | 12 +- .../0656-Add-PlayerKickEvent-causes.patch | 120 +++++++++++++----- ...nect-for-book-edit-is-called-on-main.patch | 4 +- .../0677-Adds-PlayerArmSwingEvent.patch | 4 +- ...k-event-leave-message-not-being-sent.patch | 12 +- ...-ServerboundCommandSuggestionPacket-.patch | 4 +- ...on-checking-in-player-move-packet-ha.patch | 20 +-- .../0834-Kick-on-main-for-illegal-chat.patch | 12 +- ...cle-movement-from-players-while-tele.patch | 4 +- ...nt-tile-entity-copies-loading-chunks.patch | 4 +- ...s-ServerLevel-for-gamerule-callbacks.patch | 4 +- ...o-not-accept-invalid-client-settings.patch | 4 +- ...onent-in-resource-pack-rejection-mes.patch | 4 +- ...-debug-information-to-chat-packet-er.patch | 8 +- ...g-not-using-commands.spam-exclusions.patch | 4 +- patches/server/0921-More-Teleport-API.patch | 6 +- 16 files changed, 146 insertions(+), 80 deletions(-) diff --git a/patches/api/0307-Add-PlayerKickEvent-causes.patch b/patches/api/0307-Add-PlayerKickEvent-causes.patch index 7bd35b8138..9f49a57d75 100644 --- a/patches/api/0307-Add-PlayerKickEvent-causes.patch +++ b/patches/api/0307-Add-PlayerKickEvent-causes.patch @@ -24,7 +24,7 @@ index ae009440a7b1e073f3772b1c3d91b6ae6fca0495..0a400ecdffa18eb836fed62961f151ff /** diff --git a/src/main/java/org/bukkit/event/player/PlayerKickEvent.java b/src/main/java/org/bukkit/event/player/PlayerKickEvent.java -index efbf4b657c99ce3a5096d041d275af9ccaea7911..b76966953753dabcb31293846d39a4b4d5ef472a 100644 +index efbf4b657c99ce3a5096d041d275af9ccaea7911..449f2dccd466ba5f220148a20a03b36a2a565d9b 100644 --- a/src/main/java/org/bukkit/event/player/PlayerKickEvent.java +++ b/src/main/java/org/bukkit/event/player/PlayerKickEvent.java @@ -12,6 +12,7 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable { @@ -61,7 +61,7 @@ index efbf4b657c99ce3a5096d041d275af9ccaea7911..b76966953753dabcb31293846d39a4b4 } /** -@@ -132,4 +144,65 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable { +@@ -132,4 +144,73 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable { public static HandlerList getHandlerList() { return handlers; } @@ -110,6 +110,14 @@ index efbf4b657c99ce3a5096d041d275af9ccaea7911..b76966953753dabcb31293846d39a4b4 + + ILLEGAL_CHARACTERS, + ++ OUT_OF_ORDER_CHAT, ++ ++ UNSIGNED_CHAT, ++ ++ CHAT_VALIDATION_FAILED, ++ ++ TOO_MANY_PENDING_CHATS, ++ + SELF_INTERACTION, + + DUPLICATE_LOGIN, diff --git a/patches/server/0656-Add-PlayerKickEvent-causes.patch b/patches/server/0656-Add-PlayerKickEvent-causes.patch index a11816934e..f19ccd3c47 100644 --- a/patches/server/0656-Add-PlayerKickEvent-causes.patch +++ b/patches/server/0656-Add-PlayerKickEvent-causes.patch @@ -57,7 +57,7 @@ index 65637a33ba171a4b598f70cd943d24b0ee44a69f..57a9146bf2dee7a60aab16716e25348f } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72ff08aad83 100644 +index 2217d9b3bb589278da5b421ffce9e00261d08469..26b0bc810b4b09df9c910e3b8b49c18ddd65f832 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -372,7 +372,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -96,33 +96,37 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f } this.chatPreviewThrottler.tick(); -@@ -469,14 +469,22 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -467,16 +467,26 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + return this.server.isSingleplayerOwner(this.player.getGameProfile()); + } ++ @io.papermc.paper.annotation.DoNotUse // Paper public void disconnect(String s) { // Paper start - this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s)); + this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s), org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN); -+ } -+ -+ public void disconnect(String s, PlayerKickEvent.Cause cause) { -+ this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s), cause); } ++ public void disconnect(String s, PlayerKickEvent.Cause cause) { ++ this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s), cause); ++ } ++ ++ @io.papermc.paper.annotation.DoNotUse // Paper public void disconnect(final Component reason) { - this.disconnect(PaperAdventure.asAdventure(reason)); + this.disconnect(PaperAdventure.asAdventure(reason), org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN); ++ } ++ ++ public void disconnect(final Component reason, PlayerKickEvent.Cause cause) { ++ this.disconnect(PaperAdventure.asAdventure(reason), cause); } - public void disconnect(net.kyori.adventure.text.Component reason) { -+ public void disconnect(final Component reason, PlayerKickEvent.Cause cause) { -+ this.disconnect(PaperAdventure.asAdventure(reason), cause); -+ } -+ + public void disconnect(net.kyori.adventure.text.Component reason, org.bukkit.event.player.PlayerKickEvent.Cause cause) { // Paper end // CraftBukkit start - fire PlayerKickEvent if (this.processedDisconnect) { -@@ -505,7 +513,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -505,7 +515,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic net.kyori.adventure.text.Component leaveMessage = net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? this.player.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(this.player.getScoreboardName())); // Paper - Adventure @@ -131,7 +135,7 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f if (this.cserver.getServer().isRunning()) { this.cserver.getPluginManager().callEvent(event); -@@ -575,7 +583,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -575,7 +585,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic public void handleMoveVehicle(ServerboundMoveVehiclePacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(), packet.getY(), packet.getZ(), packet.getYRot(), packet.getXRot())) { @@ -140,7 +144,16 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f } else { Entity entity = this.player.getRootVehicle(); -@@ -826,13 +834,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -773,7 +783,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); + if (packet.getId() == this.awaitingTeleport) { + if (this.awaitingPositionFromClient == null) { +- this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement")); ++ this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause + return; + } + +@@ -826,13 +836,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic // PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); // Paper - run this async // CraftBukkit start if (this.chatSpamTickCount.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper start - split and make configurable @@ -156,7 +169,7 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f return; } // Paper end -@@ -985,7 +993,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -985,7 +995,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic // Paper start - validate pick item position if (!(packet.getSlot() >= 0 && packet.getSlot() < this.player.getInventory().items.size())) { ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString()); @@ -165,7 +178,7 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f return; } this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed -@@ -1172,7 +1180,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1172,7 +1182,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length; if (byteLength > 256 * 4) { ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send a book with with a page too large!"); @@ -174,7 +187,7 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f return; } byteTotal += byteLength; -@@ -1195,14 +1203,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1195,14 +1205,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic if (byteTotal > byteAllowed) { ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size()); @@ -191,16 +204,16 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f return; } this.lastBookTick = MinecraftServer.currentTick; -@@ -1326,7 +1334,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1326,7 +1336,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic public void handleMovePlayer(ServerboundMovePlayerPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(0.0D), packet.getY(0.0D), packet.getZ(0.0D), packet.getYRot(0.0F), packet.getXRot(0.0F))) { - this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement")); -+ this.disconnect(Component.translatable(("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT)); // Paper - kick event cause ++ this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause } else { ServerLevel worldserver = this.player.getLevel(); -@@ -1753,7 +1761,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1753,7 +1763,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic this.dropCount++; if (this.dropCount >= 20) { ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " dropped their items too quickly!"); @@ -209,7 +222,7 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f return; } } -@@ -1961,7 +1969,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1961,7 +1971,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); if (packet.getAction() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) { ServerGamePacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getName()); @@ -218,7 +231,7 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f } // Paper start PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packet.action.ordinal()]; -@@ -2074,7 +2082,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2074,7 +2084,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic this.player.resetLastActionTime(); } else { ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString()); @@ -227,7 +240,7 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f } } -@@ -2087,7 +2095,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2087,7 +2097,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } // CraftBukkit end if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.message())) { @@ -236,7 +249,34 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f } else { if (this.tryHandleChat(packet.message(), packet.timeStamp(), packet.lastSeenMessages())) { // this.server.submit(() -> { // CraftBukkit - async chat -@@ -2477,7 +2485,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2115,7 +2125,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + @Override + public void handleChatCommand(ServerboundChatCommandPacket packet) { + if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.command())) { +- this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters")); ++ this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper + } else { + if (this.tryHandleChat(packet.command(), packet.timeStamp(), packet.lastSeenMessages())) { + this.server.submit(() -> { +@@ -2201,7 +2211,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + private boolean tryHandleChat(String message, Instant timestamp, LastSeenMessages.Update acknowledgment) { + if (!this.updateChatOrder(timestamp)) { + ServerGamePacketListenerImpl.LOGGER.warn("{} sent out-of-order chat: '{}'", this.player.getName().getString(), message); +- this.disconnect(Component.translatable("multiplayer.disconnect.out_of_order_chat")); ++ this.disconnect(Component.translatable("multiplayer.disconnect.out_of_order_chat"), org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event cause + return false; + } else if (this.player.isRemoved() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) { // CraftBukkit - dead men tell no tales + this.send(new ClientboundSystemChatPacket(Component.translatable("chat.disabled.options").withStyle(ChatFormatting.RED), false)); +@@ -2450,7 +2460,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + ChatSender chatsender = this.player.asChatSender(); + + if (chatsender.profilePublicKey() != null && !message.verify(chatsender)) { +- this.disconnect(Component.translatable("multiplayer.disconnect.unsigned_chat")); ++ this.disconnect(Component.translatable("multiplayer.disconnect.unsigned_chat"), org.bukkit.event.player.PlayerKickEvent.Cause.UNSIGNED_CHAT); // Paper - kick event cause + return false; + } else { + if (message.hasExpiredServer(Instant.now())) { +@@ -2477,7 +2487,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic // this.chatSpamTickCount += 20; if (this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // CraftBukkit end @@ -245,7 +285,25 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f } } -@@ -2739,7 +2747,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2577,7 +2587,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + + private void handleValidationFailure(Set reasons) { + ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message from {}, reasons: {}", this.player.getName().getString(), reasons.stream().map(LastSeenMessagesValidator.ErrorCondition::message).collect(Collectors.joining(","))); +- this.disconnect(Component.translatable("multiplayer.disconnect.chat_validation_failed")); ++ this.disconnect(Component.translatable("multiplayer.disconnect.chat_validation_failed"), org.bukkit.event.player.PlayerKickEvent.Cause.CHAT_VALIDATION_FAILED); // Paper - kick event cause + } + + @Override +@@ -2724,7 +2734,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + } + + if (i > 4096) { +- this.disconnect(Component.translatable("multiplayer.disconnect.too_many_pending_chats")); ++ this.disconnect(Component.translatable("multiplayer.disconnect.too_many_pending_chats"), org.bukkit.event.player.PlayerKickEvent.Cause.TOO_MANY_PENDING_CHATS); // Paper - kick event cause + } + + } +@@ -2739,7 +2749,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic // Spigot Start if ( entity == this.player && !this.player.isSpectator() ) { @@ -254,7 +312,7 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f return; } // Spigot End -@@ -2832,7 +2840,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2832,7 +2842,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } // CraftBukkit end } else { @@ -263,7 +321,7 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString()); } } -@@ -3240,7 +3248,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3240,7 +3250,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic // Paper start if (!org.bukkit.Bukkit.isPrimaryThread()) { if (recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) { @@ -272,7 +330,7 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f return; } } -@@ -3443,7 +3451,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3443,7 +3453,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } else if (!this.isSingleplayerOwner()) { // Paper start - This needs to be handled on the main thread for plugins server.submit(() -> { @@ -281,7 +339,7 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f }); // Paper end } -@@ -3489,7 +3497,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3489,7 +3499,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex); @@ -290,7 +348,7 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f } } else if (packet.identifier.equals(CUSTOM_UNREGISTER)) { try { -@@ -3499,7 +3507,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3499,7 +3509,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex); @@ -299,7 +357,7 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f } } else { try { -@@ -3517,7 +3525,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3517,7 +3527,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data); } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex); @@ -333,7 +391,7 @@ index bdb37391b9df7ec4983728de8324aa3f1ed20f4b..ca0ad4fd5f4aafacd197494970f2aec3 // CraftBukkit end diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 60024a387429a13593f7f709004282d27678cbbe..d72e5c06ab4f34742ec74448d1cad892048f159b 100644 +index 7d030d7a8a58f4a031e09d09c9718af3d3c1e707..140730ff3e10066d19321c75e241a1e0d8d3ba17 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -516,7 +516,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0673-Ensure-disconnect-for-book-edit-is-called-on-main.patch b/patches/server/0673-Ensure-disconnect-for-book-edit-is-called-on-main.patch index 008cf58220..7a25a37d56 100644 --- a/patches/server/0673-Ensure-disconnect-for-book-edit-is-called-on-main.patch +++ b/patches/server/0673-Ensure-disconnect-for-book-edit-is-called-on-main.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Ensure disconnect for book edit is called on main diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index a768e09c5ce6718435b50f1502c5ace773fff470..dfe1966bfb30b3d2e60e6b88d0a7c2331b02e9a4 100644 +index 5cb42f3ec712bec46d76684e8e0a3f0f547d2586..685745b853f86fa2eda031ad20317ad321b1379a 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1210,7 +1210,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1212,7 +1212,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic // Paper end // CraftBukkit start if (this.lastBookTick + 20 > MinecraftServer.currentTick) { diff --git a/patches/server/0677-Adds-PlayerArmSwingEvent.patch b/patches/server/0677-Adds-PlayerArmSwingEvent.patch index 01b111ff36..c3c42ead1c 100644 --- a/patches/server/0677-Adds-PlayerArmSwingEvent.patch +++ b/patches/server/0677-Adds-PlayerArmSwingEvent.patch @@ -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 -index 7727749b09ef5a4bf5ea51f12befd3c106f3a56f..7c9f4f7b0687dcd04eee24464c2902f931552aba 100644 +index 685745b853f86fa2eda031ad20317ad321b1379a..c65c72a2dd3c87621c1369c52770b912057eafd2 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2616,7 +2616,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2618,7 +2618,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } // Arm swing animation diff --git a/patches/server/0678-Fixes-kick-event-leave-message-not-being-sent.patch b/patches/server/0678-Fixes-kick-event-leave-message-not-being-sent.patch index 93c8b0c73e..2445b4066d 100644 --- a/patches/server/0678-Fixes-kick-event-leave-message-not-being-sent.patch +++ b/patches/server/0678-Fixes-kick-event-leave-message-not-being-sent.patch @@ -17,10 +17,10 @@ index 6e53214042ab515d9c66fb24f6aa1c07d6c3539d..7670c02dca163d360e64a1491f2efe69 public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 781c3abc7693ef1e310c963d154f312b06d9c392..bc20661f3b70f1e769d6be5f2a8bbb81cd7b2dca 100644 +index c65c72a2dd3c87621c1369c52770b912057eafd2..bd152bdb0e00b807c514f601ec400a1aa7e8413d 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -523,7 +523,6 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -525,7 +525,6 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic // Do not kick the player return; } @@ -28,7 +28,7 @@ index 781c3abc7693ef1e310c963d154f312b06d9c392..bc20661f3b70f1e769d6be5f2a8bbb81 // Send the possibly modified leave message final Component ichatbasecomponent = PaperAdventure.asVanilla(event.reason()); // Paper - Adventure // CraftBukkit end -@@ -532,7 +531,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -534,7 +533,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic this.connection.send(new ClientboundDisconnectPacket(ichatbasecomponent), PacketSendListener.thenRun(() -> { this.connection.disconnect(ichatbasecomponent); })); @@ -37,7 +37,7 @@ index 781c3abc7693ef1e310c963d154f312b06d9c392..bc20661f3b70f1e769d6be5f2a8bbb81 this.connection.setReadOnly(); MinecraftServer minecraftserver = this.server; Connection networkmanager = this.connection; -@@ -1994,6 +1993,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1996,6 +1995,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @Override public void onDisconnect(Component reason) { @@ -49,7 +49,7 @@ index 781c3abc7693ef1e310c963d154f312b06d9c392..bc20661f3b70f1e769d6be5f2a8bbb81 // CraftBukkit start - Rarely it would send a disconnect line twice if (this.processedDisconnect) { return; -@@ -2010,7 +2014,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2012,7 +2016,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic this.player.disconnect(); // Paper start - Adventure @@ -59,7 +59,7 @@ index 781c3abc7693ef1e310c963d154f312b06d9c392..bc20661f3b70f1e769d6be5f2a8bbb81 this.server.getPlayerList().broadcastSystemMessage(PaperAdventure.asVanilla(quitMessage), false); // Paper end diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 69af47c070806ae410a2f4c80c121f48689f56bc..387158d5aad22e0da186e1087364d8a990aadd23 100644 +index ca0ad4fd5f4aafacd197494970f2aec3b2a6c4d0..0354b7e20bbc9f888cf85d6db42ce2b64a25b4c2 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -592,6 +592,11 @@ public abstract class PlayerList { diff --git a/patches/server/0770-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch b/patches/server/0770-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch index bf40824fb6..f749f4a415 100644 --- a/patches/server/0770-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch +++ b/patches/server/0770-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Don't respond to ServerboundCommandSuggestionPacket when diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index e8cd8adad14c6bcab3ccef7fcc458b38d90592c3..ac09598d2152b5dc9be004a6088ed65f3d1d6f59 100644 +index 1f5ccfd997392d010a9375b87f01e5a248802acc..331c700ec85d84417bf734f30a3870659c5da2e9 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -844,6 +844,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -846,6 +846,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } // Paper end // CraftBukkit end diff --git a/patches/server/0803-Optimise-collision-checking-in-player-move-packet-ha.patch b/patches/server/0803-Optimise-collision-checking-in-player-move-packet-ha.patch index 2cffb888f3..3d4be25da9 100644 --- a/patches/server/0803-Optimise-collision-checking-in-player-move-packet-ha.patch +++ b/patches/server/0803-Optimise-collision-checking-in-player-move-packet-ha.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Optimise collision checking in player move packet handling Move collision logic to just the hasNewCollision call instead of getCubes + hasNewCollision diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index ac09598d2152b5dc9be004a6088ed65f3d1d6f59..e31f1fc855da5dcde77f0bced4e195824110e018 100644 +index 331c700ec85d84417bf734f30a3870659c5da2e9..abd9ee4c2cddf0fd1e31bffbb60db025491e8315 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -656,7 +656,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -658,7 +658,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic return; } @@ -18,7 +18,7 @@ index ac09598d2152b5dc9be004a6088ed65f3d1d6f59..e31f1fc855da5dcde77f0bced4e19582 d6 = d3 - this.vehicleLastGoodX; // Paper - diff on change, used for checking large move vectors above d7 = d4 - this.vehicleLastGoodY - 1.0E-6D; // Paper - diff on change, used for checking large move vectors above -@@ -664,6 +664,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -666,6 +666,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic boolean flag1 = entity.verticalCollisionBelow; entity.move(MoverType.PLAYER, new Vec3(d6, d7, d8)); @@ -26,7 +26,7 @@ index ac09598d2152b5dc9be004a6088ed65f3d1d6f59..e31f1fc855da5dcde77f0bced4e19582 double d11 = d7; d6 = d3 - entity.getX(); -@@ -677,16 +678,24 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -679,16 +680,24 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic boolean flag2 = false; if (d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot @@ -54,7 +54,7 @@ index ac09598d2152b5dc9be004a6088ed65f3d1d6f59..e31f1fc855da5dcde77f0bced4e19582 entity.absMoveTo(d0, d1, d2, f, f1); this.player.absMoveTo(d0, d1, d2, this.player.getYRot(), this.player.getXRot()); // CraftBukkit this.connection.send(new ClientboundMoveVehiclePacket(entity)); -@@ -772,7 +781,32 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -774,7 +783,32 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } private boolean noBlocksAround(Entity entity) { @@ -88,7 +88,7 @@ index ac09598d2152b5dc9be004a6088ed65f3d1d6f59..e31f1fc855da5dcde77f0bced4e19582 } @Override -@@ -1348,7 +1382,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1350,7 +1384,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } if (this.awaitingPositionFromClient != null) { @@ -97,7 +97,7 @@ index ac09598d2152b5dc9be004a6088ed65f3d1d6f59..e31f1fc855da5dcde77f0bced4e19582 this.awaitingTeleportTime = this.tickCount; this.teleport(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot()); } -@@ -1442,7 +1476,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1444,7 +1478,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } } @@ -106,7 +106,7 @@ index ac09598d2152b5dc9be004a6088ed65f3d1d6f59..e31f1fc855da5dcde77f0bced4e19582 d7 = d0 - this.lastGoodX; // Paper - diff on change, used for checking large move vectors above d8 = d1 - this.lastGoodY; // Paper - diff on change, used for checking large move vectors above -@@ -1483,6 +1517,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1485,6 +1519,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic boolean flag1 = this.player.verticalCollisionBelow; this.player.move(MoverType.PLAYER, new Vec3(d7, d8, d9)); @@ -114,7 +114,7 @@ index ac09598d2152b5dc9be004a6088ed65f3d1d6f59..e31f1fc855da5dcde77f0bced4e19582 this.player.onGround = packet.isOnGround(); // CraftBukkit - SPIGOT-5810, SPIGOT-5835, SPIGOT-6828: reset by this.player.move // Paper start - prevent position desync if (this.awaitingPositionFromClient != null) { -@@ -1502,12 +1537,23 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1504,12 +1539,23 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic boolean flag2 = false; if (!this.player.isChangingDimension() && d11 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.gameMode.isCreative() && this.player.gameMode.getGameModeForPlayer() != GameType.SPECTATOR) { // Spigot @@ -140,7 +140,7 @@ index ac09598d2152b5dc9be004a6088ed65f3d1d6f59..e31f1fc855da5dcde77f0bced4e19582 this.internalTeleport(d3, d4, d5, f, f1, Collections.emptySet(), false); // CraftBukkit - SPIGOT-1807: Don't call teleport event, when the client thinks the player is falling, because the chunks are not loaded on the client yet. } else { // CraftBukkit start - fire PlayerMoveEvent -@@ -1593,6 +1639,27 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1595,6 +1641,27 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } } diff --git a/patches/server/0834-Kick-on-main-for-illegal-chat.patch b/patches/server/0834-Kick-on-main-for-illegal-chat.patch index fdd94a5d86..bc0f8683b0 100644 --- a/patches/server/0834-Kick-on-main-for-illegal-chat.patch +++ b/patches/server/0834-Kick-on-main-for-illegal-chat.patch @@ -7,10 +7,10 @@ Makes the PlayerKickEvent fire on the main thread for illegal characters or chat out-of-order errors. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index e31f1fc855da5dcde77f0bced4e195824110e018..9a719ee2f2e1394458da2d459b4bc434e06786cd 100644 +index abd9ee4c2cddf0fd1e31bffbb60db025491e8315..067b18932a39a97cd13b59d43350c1fe7239a3da 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2171,7 +2171,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2173,7 +2173,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } // CraftBukkit end if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.message())) { @@ -20,22 +20,22 @@ index e31f1fc855da5dcde77f0bced4e195824110e018..9a719ee2f2e1394458da2d459b4bc434 } else { if (this.tryHandleChat(packet.message(), packet.timeStamp(), packet.lastSeenMessages())) { // this.server.submit(() -> { // CraftBukkit - async chat -@@ -2199,7 +2201,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2201,7 +2203,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @Override public void handleChatCommand(ServerboundChatCommandPacket packet) { if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.command())) { + this.server.scheduleOnMain(() -> { // Paper - push to main for event firing - this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters")); + this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper + }); // Paper - push to main for event firing } else { if (this.tryHandleChat(packet.command(), packet.timeStamp(), packet.lastSeenMessages())) { this.server.submit(() -> { -@@ -2285,7 +2289,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2287,7 +2291,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic private boolean tryHandleChat(String message, Instant timestamp, LastSeenMessages.Update acknowledgment) { if (!this.updateChatOrder(timestamp)) { ServerGamePacketListenerImpl.LOGGER.warn("{} sent out-of-order chat: '{}'", this.player.getName().getString(), message); + this.server.scheduleOnMain(() -> { // Paper - push to main - this.disconnect(Component.translatable("multiplayer.disconnect.out_of_order_chat")); + this.disconnect(Component.translatable("multiplayer.disconnect.out_of_order_chat"), org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event cause + }); // Paper - push to main return false; } else if (this.player.isRemoved() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) { // CraftBukkit - dead men tell no tales diff --git a/patches/server/0865-Don-t-allow-vehicle-movement-from-players-while-tele.patch b/patches/server/0865-Don-t-allow-vehicle-movement-from-players-while-tele.patch index ac16a212e9..4a754b2d95 100644 --- a/patches/server/0865-Don-t-allow-vehicle-movement-from-players-while-tele.patch +++ b/patches/server/0865-Don-t-allow-vehicle-movement-from-players-while-tele.patch @@ -7,10 +7,10 @@ Bring the vehicle move packet behavior in line with the regular player move packet. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 9a719ee2f2e1394458da2d459b4bc434e06786cd..8ac6bba7a4427733f9f03835480fd574fe17dd93 100644 +index 067b18932a39a97cd13b59d43350c1fe7239a3da..55bf584ace138e6df855c011f1fb44dbdc0e7d98 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -586,6 +586,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -588,6 +588,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } else { Entity entity = this.player.getRootVehicle(); diff --git a/patches/server/0881-Prevent-tile-entity-copies-loading-chunks.patch b/patches/server/0881-Prevent-tile-entity-copies-loading-chunks.patch index 413935286e..4089d0ecb6 100644 --- a/patches/server/0881-Prevent-tile-entity-copies-loading-chunks.patch +++ b/patches/server/0881-Prevent-tile-entity-copies-loading-chunks.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent tile entity copies loading chunks diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index a73f7e62de04f8e9556014c2a7c33b20220a38de..f72402cc1fef02f72b4b0dfda1c01d1d0774205b 100644 +index 55bf584ace138e6df855c011f1fb44dbdc0e7d98..9507988d7650204b6ae0137bc0b8bcd486a83028 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3391,7 +3391,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3393,7 +3393,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound); if (this.player.level.isLoaded(blockposition)) { diff --git a/patches/server/0884-Pass-ServerLevel-for-gamerule-callbacks.patch b/patches/server/0884-Pass-ServerLevel-for-gamerule-callbacks.patch index 75a6fc8b0a..dc49d0e1dc 100644 --- a/patches/server/0884-Pass-ServerLevel-for-gamerule-callbacks.patch +++ b/patches/server/0884-Pass-ServerLevel-for-gamerule-callbacks.patch @@ -18,10 +18,10 @@ index 20670bc075c387ee0422eb1014207e26105efccd..bdd6560fe85950b0a857a949cb38c044 if (dedicatedserverproperties.enableQuery) { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index f72402cc1fef02f72b4b0dfda1c01d1d0774205b..a480c1a64d6d22f973ab1b4399816610da836101 100644 +index 9507988d7650204b6ae0137bc0b8bcd486a83028..de6bbe320c32b512bd995a86c782a25cd1b770d8 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2987,7 +2987,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2989,7 +2989,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic this.player = this.server.getPlayerList().respawn(this.player, false); if (this.server.isHardcore()) { this.player.setGameMode(GameType.SPECTATOR, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.HARDCORE_DEATH, null); // Paper diff --git a/patches/server/0895-Do-not-accept-invalid-client-settings.patch b/patches/server/0895-Do-not-accept-invalid-client-settings.patch index a45a9be3c3..fdd6c23cb1 100644 --- a/patches/server/0895-Do-not-accept-invalid-client-settings.patch +++ b/patches/server/0895-Do-not-accept-invalid-client-settings.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Do not accept invalid client settings diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index a480c1a64d6d22f973ab1b4399816610da836101..ca066bb34e4bbad587b1ecb07f06958742082c64 100644 +index de6bbe320c32b512bd995a86c782a25cd1b770d8..a54ea66d2c85fc82075bb8c27b34e2d1407e8375 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3570,6 +3570,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3572,6 +3572,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @Override public void handleClientInformation(ServerboundClientInformationPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); diff --git a/patches/server/0913-Don-t-print-component-in-resource-pack-rejection-mes.patch b/patches/server/0913-Don-t-print-component-in-resource-pack-rejection-mes.patch index 7541f6d995..b2676ad18a 100644 --- a/patches/server/0913-Don-t-print-component-in-resource-pack-rejection-mes.patch +++ b/patches/server/0913-Don-t-print-component-in-resource-pack-rejection-mes.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Don't print component in resource pack rejection message diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index c5278cc28eaba16d6adc31fc5f276e0c972fd8dc..ea47d8f0275a99920c6e3f5c7a9c09ccb2341139 100644 +index a54ea66d2c85fc82075bb8c27b34e2d1407e8375..c00443e73cd31f79679f8e4ba45a6f551349bb85 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2045,7 +2045,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2047,7 +2047,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic public void handleResourcePackResponse(ServerboundResourcePackPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); if (packet.getAction() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) { diff --git a/patches/server/0917-Add-some-minimal-debug-information-to-chat-packet-er.patch b/patches/server/0917-Add-some-minimal-debug-information-to-chat-packet-er.patch index 26a62579ac..b3f5f35dd0 100644 --- a/patches/server/0917-Add-some-minimal-debug-information-to-chat-packet-er.patch +++ b/patches/server/0917-Add-some-minimal-debug-information-to-chat-packet-er.patch @@ -6,19 +6,19 @@ Subject: [PATCH] Add some minimal debug information to chat packet errors TODO: potentially add some kick leeway diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index ad083a1e57e15568d05f54f5606f7c9b355c1927..66fa86f67a835b7a4c2de6c5111367d1ab6034fb 100644 +index c00443e73cd31f79679f8e4ba45a6f551349bb85..cdf7ed204cf6216337ab9667158b33143c82a819 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2294,7 +2294,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2296,7 +2296,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic private boolean tryHandleChat(String message, Instant timestamp, LastSeenMessages.Update acknowledgment) { if (!this.updateChatOrder(timestamp)) { - ServerGamePacketListenerImpl.LOGGER.warn("{} sent out-of-order chat: '{}'", this.player.getName().getString(), message); + ServerGamePacketListenerImpl.LOGGER.warn("{} sent out-of-order chat: '{}': {} > {}", this.player.getName().getString(), message, this.lastChatTimeStamp.get().getEpochSecond(), timestamp.getEpochSecond()); // Paper this.server.scheduleOnMain(() -> { // Paper - push to main - this.disconnect(Component.translatable("multiplayer.disconnect.out_of_order_chat")); + this.disconnect(Component.translatable("multiplayer.disconnect.out_of_order_chat"), org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event cause }); // Paper - push to main -@@ -2550,7 +2550,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2552,7 +2552,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic return false; } else { if (message.hasExpiredServer(Instant.now())) { diff --git a/patches/server/0919-Fix-Spigot-Config-not-using-commands.spam-exclusions.patch b/patches/server/0919-Fix-Spigot-Config-not-using-commands.spam-exclusions.patch index 995a23952f..9d90007654 100644 --- a/patches/server/0919-Fix-Spigot-Config-not-using-commands.spam-exclusions.patch +++ b/patches/server/0919-Fix-Spigot-Config-not-using-commands.spam-exclusions.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix Spigot Config not using commands.spam-exclusions diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 66fa86f67a835b7a4c2de6c5111367d1ab6034fb..309fce97cff8ec60c4734e61c0572897927539b4 100644 +index cdf7ed204cf6216337ab9667158b33143c82a819..72864ca3f0fa94512d7f57b4e05929be7d2912cd 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2571,7 +2571,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2573,7 +2573,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } // Spigot end // this.chatSpamTickCount += 20; diff --git a/patches/server/0921-More-Teleport-API.patch b/patches/server/0921-More-Teleport-API.patch index d8265b1526..696990e8f7 100644 --- a/patches/server/0921-More-Teleport-API.patch +++ b/patches/server/0921-More-Teleport-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] More Teleport API diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 309fce97cff8ec60c4734e61c0572897927539b4..a14710afaabf2b3b43f18ebe52eec8befff2b4ed 100644 +index 72864ca3f0fa94512d7f57b4e05929be7d2912cd..2fe2336a9dd307dbd92cbf9472ffe698515f5ee9 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1726,11 +1726,17 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1728,11 +1728,17 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic return false; // CraftBukkit - Return event status } @@ -69,7 +69,7 @@ index 2a6c67634c31c332102d24bef293da1bacd0c000..b80cc0938b2b3928f4450f1314a9fbd7 // Let the server handle cross world teleports if (location.getWorld() != null && !location.getWorld().equals(this.getWorld())) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 6acac39e4fe5a9303ee2bd8356633b5173de55af..9b5eb67b085c706acbf38278abacc1cd0c01d388 100644 +index f74802748438f4d40fb5ab772a209dfb2ee406e6..d2249145046d728240cf1ae0b71c9ec16184bc18 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1135,7 +1135,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {