From 73af2d4cea597e65dd13dafab6325ea5709c9067 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Wed, 16 Aug 2023 17:58:07 +1000 Subject: [PATCH] Add clicked position to PlayerUseUnknownEntityEvent (#9604) --- ...0036-Add-PlayerUseUnknownEntityEvent.patch | 58 ++++++++++++++++--- patches/server/0009-MC-Utils.patch | 16 ++++- .../server/0019-Rewrite-chunk-system.patch | 19 +++--- ...0083-Add-PlayerUseUnknownEntityEvent.patch | 57 ++++++++++-------- ...21-Properly-fix-item-duplication-bug.patch | 4 +- .../server/0140-Basic-PlayerProfile-API.patch | 12 ++-- ...dle-ServerboundKeepAlivePacket-async.patch | 4 +- .../0215-InventoryCloseEvent-Reason-API.patch | 6 +- ...arseException-in-Entity-and-TE-names.patch | 8 +-- .../0296-Limit-Client-Sign-length-more.patch | 4 +- ...implement-PlayerRecipeBookClickEvent.patch | 4 +- ...ld-Difficulty-Remembering-Difficulty.patch | 4 +- patches/server/0448-Brand-support.patch | 8 +-- .../server/0503-Limit-recipe-packets.patch | 4 +- ...d-RespawnFlags-to-PlayerRespawnEvent.patch | 4 +- ...ditions-to-PlayerGameModeChangeEvent.patch | 6 +- .../0615-Add-PlayerKickEvent-causes.patch | 18 +++--- ...nt-tile-entity-copies-loading-chunks.patch | 4 +- ...s-ServerLevel-for-gamerule-callbacks.patch | 4 +- ...o-not-accept-invalid-client-settings.patch | 4 +- .../0914-Improve-logging-and-errors.patch | 4 +- ...le-player-info-update-packet-on-join.patch | 4 +- ...expired-keys-from-impacting-new-join.patch | 4 +- 23 files changed, 160 insertions(+), 100 deletions(-) diff --git a/patches/api/0036-Add-PlayerUseUnknownEntityEvent.patch b/patches/api/0036-Add-PlayerUseUnknownEntityEvent.patch index 8fa59475c2..e7e0ef328c 100644 --- a/patches/api/0036-Add-PlayerUseUnknownEntityEvent.patch +++ b/patches/api/0036-Add-PlayerUseUnknownEntityEvent.patch @@ -3,56 +3,96 @@ From: Jedediah Smith Date: Sat, 2 Apr 2016 05:08:36 -0400 Subject: [PATCH] Add PlayerUseUnknownEntityEvent +Adds the PlayerUseUnknownEntityEvent to be used by plugins dealing with +virtual entities/entities that are not actually known to the server. + +Co-authored-by: Nassim Jahnke diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerUseUnknownEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerUseUnknownEntityEvent.java new file mode 100644 -index 0000000000000000000000000000000000000000..09cfdf48ead8f03f3497646537292174241b0868 +index 0000000000000000000000000000000000000000..16291c34a87fb0c610a8b2fef10a1899693cb3b8 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerUseUnknownEntityEvent.java -@@ -0,0 +1,46 @@ +@@ -0,0 +1,82 @@ +package com.destroystokyo.paper.event.player; + +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; +import org.bukkit.inventory.EquipmentSlot; ++import org.bukkit.util.Vector; +import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; + ++/** ++ * Represents an event that is called when a player right-clicks an unknown entity. ++ * Useful for plugins dealing with virtual entities (entities that don't actually spawned on the server). ++ *
++ * This event may be called multiple times per interaction with different interaction hands ++ * and with or without the clicked position. ++ */ +public class PlayerUseUnknownEntityEvent extends PlayerEvent { + -+ private static final HandlerList handlers = new HandlerList(); ++ private static final HandlerList HANDLERS = new HandlerList(); + private final int entityId; + private final boolean attack; -+ @NotNull private final EquipmentSlot hand; ++ private final @NotNull EquipmentSlot hand; ++ private final @Nullable Vector clickedPosition; + -+ public PlayerUseUnknownEntityEvent(@NotNull Player who, int entityId, boolean attack, @NotNull EquipmentSlot hand) { ++ public PlayerUseUnknownEntityEvent(@NotNull Player who, int entityId, boolean attack, @NotNull EquipmentSlot hand, @Nullable Vector clickedPosition) { + super(who); + this.entityId = entityId; + this.attack = attack; + this.hand = hand; ++ this.clickedPosition = clickedPosition; + } + ++ /** ++ * Returns the entity id of the unknown entity that was interacted with. ++ * ++ * @return the entity id of the entity that was interacted with ++ */ + public int getEntityId() { + return this.entityId; + } + ++ /** ++ * Returns whether the interaction was an attack. ++ * ++ * @return true if the player is attacking the entity, false if the player is interacting with the entity ++ */ + public boolean isAttack() { + return this.attack; + } + -+ @NotNull -+ public EquipmentSlot getHand() { ++ /** ++ * Returns the hand used to perform this interaction. ++ * ++ * @return the hand used to interact ++ */ ++ public @NotNull EquipmentSlot getHand() { + return this.hand; + } + ++ /** ++ * Returns the position relative to the entity that was clicked, or null if not available. ++ * See {@link org.bukkit.event.player.PlayerInteractAtEntityEvent} for more details. ++ * ++ * @return the position relative to the entity that was clicked, or null if not available ++ * @see org.bukkit.event.player.PlayerInteractAtEntityEvent ++ */ ++ public @Nullable Vector getClickedRelativePosition() { ++ return clickedPosition.clone(); ++ } ++ + @NotNull + @Override + public HandlerList getHandlers() { -+ return handlers; ++ return HANDLERS; + } + + @NotNull + public static HandlerList getHandlerList() { -+ return handlers; ++ return HANDLERS; + } +} diff --git a/patches/server/0009-MC-Utils.patch b/patches/server/0009-MC-Utils.patch index 3d4391fce8..e6877d6b8b 100644 --- a/patches/server/0009-MC-Utils.patch +++ b/patches/server/0009-MC-Utils.patch @@ -3480,24 +3480,28 @@ index 0000000000000000000000000000000000000000..cea9c098ade00ee87b8efc8164ab72f5 +} diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java new file mode 100644 -index 0000000000000000000000000000000000000000..6779a0cc401231c53545dd22827b404be80b2ad0 +index 0000000000000000000000000000000000000000..9572294a50110f2452090da1f32e0a73edc3db05 --- /dev/null +++ b/src/main/java/io/papermc/paper/util/MCUtil.java -@@ -0,0 +1,522 @@ +@@ -0,0 +1,534 @@ +package io.papermc.paper.util; + +import com.google.common.util.concurrent.ThreadFactoryBuilder; ++import io.papermc.paper.math.BlockPosition; ++import io.papermc.paper.math.FinePosition; +import io.papermc.paper.math.Position; +import it.unimi.dsi.fastutil.objects.ObjectRBTreeSet; +import java.lang.ref.Cleaner; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; ++import net.minecraft.core.Vec3i; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.ClipContext; +import net.minecraft.world.level.Level; ++import net.minecraft.world.phys.Vec3; +import org.apache.commons.lang.exception.ExceptionUtils; +import org.bukkit.Location; +import org.bukkit.block.BlockFace; @@ -3960,6 +3964,14 @@ index 0000000000000000000000000000000000000000..6779a0cc401231c53545dd22827b404b + return new BlockPos(vec.getBlockX(), vec.getBlockY(), vec.getBlockZ()); + } + ++ public static FinePosition toPosition(Vec3 vector) { ++ return Position.fine(vector.x, vector.y, vector.z); ++ } ++ ++ public static BlockPosition toPosition(Vec3i vector) { ++ return Position.block(vector.getX(), vector.getY(), vector.getZ()); ++ } ++ + public static boolean isEdgeOfChunk(BlockPos pos) { + final int modX = pos.getX() & 15; + final int modZ = pos.getZ() & 15; diff --git a/patches/server/0019-Rewrite-chunk-system.patch b/patches/server/0019-Rewrite-chunk-system.patch index 138a61ce46..6f32b80632 100644 --- a/patches/server/0019-Rewrite-chunk-system.patch +++ b/patches/server/0019-Rewrite-chunk-system.patch @@ -15847,12 +15847,12 @@ index cea9c098ade00ee87b8efc8164ab72f5279758f0..197224e31175252d8438a8df585bbb65 + } } diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java -index 6779a0cc401231c53545dd22827b404be80b2ad0..750ed5844b16dcee6c4dda7a7422777ed1bd3f5c 100644 +index 7afb13b7457755fac3aed4b0260413a280ed29e6..5e17a83df2f3606aff375fe054266d03f9a0b3b6 100644 --- a/src/main/java/io/papermc/paper/util/MCUtil.java +++ b/src/main/java/io/papermc/paper/util/MCUtil.java -@@ -2,16 +2,29 @@ package io.papermc.paper.util; - - import com.google.common.util.concurrent.ThreadFactoryBuilder; +@@ -4,17 +4,30 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder; + import io.papermc.paper.math.BlockPosition; + import io.papermc.paper.math.FinePosition; import io.papermc.paper.math.Position; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; @@ -15864,6 +15864,7 @@ index 6779a0cc401231c53545dd22827b404be80b2ad0..750ed5844b16dcee6c4dda7a7422777e +import it.unimi.dsi.fastutil.objects.ReferenceArrayList; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; + import net.minecraft.core.Vec3i; import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ChunkHolder; +import net.minecraft.server.level.ChunkMap; @@ -15877,10 +15878,10 @@ index 6779a0cc401231c53545dd22827b404be80b2ad0..750ed5844b16dcee6c4dda7a7422777e import net.minecraft.world.level.Level; +import net.minecraft.world.level.chunk.ChunkAccess; +import net.minecraft.world.level.chunk.ChunkStatus; + import net.minecraft.world.phys.Vec3; import org.apache.commons.lang.exception.ExceptionUtils; import org.bukkit.Location; - import org.bukkit.block.BlockFace; -@@ -22,8 +35,11 @@ import org.spigotmc.AsyncCatcher; +@@ -26,8 +39,11 @@ import org.spigotmc.AsyncCatcher; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -15892,7 +15893,7 @@ index 6779a0cc401231c53545dd22827b404be80b2ad0..750ed5844b16dcee6c4dda7a7422777e import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.LinkedBlockingQueue; -@@ -516,6 +532,100 @@ public final class MCUtil { +@@ -528,6 +544,100 @@ public final class MCUtil { } } @@ -20638,7 +20639,7 @@ index ca788f0dcec4a117b410fe8348969e056b138b1e..a6ac76707da39cf86113003b1f326433 public boolean remove(Object object) { int i = this.findIndex((T)object); diff --git a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java -index 12e72ad737b1219fcdf88d344d41621d9fd5feec..e0bfeebeaac1aaea64bc07cdfdf7790e3e43ca7b 100644 +index 495b52bfab14478f8285cc5471335a41244c199e..e16ef1b7c0bfe6d6194c09f6787a50fd9b28f55e 100644 --- a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java +++ b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java @@ -186,7 +186,11 @@ public class WorldUpgrader { @@ -22796,7 +22797,7 @@ index d01388bbadf3069357cf52463f4104a1be4d2b56..b3dfa35bc41191883814c78693a0d958 // Spigot start private final org.bukkit.World.Spigot spigot = new org.bukkit.World.Spigot() diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index cf87f197d860567746dcae2a15946fed0b1a1d85..3b1dbfe6f03e62ac9e12066d41516de157f99719 100644 +index f76db40188007b6ab475d259b4cbe0c7ef804677..49ca3592012cca981b96434c9807440672a8c165 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -195,6 +195,48 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0083-Add-PlayerUseUnknownEntityEvent.patch b/patches/server/0083-Add-PlayerUseUnknownEntityEvent.patch index 8e81fc3161..c3c44a63b5 100644 --- a/patches/server/0083-Add-PlayerUseUnknownEntityEvent.patch +++ b/patches/server/0083-Add-PlayerUseUnknownEntityEvent.patch @@ -3,63 +3,70 @@ From: Jedediah Smith Date: Sat, 2 Apr 2016 05:09:16 -0400 Subject: [PATCH] Add PlayerUseUnknownEntityEvent -== AT == -public net.minecraft.network.protocol.game.ServerboundInteractPacket$ActionType +Adds the PlayerUseUnknownEntityEvent to be used by plugins dealing with +virtual entities/entities that are not actually known to the server. + +Co-authored-by: Nassim Jahnke diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java -index a5d57cc862036012d83b090bb1b3ccf4115a88b3..21068f766b75c414d5818073b7dca083d8ff4409 100644 +index 644a0fdea6576647539b96528717dbaeab498d93..221e64a66ff12a8de5c75992fc26a54a03b317e7 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java -@@ -10,8 +10,8 @@ import net.minecraft.world.entity.Entity; - import net.minecraft.world.phys.Vec3; - - public class ServerboundInteractPacket implements Packet { -- private final int entityId; -- private final ServerboundInteractPacket.Action action; -+ private final int entityId; public final int getEntityId() { return this.entityId; } // Paper - add accessor -+ private final ServerboundInteractPacket.Action action; public final ServerboundInteractPacket.ActionType getActionType() { return this.action.getType(); } // Paper - add accessor - private final boolean usingSecondaryAction; - static final ServerboundInteractPacket.Action ATTACK_ACTION = new ServerboundInteractPacket.Action() { - @Override +@@ -169,4 +169,14 @@ public class ServerboundInteractPacket implements Packet 0) { --this.chatSpamTickCount; -@@ -3135,6 +3137,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3136,6 +3138,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @Override public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) { diff --git a/patches/server/0591-add-RespawnFlags-to-PlayerRespawnEvent.patch b/patches/server/0591-add-RespawnFlags-to-PlayerRespawnEvent.patch index f261f7cf6c..de60d4f0b2 100644 --- a/patches/server/0591-add-RespawnFlags-to-PlayerRespawnEvent.patch +++ b/patches/server/0591-add-RespawnFlags-to-PlayerRespawnEvent.patch @@ -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 -index 25eefd856fb228b939b6ee4ae87f676e7419d9f4..e95574ecd4cee2515920f1445d8812b0fba7dc5e 100644 +index 89478496379ee8cf1653670a74e16201e030419b..aef114a256e048cd6c0c20a861d6fbfe61a7d1cf 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2789,7 +2789,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2790,7 +2790,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic case PERFORM_RESPAWN: if (this.player.wonGame) { this.player.wonGame = false; diff --git a/patches/server/0603-additions-to-PlayerGameModeChangeEvent.patch b/patches/server/0603-additions-to-PlayerGameModeChangeEvent.patch index a091138560..947735fe79 100644 --- a/patches/server/0603-additions-to-PlayerGameModeChangeEvent.patch +++ b/patches/server/0603-additions-to-PlayerGameModeChangeEvent.patch @@ -131,10 +131,10 @@ index c256423e9dc9d1837b847da44fb2920c58842c8b..0cb9803e30702de1cc530c1205fe9bbb } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index e95574ecd4cee2515920f1445d8812b0fba7dc5e..363e16f3d8069d2828cd7437c7aed4cccccd9002 100644 +index aef114a256e048cd6c0c20a861d6fbfe61a7d1cf..14d8f37af21f2d7fb892c705c9da38ade0c88c41 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2798,7 +2798,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2799,7 +2799,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic this.player = this.server.getPlayerList().respawn(this.player, false, RespawnReason.DEATH); if (this.server.isHardcore()) { @@ -144,7 +144,7 @@ index e95574ecd4cee2515920f1445d8812b0fba7dc5e..363e16f3d8069d2828cd7437c7aed4cc } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index d27c4b7a9db3b3970858eeacecabcc7926ff3ed8..155e39b55efeb72e8b92b68bc1183d8e842cf1e8 100644 +index f4ac6130d1112fb908cfd61698207b81d182b492..270521550d0349af64b01eb0d12c09c557341baa 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1562,7 +1562,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0615-Add-PlayerKickEvent-causes.patch b/patches/server/0615-Add-PlayerKickEvent-causes.patch index 20d2ca270d..6114805b90 100644 --- a/patches/server/0615-Add-PlayerKickEvent-causes.patch +++ b/patches/server/0615-Add-PlayerKickEvent-causes.patch @@ -88,7 +88,7 @@ index c68bac4727f6b2ca95fc8c438303097af14286f2..bb629ec263959c8268de88ca807bddb6 return Component.translatable("commands.kick.success", serverPlayer.getDisplayName(), reason); }, true); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 0f8c29375790599f75d3d4535a417bafba916396..bc609a16fed44f0a96025fb3b75eec039107338c 100644 +index 5bca0a32de3355dd472fde02b0ddf3055a42ab0c..63aa0a4bc2fe0011c7e4e9736993dec52fc4e43e 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -364,7 +364,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -370,7 +370,7 @@ index 0f8c29375790599f75d3d4535a417bafba916396..bc609a16fed44f0a96025fb3b75eec03 ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString()); } } -@@ -3159,7 +3169,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3160,7 +3170,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic // Paper start if (!org.bukkit.Bukkit.isPrimaryThread()) { if (this.recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) { @@ -379,7 +379,7 @@ index 0f8c29375790599f75d3d4535a417bafba916396..bc609a16fed44f0a96025fb3b75eec03 return; } } -@@ -3357,7 +3367,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3358,7 +3368,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(() -> { @@ -388,7 +388,7 @@ index 0f8c29375790599f75d3d4535a417bafba916396..bc609a16fed44f0a96025fb3b75eec03 }); // Paper end } -@@ -3403,7 +3413,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3404,7 +3414,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex); @@ -397,7 +397,7 @@ index 0f8c29375790599f75d3d4535a417bafba916396..bc609a16fed44f0a96025fb3b75eec03 } } else if (packet.identifier.equals(CUSTOM_UNREGISTER)) { try { -@@ -3413,7 +3423,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3414,7 +3424,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex); @@ -406,7 +406,7 @@ index 0f8c29375790599f75d3d4535a417bafba916396..bc609a16fed44f0a96025fb3b75eec03 } } else { try { -@@ -3431,7 +3441,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3432,7 +3442,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); @@ -415,7 +415,7 @@ index 0f8c29375790599f75d3d4535a417bafba916396..bc609a16fed44f0a96025fb3b75eec03 } } -@@ -3473,7 +3483,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3474,7 +3484,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic if (!Objects.equals(profilepublickey_a, profilepublickey_a1)) { if (profilepublickey_a != null && profilepublickey_a1.expiresAt().isBefore(profilepublickey_a.expiresAt())) { @@ -424,7 +424,7 @@ index 0f8c29375790599f75d3d4535a417bafba916396..bc609a16fed44f0a96025fb3b75eec03 } else { try { SignatureValidator signaturevalidator = this.server.getProfileKeySignatureValidator(); -@@ -3486,7 +3496,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3487,7 +3497,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator, Duration.ZERO)); } catch (ProfilePublicKey.ValidationException profilepublickey_b) { ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage()); @@ -491,7 +491,7 @@ index 984c288abf94d9fe47fada33722fea035b832f3b..addd20237b87c9a87bb09fd7addb101a } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 155e39b55efeb72e8b92b68bc1183d8e842cf1e8..f94fa71039ebd0e638745a0cd7ca86b98ecb9b5e 100644 +index 270521550d0349af64b01eb0d12c09c557341baa..04979441a1e654d978b858acb2219da6615ed8a6 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -584,7 +584,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0809-Prevent-tile-entity-copies-loading-chunks.patch b/patches/server/0809-Prevent-tile-entity-copies-loading-chunks.patch index 6803da9cc1..4ee90b688a 100644 --- a/patches/server/0809-Prevent-tile-entity-copies-loading-chunks.patch +++ b/patches/server/0809-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 655dc1cda9a498466ffef68d41bde5030dfe53c3..4700a1f41a1ff97076bb837fd2b3bc226512b3e2 100644 +index 1ccd169ceb0e90eeb5debd1d7e6a00a0b7d8578e..842f9e9b1e1f1026f78fb69c6941896e565fde02 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3344,7 +3344,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3345,7 +3345,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound); if (this.player.level().isLoaded(blockposition)) { diff --git a/patches/server/0812-Pass-ServerLevel-for-gamerule-callbacks.patch b/patches/server/0812-Pass-ServerLevel-for-gamerule-callbacks.patch index e546b9e9fd..45d23775a9 100644 --- a/patches/server/0812-Pass-ServerLevel-for-gamerule-callbacks.patch +++ b/patches/server/0812-Pass-ServerLevel-for-gamerule-callbacks.patch @@ -18,10 +18,10 @@ index 9a45921cbb1e7a39e6ef46cc93c14766ee8229ad..8115cf64a30b6438721769df6045e1b7 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 4700a1f41a1ff97076bb837fd2b3bc226512b3e2..92f9ee5897045e052c51805112c8478d32380c08 100644 +index 842f9e9b1e1f1026f78fb69c6941896e565fde02..569dcb7175dd0269c5ab7ea48fe7a56115f1281c 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2907,7 +2907,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2908,7 +2908,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic this.player = this.server.getPlayerList().respawn(this.player, false, RespawnReason.DEATH); if (this.server.isHardcore()) { this.player.setGameMode(GameType.SPECTATOR, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.HARDCORE_DEATH, null); // Paper diff --git a/patches/server/0822-Do-not-accept-invalid-client-settings.patch b/patches/server/0822-Do-not-accept-invalid-client-settings.patch index c2c5f72c55..5212f1f462 100644 --- a/patches/server/0822-Do-not-accept-invalid-client-settings.patch +++ b/patches/server/0822-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 92f9ee5897045e052c51805112c8478d32380c08..aae750e2b6067a8fccff7e70b3b0422bd609904a 100644 +index 569dcb7175dd0269c5ab7ea48fe7a56115f1281c..595735875e8ffba672d17f08df11c101e640c807 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3486,6 +3486,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3487,6 +3487,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @Override public void handleClientInformation(ServerboundClientInformationPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); diff --git a/patches/server/0914-Improve-logging-and-errors.patch b/patches/server/0914-Improve-logging-and-errors.patch index e07c007658..92d8022a6d 100644 --- a/patches/server/0914-Improve-logging-and-errors.patch +++ b/patches/server/0914-Improve-logging-and-errors.patch @@ -22,10 +22,10 @@ index f6e423a76d4c9cf639f1d44af80d33cf3072f6b5..135fc81414446f24c3adad71f5199c78 Properties properties; Properties properties1; diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index afdef7501e6071932d569657d60a39305f5ca4be..3d2ca3ae49a85a91773510ca93d60b9b098e39ba 100644 +index 4aa5ff559cbb46b7badbc960f782ed4035a5e495..4d13bfc159ad5cdf60db25ad19ff6f37c6d16924 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3621,7 +3621,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3622,7 +3622,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator, Duration.ZERO)); } catch (ProfilePublicKey.ValidationException profilepublickey_b) { diff --git a/patches/server/0923-Use-single-player-info-update-packet-on-join.patch b/patches/server/0923-Use-single-player-info-update-packet-on-join.patch index 139aa8bdd8..ab4a8bb1c5 100644 --- a/patches/server/0923-Use-single-player-info-update-packet-on-join.patch +++ b/patches/server/0923-Use-single-player-info-update-packet-on-join.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Use single player info update packet on join diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 4947265c3b7a9da8782be3ae8d35ef99c5836e81..c072cccb0a80019ce2f6c9e73f965ca26f8bc42c 100644 +index d05c4c34777a33240e4e8f985d6bca76ed45d7f3..460baa53e365b1da3680ba3e0e8b8f4b94a75fc4 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3636,7 +3636,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3637,7 +3637,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic this.signedMessageDecoder = session.createMessageDecoder(this.player.getUUID()); this.chatMessageChain.append((executor) -> { this.player.setChatSession(session); diff --git a/patches/server/0946-Prevent-causing-expired-keys-from-impacting-new-join.patch b/patches/server/0946-Prevent-causing-expired-keys-from-impacting-new-join.patch index a5713a5087..452362a8c4 100644 --- a/patches/server/0946-Prevent-causing-expired-keys-from-impacting-new-join.patch +++ b/patches/server/0946-Prevent-causing-expired-keys-from-impacting-new-join.patch @@ -24,7 +24,7 @@ index 23e0e6937e28f09271a4ec7c35e0076a576cf3d3..4aa8b483841028fbcc43f9ed47730881 UPDATE_GAME_MODE((serialized, buf) -> { serialized.gameMode = GameType.byId(buf.readVarInt()); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 54ea5cfdb6fba3c66349b80e21e66b44c4dbba53..7ee70536cfb621702388bd13dddf08f0224ba6bb 100644 +index 82a63452e73ac146d2a8d9bfdd030d6aa4d42080..4e0bef1456cbeee6574b7581576cbb882878722e 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -298,6 +298,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -49,7 +49,7 @@ index 54ea5cfdb6fba3c66349b80e21e66b44c4dbba53..7ee70536cfb621702388bd13dddf08f0 } public void resetPosition() { -@@ -3634,6 +3642,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3635,6 +3643,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic private void resetPlayerChatState(RemoteChatSession session) { this.chatSession = session;