From c793bd93be69918d26ff53764a1fee2254cc1618 Mon Sep 17 00:00:00 2001 From: Moulberry Date: Sun, 16 Jul 2023 23:58:25 +0800 Subject: [PATCH] Allow LEFT_CLICK_AIR in 3.0->4.5 range of entity (#9211) --- patches/server/0009-MC-Utils.patch | 9 +++- .../server/0019-Rewrite-chunk-system.patch | 6 +-- .../server/0140-Basic-PlayerProfile-API.patch | 4 +- ...arseException-in-Entity-and-TE-names.patch | 4 +- ...-event-not-being-called-in-adventure.patch | 29 ------------ ...act-event-not-being-called-sometimes.patch | 46 +++++++++++++++++++ ...d-RespawnFlags-to-PlayerRespawnEvent.patch | 4 +- ...ditions-to-PlayerGameModeChangeEvent.patch | 4 +- .../0609-Add-Unix-domain-socket-support.patch | 4 +- .../0615-Add-PlayerKickEvent-causes.patch | 22 ++++----- .../0636-Adds-PlayerArmSwingEvent.patch | 6 +-- ...de-unnecessary-itemmeta-from-clients.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 +- .../0908-Properly-resend-entities.patch | 4 +- .../0915-Improve-logging-and-errors.patch | 4 +- ...le-player-info-update-packet-on-join.patch | 4 +- ...expired-keys-from-impacting-new-join.patch | 4 +- 19 files changed, 96 insertions(+), 74 deletions(-) delete mode 100644 patches/server/0520-Fix-interact-event-not-being-called-in-adventure.patch create mode 100644 patches/server/0520-Fix-interact-event-not-being-called-sometimes.patch diff --git a/patches/server/0009-MC-Utils.patch b/patches/server/0009-MC-Utils.patch index 9e0dde4fe4..cb1b5a302b 100644 --- a/patches/server/0009-MC-Utils.patch +++ b/patches/server/0009-MC-Utils.patch @@ -3480,10 +3480,10 @@ 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..902317d2dc198a1cbfc679810bcb2173644354cb +index 0000000000000000000000000000000000000000..6779a0cc401231c53545dd22827b404be80b2ad0 --- /dev/null +++ b/src/main/java/io/papermc/paper/util/MCUtil.java -@@ -0,0 +1,517 @@ +@@ -0,0 +1,522 @@ +package io.papermc.paper.util; + +import com.google.common.util.concurrent.ThreadFactoryBuilder; @@ -3503,6 +3503,7 @@ index 0000000000000000000000000000000000000000..902317d2dc198a1cbfc679810bcb2173 +import org.bukkit.block.BlockFace; +import org.bukkit.craftbukkit.CraftWorld; +import org.bukkit.craftbukkit.util.Waitable; ++import org.bukkit.util.Vector; +import org.spigotmc.AsyncCatcher; + +import javax.annotation.Nonnull; @@ -3955,6 +3956,10 @@ index 0000000000000000000000000000000000000000..902317d2dc198a1cbfc679810bcb2173 + return new BlockPos(pos.blockX(), pos.blockY(), pos.blockZ()); + } + ++ public static BlockPos toBlockPosition(Vector vec) { ++ return new BlockPos(vec.getBlockX(), vec.getBlockY(), vec.getBlockZ()); ++ } ++ + 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 58f1a6e0a1..e367b5e9a8 100644 --- a/patches/server/0019-Rewrite-chunk-system.patch +++ b/patches/server/0019-Rewrite-chunk-system.patch @@ -15833,7 +15833,7 @@ 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 902317d2dc198a1cbfc679810bcb2173644354cb..67064aa46043cad3ad14b1293c767e6fa461fb6a 100644 +index 6779a0cc401231c53545dd22827b404be80b2ad0..750ed5844b16dcee6c4dda7a7422777ed1bd3f5c 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; @@ -15866,7 +15866,7 @@ index 902317d2dc198a1cbfc679810bcb2173644354cb..67064aa46043cad3ad14b1293c767e6f import org.apache.commons.lang.exception.ExceptionUtils; import org.bukkit.Location; import org.bukkit.block.BlockFace; -@@ -21,8 +34,11 @@ import org.spigotmc.AsyncCatcher; +@@ -22,8 +35,11 @@ import org.spigotmc.AsyncCatcher; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -15878,7 +15878,7 @@ index 902317d2dc198a1cbfc679810bcb2173644354cb..67064aa46043cad3ad14b1293c767e6f import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.LinkedBlockingQueue; -@@ -511,6 +527,100 @@ public final class MCUtil { +@@ -516,6 +532,100 @@ public final class MCUtil { } } diff --git a/patches/server/0140-Basic-PlayerProfile-API.patch b/patches/server/0140-Basic-PlayerProfile-API.patch index 5af405ec62..39ae6dc72a 100644 --- a/patches/server/0140-Basic-PlayerProfile-API.patch +++ b/patches/server/0140-Basic-PlayerProfile-API.patch @@ -565,7 +565,7 @@ index 0000000000000000000000000000000000000000..7ac27392a8647ef7d0dc78efe78703e9 + @NotNull GameProfile buildGameProfile(); +} diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java -index 67064aa46043cad3ad14b1293c767e6fa461fb6a..77da7a3b51c500ff251f776acc85a752a99fb356 100644 +index 750ed5844b16dcee6c4dda7a7422777ed1bd3f5c..39b19310eece90fa5398fbb160593fd4f966627a 100644 --- a/src/main/java/io/papermc/paper/util/MCUtil.java +++ b/src/main/java/io/papermc/paper/util/MCUtil.java @@ -1,5 +1,7 @@ @@ -584,7 +584,7 @@ index 67064aa46043cad3ad14b1293c767e6fa461fb6a..77da7a3b51c500ff251f776acc85a752 import org.bukkit.Location; import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.CraftWorld; -@@ -373,6 +376,10 @@ public final class MCUtil { +@@ -374,6 +377,10 @@ public final class MCUtil { return run.get(); } diff --git a/patches/server/0266-Catch-JsonParseException-in-Entity-and-TE-names.patch b/patches/server/0266-Catch-JsonParseException-in-Entity-and-TE-names.patch index ecc4930408..941966672e 100644 --- a/patches/server/0266-Catch-JsonParseException-in-Entity-and-TE-names.patch +++ b/patches/server/0266-Catch-JsonParseException-in-Entity-and-TE-names.patch @@ -13,7 +13,7 @@ Shulkers) may need to be changed in order for it to re-save properly No more crashing though. diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java -index 77da7a3b51c500ff251f776acc85a752a99fb356..2d11a67bdc82088abf0b3ca134f352f155c8eb1f 100644 +index 39b19310eece90fa5398fbb160593fd4f966627a..cb4379268b191d331c71be44642baac381ffaaf6 100644 --- a/src/main/java/io/papermc/paper/util/MCUtil.java +++ b/src/main/java/io/papermc/paper/util/MCUtil.java @@ -15,6 +15,8 @@ import it.unimi.dsi.fastutil.objects.ReferenceArrayList; @@ -25,7 +25,7 @@ index 77da7a3b51c500ff251f776acc85a752a99fb356..2d11a67bdc82088abf0b3ca134f352f1 import net.minecraft.server.level.ChunkHolder; import net.minecraft.server.level.ChunkMap; import net.minecraft.server.level.DistanceManager; -@@ -534,6 +536,21 @@ public final class MCUtil { +@@ -539,6 +541,21 @@ public final class MCUtil { } } diff --git a/patches/server/0520-Fix-interact-event-not-being-called-in-adventure.patch b/patches/server/0520-Fix-interact-event-not-being-called-in-adventure.patch deleted file mode 100644 index 6e764be370..0000000000 --- a/patches/server/0520-Fix-interact-event-not-being-called-in-adventure.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: TheMolkaPL -Date: Sun, 21 Jun 2020 17:21:46 +0200 -Subject: [PATCH] Fix interact event not being called in adventure - -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 -index 15e98935d333a5538438ed239fe8f4a590d4fe97..d52c0a729a98cac6250d40232cea816f050599f1 100644 ---- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1837,7 +1837,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - MutableComponent ichatmutablecomponent = Component.translatable("build.tooHigh", i - 1).withStyle(ChatFormatting.RED); - - this.player.sendSystemMessage(ichatmutablecomponent, true); -- } else if (enuminteractionresult.shouldSwing()) { -+ } else if (enuminteractionresult.shouldSwing() && !this.player.gameMode.interactResult) { // Paper - this.player.swing(enumhand, true); - } - } -@@ -2473,7 +2473,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - // SPIGOT-5607: Only call interact event if no block or entity is being clicked. Use bukkit ray trace method, because it handles blocks and entities at the same time - org.bukkit.util.RayTraceResult result = this.player.level().getWorld().rayTrace(origin, origin.getDirection(), d3, org.bukkit.FluidCollisionMode.NEVER, false, 0.1, entity -> entity != this.player.getBukkitEntity() && this.player.getBukkitEntity().canSee(entity)); - -- if (result == null) { -+ if (result == null || this.player.gameMode.getGameModeForPlayer() == GameType.ADVENTURE) { // Paper - call PlayerInteractEvent when left-clicking on a block in adventure mode - CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND); - } - diff --git a/patches/server/0520-Fix-interact-event-not-being-called-sometimes.patch b/patches/server/0520-Fix-interact-event-not-being-called-sometimes.patch new file mode 100644 index 0000000000..b43e990cdf --- /dev/null +++ b/patches/server/0520-Fix-interact-event-not-being-called-sometimes.patch @@ -0,0 +1,46 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: TheMolkaPL +Date: Sun, 21 Jun 2020 17:21:46 +0200 +Subject: [PATCH] Fix interact event not being called sometimes + +* Call PlayerInteractEvent when left-clicking on a block in adventure + mode. +* Call PlayerInteractEvent when left-clicking an Entity that is out of + range in adventure/survival (entity reach is 3.0). + +Co-authored-by: Moulberry + +diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index 15e98935d333a5538438ed239fe8f4a590d4fe97..9e8f22b9c5d445afb20a467e94d54c1da3549d50 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -1837,7 +1837,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + MutableComponent ichatmutablecomponent = Component.translatable("build.tooHigh", i - 1).withStyle(ChatFormatting.RED); + + this.player.sendSystemMessage(ichatmutablecomponent, true); +- } else if (enuminteractionresult.shouldSwing()) { ++ } else if (enuminteractionresult.shouldSwing() && !this.player.gameMode.interactResult) { // Paper + this.player.swing(enumhand, true); + } + } +@@ -2471,11 +2471,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + + double d3 = player.gameMode.getGameModeForPlayer() == GameType.CREATIVE ? 5.0D : 4.5D; + // SPIGOT-5607: Only call interact event if no block or entity is being clicked. Use bukkit ray trace method, because it handles blocks and entities at the same time +- org.bukkit.util.RayTraceResult result = this.player.level().getWorld().rayTrace(origin, origin.getDirection(), d3, org.bukkit.FluidCollisionMode.NEVER, false, 0.1, entity -> entity != this.player.getBukkitEntity() && this.player.getBukkitEntity().canSee(entity)); ++ org.bukkit.util.RayTraceResult result = this.player.level().getWorld().rayTrace(origin, origin.getDirection(), d3, org.bukkit.FluidCollisionMode.NEVER, false, 0.0, entity -> entity != this.player.getBukkitEntity() && this.player.getBukkitEntity().canSee(entity)); // Paper - change raySize from 0.1 to 0.0 + + if (result == null) { + CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND); +- } ++ } else { // Paper start - Fix interact event not being called sometimes ++ GameType gameType = this.player.gameMode.getGameModeForPlayer(); ++ if (gameType == GameType.ADVENTURE && result.getHitBlock() != null) { ++ CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, io.papermc.paper.util.MCUtil.toBlockPosition(result.getHitPosition()), org.bukkit.craftbukkit.block.CraftBlock.blockFaceToNotch(result.getHitBlockFace()), this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND); ++ } else if (gameType != GameType.CREATIVE && result.getHitEntity() != null && origin.toVector().distanceSquared(result.getHitPosition()) > 3.0D * 3.0D) { ++ CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND); ++ } ++ } // Paper end + + // Arm swing animation + PlayerAnimationEvent event = new PlayerAnimationEvent(this.getCraftPlayer(), (packet.getHand() == InteractionHand.MAIN_HAND) ? PlayerAnimationType.ARM_SWING : PlayerAnimationType.OFF_ARM_SWING); diff --git a/patches/server/0591-add-RespawnFlags-to-PlayerRespawnEvent.patch b/patches/server/0591-add-RespawnFlags-to-PlayerRespawnEvent.patch index a3cd1e99ed..6064ddb356 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 2f9fe15fe34f44825d21ae840708fcbd89b76732..1f0b8f875a46a025fb387e79cf31d1e329a2e152 100644 +index 736838326f88e87fcb4586bd372661051375fba2..948666f36c4e2f8571e8ceb7703566d9db233616 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2783,7 +2783,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 1c13d78f17..891ac72cc7 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 1f0b8f875a46a025fb387e79cf31d1e329a2e152..0f3f1a9ac004127e58fe18958158826bd648bac9 100644 +index 948666f36c4e2f8571e8ceb7703566d9db233616..27b3b8f53eb0ba62bf17b8b685a04fa4701844c7 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2792,7 +2792,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()) { diff --git a/patches/server/0609-Add-Unix-domain-socket-support.patch b/patches/server/0609-Add-Unix-domain-socket-support.patch index ddbd4f1293..430b2c8d62 100644 --- a/patches/server/0609-Add-Unix-domain-socket-support.patch +++ b/patches/server/0609-Add-Unix-domain-socket-support.patch @@ -91,10 +91,10 @@ index 29a0a720f22f56ca3d844efef1ecde3980fb1c12..838244e3680ea6020701e10bafbde7f5 } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 8a5a8da2962b51e0a8c83ce045eb8e86929c820d..814ee49e8953afb40f16a4f4db4668a3aa9f612d 100644 +index 49e950a285fb9d09ce9fedf0f9ed091ae7a516a7..be48014d35f0f661e8ca829217bd7c7c99b2d5dc 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2627,6 +2627,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2634,6 +2634,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic // Spigot Start public SocketAddress getRawAddress() { diff --git a/patches/server/0615-Add-PlayerKickEvent-causes.patch b/patches/server/0615-Add-PlayerKickEvent-causes.patch index 18245e7e16..24b260aace 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 814ee49e8953afb40f16a4f4db4668a3aa9f612d..d71ccba82dd3ce23c10b519290d80cf42accc748 100644 +index be48014d35f0f661e8ca829217bd7c7c99b2d5dc..8906946d79737b6b03e5570ad3a90c31ff7709fe 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -362,7 +362,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -343,7 +343,7 @@ index 814ee49e8953afb40f16a4f4db4668a3aa9f612d..d71ccba82dd3ce23c10b519290d80cf4 } } -@@ -2599,7 +2609,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2606,7 +2616,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } if (i > 4096) { @@ -352,7 +352,7 @@ index 814ee49e8953afb40f16a4f4db4668a3aa9f612d..d71ccba82dd3ce23c10b519290d80cf4 } } -@@ -2645,7 +2655,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2652,7 +2662,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic // Spigot Start if ( entity == this.player && !this.player.isSpectator() ) { @@ -361,7 +361,7 @@ index 814ee49e8953afb40f16a4f4db4668a3aa9f612d..d71ccba82dd3ce23c10b519290d80cf4 return; } // Spigot End -@@ -2744,7 +2754,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2751,7 +2761,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic // CraftBukkit end } } else { @@ -370,7 +370,7 @@ index 814ee49e8953afb40f16a4f4db4668a3aa9f612d..d71ccba82dd3ce23c10b519290d80cf4 ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString()); } } -@@ -3153,7 +3163,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 814ee49e8953afb40f16a4f4db4668a3aa9f612d..d71ccba82dd3ce23c10b519290d80cf4 return; } } -@@ -3324,7 +3334,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3331,7 +3341,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 814ee49e8953afb40f16a4f4db4668a3aa9f612d..d71ccba82dd3ce23c10b519290d80cf4 }); // Paper end } -@@ -3370,7 +3380,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3377,7 +3387,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex); @@ -397,7 +397,7 @@ index 814ee49e8953afb40f16a4f4db4668a3aa9f612d..d71ccba82dd3ce23c10b519290d80cf4 } } else if (packet.identifier.equals(CUSTOM_UNREGISTER)) { try { -@@ -3380,7 +3390,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3387,7 +3397,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex); @@ -406,7 +406,7 @@ index 814ee49e8953afb40f16a4f4db4668a3aa9f612d..d71ccba82dd3ce23c10b519290d80cf4 } } else { try { -@@ -3398,7 +3408,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3405,7 +3415,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 814ee49e8953afb40f16a4f4db4668a3aa9f612d..d71ccba82dd3ce23c10b519290d80cf4 } } -@@ -3440,7 +3450,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3447,7 +3457,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 814ee49e8953afb40f16a4f4db4668a3aa9f612d..d71ccba82dd3ce23c10b519290d80cf4 } else { try { SignatureValidator signaturevalidator = this.server.getProfileKeySignatureValidator(); -@@ -3453,7 +3463,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3460,7 +3470,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()); diff --git a/patches/server/0636-Adds-PlayerArmSwingEvent.patch b/patches/server/0636-Adds-PlayerArmSwingEvent.patch index f3edb29e30..e8f8b219c9 100644 --- a/patches/server/0636-Adds-PlayerArmSwingEvent.patch +++ b/patches/server/0636-Adds-PlayerArmSwingEvent.patch @@ -5,11 +5,11 @@ 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 463759c91432294701954c49d5978b9e26607b4d..482655fb5d6b84cd7969b1443a8dcd247dd5c9c4 100644 +index 606304a3079eba252ef5e54afcc8935986308c16..cfedfc023c91e714f2ae574539939b73da342108 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2494,7 +2494,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - } +@@ -2501,7 +2501,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + } // Paper end // Arm swing animation - PlayerAnimationEvent event = new PlayerAnimationEvent(this.getCraftPlayer(), (packet.getHand() == InteractionHand.MAIN_HAND) ? PlayerAnimationType.ARM_SWING : PlayerAnimationType.OFF_ARM_SWING); diff --git a/patches/server/0735-Hide-unnecessary-itemmeta-from-clients.patch b/patches/server/0735-Hide-unnecessary-itemmeta-from-clients.patch index 907816e047..20f2fdc55f 100644 --- a/patches/server/0735-Hide-unnecessary-itemmeta-from-clients.patch +++ b/patches/server/0735-Hide-unnecessary-itemmeta-from-clients.patch @@ -18,10 +18,10 @@ index 485ed6cfdb2bb0c06dd639f6cad26cd3112c618d..3212a4cfb0c7e0003981097e813ebbe2 } } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 87c97beb46fdd0b8b78713ce3a64dd98ea3eead0..913cd79d9a382d9464ce20a95f91f0e0122fc71b 100644 +index c199598128c5d1be4f2953e0a67634cb5b22dec8..53a994606253e502e8427f11108c5427b8b6b8b4 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2708,8 +2708,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2715,8 +2715,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic // Refresh the current entity metadata entity.getEntityData().refresh(player); // SPIGOT-7136 - Allays diff --git a/patches/server/0810-Prevent-tile-entity-copies-loading-chunks.patch b/patches/server/0810-Prevent-tile-entity-copies-loading-chunks.patch index b49e491ad5..75d7222fff 100644 --- a/patches/server/0810-Prevent-tile-entity-copies-loading-chunks.patch +++ b/patches/server/0810-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 a5f6fed7774c7ea3b9cae59f72d2ea4b435af641..8df825472dba458d2b61cd176da9fb2128479629 100644 +index 66ac999f9dda064136dea32542b6ff662ff7979c..94af08c8b3bc8e47e0c0f9347b256e02b6a29242 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3311,7 +3311,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3318,7 +3318,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound); if (this.player.level().isLoaded(blockposition)) { diff --git a/patches/server/0813-Pass-ServerLevel-for-gamerule-callbacks.patch b/patches/server/0813-Pass-ServerLevel-for-gamerule-callbacks.patch index ab5a82565d..31e9312196 100644 --- a/patches/server/0813-Pass-ServerLevel-for-gamerule-callbacks.patch +++ b/patches/server/0813-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 8df825472dba458d2b61cd176da9fb2128479629..c585eaab498df14e3e3eb5a2e1f1ad589680aec3 100644 +index 94af08c8b3bc8e47e0c0f9347b256e02b6a29242..c4b67ed3b1bdedc21d75883d9ed6fd0244f3390f 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2901,7 +2901,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/0823-Do-not-accept-invalid-client-settings.patch b/patches/server/0823-Do-not-accept-invalid-client-settings.patch index e2d888b6ff..f1ed4ee86f 100644 --- a/patches/server/0823-Do-not-accept-invalid-client-settings.patch +++ b/patches/server/0823-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 c585eaab498df14e3e3eb5a2e1f1ad589680aec3..45cd5a5026ba5a1221adac51755522357f204b61 100644 +index c4b67ed3b1bdedc21d75883d9ed6fd0244f3390f..c9e29f3e455f9a04ede1713feea885ec71cae5e6 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3453,6 +3453,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3460,6 +3460,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/0908-Properly-resend-entities.patch b/patches/server/0908-Properly-resend-entities.patch index 48460e34fd..db1b7f6ee1 100644 --- a/patches/server/0908-Properly-resend-entities.patch +++ b/patches/server/0908-Properly-resend-entities.patch @@ -82,10 +82,10 @@ index d088479d160dbd2fc90b48a30553be141db8eef2..15add3f4dfd718ec09bb1db4f2222346 public static class DataItem { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index c60906e122e058a19248b0e629531d8ec27146ca..bd3dcc1e126c91644fb0a23423d0f6d1c32f3352 100644 +index 172892b1e40916c26fdaf203543f6d456f69f4c4..62099692e5c19b2061e0b96b7e562452698d5710 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2799,7 +2799,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2806,7 +2806,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic // Entity in bucket - SPIGOT-4048 and SPIGOT-6859a if ((entity instanceof Bucketable && entity instanceof LivingEntity && origItem != null && origItem.asItem() == Items.WATER_BUCKET) && (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem)) { diff --git a/patches/server/0915-Improve-logging-and-errors.patch b/patches/server/0915-Improve-logging-and-errors.patch index 50afaf6da4..e740800baa 100644 --- a/patches/server/0915-Improve-logging-and-errors.patch +++ b/patches/server/0915-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 bd3dcc1e126c91644fb0a23423d0f6d1c32f3352..a53d44f26c3cf51ae4a4219a0e9ecec50666e53d 100644 +index 62099692e5c19b2061e0b96b7e562452698d5710..fc5369ba071434ab4fd6a5192a7cfa6709934a0f 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3588,7 +3588,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3595,7 +3595,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/0924-Use-single-player-info-update-packet-on-join.patch b/patches/server/0924-Use-single-player-info-update-packet-on-join.patch index 70e235b64f..54a1d392bf 100644 --- a/patches/server/0924-Use-single-player-info-update-packet-on-join.patch +++ b/patches/server/0924-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 8cfde7c8b2e45fd2856e7d7bdae75dd379f464f8..65c768a911b2e634ae4c8ee4f210a031731e357d 100644 +index f69e7b30517b6ea328f61426ce55b31ae2f1dfdb..4269fe1437f477411be563ff9b578453ecfd21fe 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3603,7 +3603,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3610,7 +3610,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/0947-Prevent-causing-expired-keys-from-impacting-new-join.patch b/patches/server/0947-Prevent-causing-expired-keys-from-impacting-new-join.patch index aab2e82646..bff86d9c16 100644 --- a/patches/server/0947-Prevent-causing-expired-keys-from-impacting-new-join.patch +++ b/patches/server/0947-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 d9161ccea1c0af96e2718defba68e098c22082a3..1d0e439c00ac4ab72dc656038c9271b1240acc88 100644 +index 57ae23b3f3982f21908d7bbb3be9f7ff20b57e5c..819d043c6cbf304a9348e05bc868d1d821bcc568 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -296,6 +296,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -49,7 +49,7 @@ index d9161ccea1c0af96e2718defba68e098c22082a3..1d0e439c00ac4ab72dc656038c9271b1 } public void resetPosition() { -@@ -3601,6 +3609,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3608,6 +3616,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic private void resetPlayerChatState(RemoteChatSession session) { this.chatSession = session;