From a5be178ac34b26c80dae2c6b7c1f9a685190c2b8 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Mon, 14 Mar 2022 12:28:02 -0700 Subject: [PATCH] Use correct toX/Y/Z in player move packet handling --- ...event-players-from-moving-into-unloa.patch | 51 ++++++++++++------- ...t-allow-digging-into-unloaded-chunks.patch | 4 +- patches/server/0291-Book-Size-Limits.patch | 4 +- .../0299-Implement-Brigadier-Mojang-API.patch | 6 +-- .../0301-Limit-Client-Sign-length-more.patch | 4 +- ...ity-Metadata-for-all-tracked-players.patch | 4 +- ...35-Dont-send-unnecessary-sign-update.patch | 4 +- ...or-when-player-hand-set-to-empty-typ.patch | 4 +- ...PickItem-Packet-and-kick-for-invalid.patch | 4 +- ...12-Prevent-teleporting-dead-entities.patch | 4 +- ...-desync-in-playerconnection-causing-.patch | 4 +- ...implement-PlayerRecipeBookClickEvent.patch | 4 +- ...44-Add-permission-for-command-blocks.patch | 6 +-- ...ld-Difficulty-Remembering-Difficulty.patch | 4 +- ...ove-range-check-for-block-placing-up.patch | 6 +-- patches/server/0480-Brand-support.patch | 8 +-- ...ortation-and-cancel-velocity-if-tele.patch | 6 +-- ...r-large-move-vectors-crashing-server.patch | 31 ++++------- .../server/0540-Limit-recipe-packets.patch | 4 +- ...-event-not-being-called-in-adventure.patch | 6 +-- ...-using-signs-inside-spawn-protection.patch | 4 +- ...ignore-result-of-PlayerEditBookEvent.patch | 4 +- ...ent-suggestion-tooltips-in-AsyncTabC.patch | 6 +-- ...fix-PlayerItemHeldEvent-firing-twice.patch | 4 +- ...d-RespawnFlags-to-PlayerRespawnEvent.patch | 4 +- ...ditions-to-PlayerGameModeChangeEvent.patch | 4 +- .../0660-Add-PlayerKickEvent-causes.patch | 40 +++++++-------- ...nect-for-book-edit-is-called-on-main.patch | 4 +- ...etChunkIfLoadedImmediately-in-places.patch | 15 +----- .../0681-Adds-PlayerArmSwingEvent.patch | 4 +- ...k-event-leave-message-not-being-sent.patch | 6 +-- ...-ServerboundCommandSuggestionPacket-.patch | 4 +- ...on-checking-in-player-move-packet-ha.patch | 20 ++++---- .../0844-Kick-on-main-for-illegal-chars.patch | 4 +- ...cle-movement-from-players-while-tele.patch | 25 +++++++++ 35 files changed, 166 insertions(+), 150 deletions(-) create mode 100644 patches/server/0878-Don-t-allow-vehicle-movement-from-players-while-tele.patch diff --git a/patches/server/0277-Add-option-to-prevent-players-from-moving-into-unloa.patch b/patches/server/0277-Add-option-to-prevent-players-from-moving-into-unloa.patch index 4099e9cc2e..0433ab364a 100644 --- a/patches/server/0277-Add-option-to-prevent-players-from-moving-into-unloa.patch +++ b/patches/server/0277-Add-option-to-prevent-players-from-moving-into-unloa.patch @@ -20,15 +20,31 @@ index 8c50036896602ab6b00979351918878d08c9c75e..a4b20f8616b6fe2046e7a5f00306565b + } } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index f1d2c9274f4968adab689a08c86bea7a16b76b39..189e05daf63060c8f0c1ca56bc23a0c4c8fa0b7a 100644 +index f1d2c9274f4968adab689a08c86bea7a16b76b39..7a0625c4aeb788b791734c13d7bca1e993c5b248 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -534,6 +534,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -497,9 +497,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + double d0 = entity.getX(); + double d1 = entity.getY(); + double d2 = entity.getZ(); +- double d3 = ServerGamePacketListenerImpl.clampHorizontal(packet.getX()); +- double d4 = ServerGamePacketListenerImpl.clampVertical(packet.getY()); +- double d5 = ServerGamePacketListenerImpl.clampHorizontal(packet.getZ()); ++ double d3 = ServerGamePacketListenerImpl.clampHorizontal(packet.getX()); final double toX = d3; // Paper - OBFHELPER ++ double d4 = ServerGamePacketListenerImpl.clampVertical(packet.getY()); final double toY = d4; // Paper - OBFHELPER ++ double d5 = ServerGamePacketListenerImpl.clampHorizontal(packet.getZ()); final double toZ = d5; // Paper - OBFHELPER + float f = Mth.wrapDegrees(packet.getYRot()); + float f1 = Mth.wrapDegrees(packet.getXRot()); + double d6 = d3 - this.vehicleFirstGoodX; +@@ -534,6 +534,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } speed *= 2f; // TODO: Get the speed of the vehicle instead of the player + // Paper start - Prevent moving into unloaded chunks -+ if (player.level.paperConfig.preventMovingIntoUnloadedChunks && worldserver.getChunkIfLoadedImmediately((int) Math.floor(packet.getX()) >> 4, (int) Math.floor(packet.getZ()) >> 4) == null) { ++ if (player.level.paperConfig.preventMovingIntoUnloadedChunks && ( ++ !worldserver.areChunksLoadedForMove(this.player.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(this.player.position()))) || ++ !worldserver.areChunksLoadedForMove(entity.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(entity.position()))) ++ )) { + this.connection.send(new ClientboundMoveVehiclePacket(entity)); + return; + } @@ -37,24 +53,25 @@ index f1d2c9274f4968adab689a08c86bea7a16b76b39..189e05daf63060c8f0c1ca56bc23a0c4 if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) { // CraftBukkit end ServerGamePacketListenerImpl.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", new Object[]{entity.getName().getString(), this.player.getName().getString(), d6, d7, d8}); -@@ -1166,9 +1173,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser - float prevYaw = this.player.getYRot(); - float prevPitch = this.player.getXRot(); - // CraftBukkit end -- double d3 = this.player.getX(); -+ double d3 = this.player.getX(); final double toX = d3; // Paper - OBFHELPER - double d4 = this.player.getY(); -- double d5 = this.player.getZ(); -+ double d5 = this.player.getZ(); final double toZ = d5; // Paper - OBFHELPER - double d6 = this.player.getY(); - double d7 = d0 - this.firstGoodX; - double d8 = d1 - this.firstGoodY; -@@ -1206,6 +1213,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1148,9 +1158,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + this.allowedPlayerTicks = 20; // CraftBukkit + } else { + this.awaitingTeleportTime = this.tickCount; +- double d0 = ServerGamePacketListenerImpl.clampHorizontal(packet.getX(this.player.getX())); +- double d1 = ServerGamePacketListenerImpl.clampVertical(packet.getY(this.player.getY())); +- double d2 = ServerGamePacketListenerImpl.clampHorizontal(packet.getZ(this.player.getZ())); ++ double d0 = ServerGamePacketListenerImpl.clampHorizontal(packet.getX(this.player.getX())); final double toX = d0; // Paper - OBFHELPER ++ double d1 = ServerGamePacketListenerImpl.clampVertical(packet.getY(this.player.getY())); final double toY = d1; ++ double d2 = ServerGamePacketListenerImpl.clampHorizontal(packet.getZ(this.player.getZ())); final double toZ = d2; // Paper - OBFHELPER + float f = Mth.wrapDegrees(packet.getYRot(this.player.getYRot())); + float f1 = Mth.wrapDegrees(packet.getXRot(this.player.getXRot())); + +@@ -1206,6 +1216,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } else { speed = this.player.getAbilities().walkingSpeed * 10f; } + // Paper start - Prevent moving into unloaded chunks -+ if (player.level.paperConfig.preventMovingIntoUnloadedChunks && (this.player.getX() != toX || this.player.getZ() != toZ) && !worldserver.hasChunk((int) Math.floor(toX) >> 4, (int) Math.floor(toZ) >> 4)) { ++ if (player.level.paperConfig.preventMovingIntoUnloadedChunks && (this.player.getX() != toX || this.player.getZ() != toZ) && !worldserver.areChunksLoadedForMove(this.player.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(this.player.position())))) { + this.internalTeleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot(), Collections.emptySet(), true); + return; + } diff --git a/patches/server/0285-Don-t-allow-digging-into-unloaded-chunks.patch b/patches/server/0285-Don-t-allow-digging-into-unloaded-chunks.patch index 391c841f2a..519e7b648a 100644 --- a/patches/server/0285-Don-t-allow-digging-into-unloaded-chunks.patch +++ b/patches/server/0285-Don-t-allow-digging-into-unloaded-chunks.patch @@ -59,10 +59,10 @@ index 91d6885da13138e1def16e1876910ef893ce244d..eb58536e37af9da5e3ae7e43f874a1ef this.level.destroyBlockProgress(this.player.getId(), pos, -1); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 189e05daf63060c8f0c1ca56bc23a0c4c8fa0b7a..7241418074dbd8e0e81e2b679bd317d98fea2e27 100644 +index 7a0625c4aeb788b791734c13d7bca1e993c5b248..69c492e228ad726e51f5644e91e6aac3bf10c758 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1563,7 +1563,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1566,7 +1566,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser case START_DESTROY_BLOCK: case ABORT_DESTROY_BLOCK: case STOP_DESTROY_BLOCK: diff --git a/patches/server/0291-Book-Size-Limits.patch b/patches/server/0291-Book-Size-Limits.patch index 94aa39a5b0..88a8f3548f 100644 --- a/patches/server/0291-Book-Size-Limits.patch +++ b/patches/server/0291-Book-Size-Limits.patch @@ -24,10 +24,10 @@ index 36719c689a24c63e7d9a5b40f8c262c182a31b21..83bf428abd3be89e34cf42638bd1357a private static void asyncChunks() { ConfigurationSection section; diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 7241418074dbd8e0e81e2b679bd317d98fea2e27..d8135a0e644b67ed47972eb3bda517323561a93d 100644 +index 69c492e228ad726e51f5644e91e6aac3bf10c758..167e20fd558aad856c3973ea00ff6a34354aaae5 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1012,6 +1012,45 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1015,6 +1015,45 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @Override public void handleEditBook(ServerboundEditBookPacket packet) { diff --git a/patches/server/0299-Implement-Brigadier-Mojang-API.patch b/patches/server/0299-Implement-Brigadier-Mojang-API.patch index 8eeaded4e5..e99a838f6d 100644 --- a/patches/server/0299-Implement-Brigadier-Mojang-API.patch +++ b/patches/server/0299-Implement-Brigadier-Mojang-API.patch @@ -81,10 +81,10 @@ index f3bbe012541a71ab75c1863990d0c056c62d8c6e..4bc28b66788d06d1446284f5adef6a44 event.getPlayer().getServer().getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index d8135a0e644b67ed47972eb3bda517323561a93d..43bd11679d881b1039db4ed57e70d1ae4d49a107 100644 +index 167e20fd558aad856c3973ea00ff6a34354aaae5..bfce81dec52011230f8a82c64c409f36fb576ee3 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -753,8 +753,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -756,8 +756,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser ParseResults parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack()); this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { @@ -99,7 +99,7 @@ index d8135a0e644b67ed47972eb3bda517323561a93d..43bd11679d881b1039db4ed57e70d1ae }); }); } -@@ -763,7 +767,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -766,7 +770,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser builder = builder.createOffset(builder.getInput().lastIndexOf(' ') + 1); completions.forEach(builder::suggest); diff --git a/patches/server/0301-Limit-Client-Sign-length-more.patch b/patches/server/0301-Limit-Client-Sign-length-more.patch index 9a8c695108..465613e765 100644 --- a/patches/server/0301-Limit-Client-Sign-length-more.patch +++ b/patches/server/0301-Limit-Client-Sign-length-more.patch @@ -22,7 +22,7 @@ it only impacts data sent from the client. Set -DPaper.maxSignLength=XX to change limit or -1 to disable diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 43bd11679d881b1039db4ed57e70d1ae4d49a107..d1c5e6672068b83a22602fecd891d62c15edd55d 100644 +index bfce81dec52011230f8a82c64c409f36fb576ee3..a8a05a2ff0f8900f31a3d137520cd52bd6005342 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -254,6 +254,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -33,7 +33,7 @@ index 43bd11679d881b1039db4ed57e70d1ae4d49a107..d1c5e6672068b83a22602fecd891d62c private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) { -@@ -2889,6 +2890,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2892,6 +2893,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser for (int i = 0; i < signText.size(); ++i) { TextFilter.FilteredText currentLine = signText.get(i); diff --git a/patches/server/0309-Update-entity-Metadata-for-all-tracked-players.patch b/patches/server/0309-Update-entity-Metadata-for-all-tracked-players.patch index 4c83a4f456..3ceb6c00d3 100644 --- a/patches/server/0309-Update-entity-Metadata-for-all-tracked-players.patch +++ b/patches/server/0309-Update-entity-Metadata-for-all-tracked-players.patch @@ -22,10 +22,10 @@ index 861f3790179e18f6192ac8b2fb5d2ecbc54484ad..5e3f489964489e0facc93a823a1cb84b this.broadcast.accept(packet); if (this.entity instanceof ServerPlayer) { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index d1c5e6672068b83a22602fecd891d62c15edd55d..4fcfe654f8199ead2d2309d37f6b5866ba540e45 100644 +index a8a05a2ff0f8900f31a3d137520cd52bd6005342..5d19461d7165f62f157b995efb97d9d05aece258 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2305,7 +2305,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2308,7 +2308,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser if (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem) { // Refresh the current entity metadata diff --git a/patches/server/0335-Dont-send-unnecessary-sign-update.patch b/patches/server/0335-Dont-send-unnecessary-sign-update.patch index 2d33438703..b7f81a12b5 100644 --- a/patches/server/0335-Dont-send-unnecessary-sign-update.patch +++ b/patches/server/0335-Dont-send-unnecessary-sign-update.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Dont send unnecessary sign update diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 070451db9f8dff9bb73ec8d71a1e97e9bdcc9f4c..0de98ce5db144d0b5cde34f62991c46b7aedad8b 100644 +index 5336ec0d30d386854c22ce227dcfd242d351b294..4376236a89f520e29c9227d2117d21884730e3f7 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2884,6 +2884,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2887,6 +2887,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser if (!tileentitysign.isEditable() || !this.player.getUUID().equals(tileentitysign.getPlayerWhoMayEdit())) { ServerGamePacketListenerImpl.LOGGER.warn("Player {} just tried to change non-editable sign", this.player.getName().getString()); diff --git a/patches/server/0337-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch b/patches/server/0337-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch index f93696310b..f9195c0080 100644 --- a/patches/server/0337-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch +++ b/patches/server/0337-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch @@ -7,10 +7,10 @@ Fixes an AssertionError when setting the player's item in hand to null or a new Fixes GH-2718 diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 0de98ce5db144d0b5cde34f62991c46b7aedad8b..f961a0f5b571d86c8d2b57f489b421fbfb01ca3d 100644 +index 4376236a89f520e29c9227d2117d21884730e3f7..a53537d459774a85800753fd6e8e460e2d71477c 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1753,6 +1753,10 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1756,6 +1756,10 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser this.player.getBukkitEntity().updateInventory(); // SPIGOT-2524 return; } diff --git a/patches/server/0407-Validate-PickItem-Packet-and-kick-for-invalid.patch b/patches/server/0407-Validate-PickItem-Packet-and-kick-for-invalid.patch index e6a4d9322b..6971a2ceec 100644 --- a/patches/server/0407-Validate-PickItem-Packet-and-kick-for-invalid.patch +++ b/patches/server/0407-Validate-PickItem-Packet-and-kick-for-invalid.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Validate PickItem Packet and kick for invalid diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index a041e73798e2c52026a8b9b3ff5c41bb7fa7263d..850ffa36da69abea61e9fd20145a9dbe3f8a5f18 100644 +index 3c45c6c6f10408ddcc077787865c68a323c6e901..fd53b03b69a929793c3115e8ee4dfd502d15125b 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -881,7 +881,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -884,7 +884,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @Override public void handlePickItem(ServerboundPickItemPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); diff --git a/patches/server/0412-Prevent-teleporting-dead-entities.patch b/patches/server/0412-Prevent-teleporting-dead-entities.patch index e9454c60f1..8b7d73350a 100644 --- a/patches/server/0412-Prevent-teleporting-dead-entities.patch +++ b/patches/server/0412-Prevent-teleporting-dead-entities.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent teleporting dead entities diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 850ffa36da69abea61e9fd20145a9dbe3f8a5f18..7c7cd7e9ee014f5b822a94d394ab1978dcff7beb 100644 +index fd53b03b69a929793c3115e8ee4dfd502d15125b..e1ae88a2c71a2fb804a8d7e467eb1232d10b4a53 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1524,6 +1524,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1527,6 +1527,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } private void internalTeleport(double d0, double d1, double d2, float f, float f1, Set set, boolean flag) { diff --git a/patches/server/0439-Prevent-position-desync-in-playerconnection-causing-.patch b/patches/server/0439-Prevent-position-desync-in-playerconnection-causing-.patch index e5cf4e564f..dde93278c0 100644 --- a/patches/server/0439-Prevent-position-desync-in-playerconnection-causing-.patch +++ b/patches/server/0439-Prevent-position-desync-in-playerconnection-causing-.patch @@ -14,10 +14,10 @@ behaviour, we need to move all of this dangerous logic outside of the move call and into an appropriate place in the tick method. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 7c7cd7e9ee014f5b822a94d394ab1978dcff7beb..24c605ab53c45daa8f6e2b4e8004e056b38d75a5 100644 +index e1ae88a2c71a2fb804a8d7e467eb1232d10b4a53..ce8cf709797cd996dacffd2e527f7a4dc65a5562 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1338,6 +1338,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1341,6 +1341,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser this.player.move(MoverType.PLAYER, new Vec3(d7, d8, d9)); this.player.onGround = packet.isOnGround(); // CraftBukkit - SPIGOT-5810, SPIGOT-5835, SPIGOT-6828: reset by this.player.move diff --git a/patches/server/0442-Add-and-implement-PlayerRecipeBookClickEvent.patch b/patches/server/0442-Add-and-implement-PlayerRecipeBookClickEvent.patch index a2b186db62..0b1ee540e9 100644 --- a/patches/server/0442-Add-and-implement-PlayerRecipeBookClickEvent.patch +++ b/patches/server/0442-Add-and-implement-PlayerRecipeBookClickEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add and implement PlayerRecipeBookClickEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 24c605ab53c45daa8f6e2b4e8004e056b38d75a5..2d02799d99e0eea9327820fe8a014910c346ec21 100644 +index ce8cf709797cd996dacffd2e527f7a4dc65a5562..c38858f0ca67d2e87985bdebf39d26286409636c 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2801,9 +2801,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2804,9 +2804,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); this.player.resetLastActionTime(); if (!this.player.isSpectator() && this.player.containerMenu.containerId == packet.getContainerId() && this.player.containerMenu instanceof RecipeBookMenu) { diff --git a/patches/server/0444-Add-permission-for-command-blocks.patch b/patches/server/0444-Add-permission-for-command-blocks.patch index 02e3126cfe..80735b4855 100644 --- a/patches/server/0444-Add-permission-for-command-blocks.patch +++ b/patches/server/0444-Add-permission-for-command-blocks.patch @@ -18,10 +18,10 @@ index d4f57fde2f02071dfde08cb2a5c8359984056aef..176e5bbac94cf39805dcacfcae3a3daa return false; } else if (this.player.blockActionRestricted(this.level, pos, this.gameModeForPlayer)) { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 2d02799d99e0eea9327820fe8a014910c346ec21..770f11ad28f17427306e79509ecd192555854f1e 100644 +index c38858f0ca67d2e87985bdebf39d26286409636c..3f9c4295db46f3ff6e9c7bc241eb6b0926bd5054 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -792,7 +792,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -795,7 +795,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); if (!this.server.isCommandBlockEnabled()) { this.player.sendMessage(new TranslatableComponent("advMode.notEnabled"), Util.NIL_UUID); @@ -30,7 +30,7 @@ index 2d02799d99e0eea9327820fe8a014910c346ec21..770f11ad28f17427306e79509ecd1925 this.player.sendMessage(new TranslatableComponent("advMode.notAllowed"), Util.NIL_UUID); } else { BaseCommandBlock commandblocklistenerabstract = null; -@@ -859,7 +859,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -862,7 +862,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); if (!this.server.isCommandBlockEnabled()) { this.player.sendMessage(new TranslatableComponent("advMode.notEnabled"), Util.NIL_UUID); diff --git a/patches/server/0446-Fix-Per-World-Difficulty-Remembering-Difficulty.patch b/patches/server/0446-Fix-Per-World-Difficulty-Remembering-Difficulty.patch index 560761824a..bd5d7b8bf6 100644 --- a/patches/server/0446-Fix-Per-World-Difficulty-Remembering-Difficulty.patch +++ b/patches/server/0446-Fix-Per-World-Difficulty-Remembering-Difficulty.patch @@ -89,10 +89,10 @@ index a7a3c17cf97486f9f1af0cdc00686c22b37449b6..5a4eeb46543d9458e309e2d4cc56086b playerlist.sendPlayerPermissionLevel(this); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 770f11ad28f17427306e79509ecd192555854f1e..e3cc64933133d086bb14b6a941f6dd30d31d970c 100644 +index 3f9c4295db46f3ff6e9c7bc241eb6b0926bd5054..aae07a82b8fa9d504e3f457bacb78e159d08ee41 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3059,7 +3059,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -3062,7 +3062,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser public void handleChangeDifficulty(ServerboundChangeDifficultyPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); if (this.player.hasPermissions(2) || this.isSingleplayerOwner()) { diff --git a/patches/server/0471-Move-range-check-for-block-placing-up.patch b/patches/server/0471-Move-range-check-for-block-placing-up.patch index cce90f624f..dfa56cef3a 100644 --- a/patches/server/0471-Move-range-check-for-block-placing-up.patch +++ b/patches/server/0471-Move-range-check-for-block-placing-up.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Move range check for block placing up diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index e3cc64933133d086bb14b6a941f6dd30d31d970c..baa80ce55e815b179fcf55b3cda3f59d3efe1354 100644 +index aae07a82b8fa9d504e3f457bacb78e159d08ee41..3b2e91b7ba431c4096d8ea03d8475bf30b46d0ac 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1682,6 +1682,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1685,6 +1685,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } // Spigot end @@ -25,7 +25,7 @@ index e3cc64933133d086bb14b6a941f6dd30d31d970c..baa80ce55e815b179fcf55b3cda3f59d @Override public void handleUseItemOn(ServerboundUseItemOnPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); -@@ -1695,6 +1705,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1698,6 +1708,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser BlockPos blockposition = movingobjectpositionblock.getBlockPos(); Vec3 vec3d1 = vec3d.subtract(Vec3.atCenterOf(blockposition)); diff --git a/patches/server/0480-Brand-support.patch b/patches/server/0480-Brand-support.patch index f06bd36173..e380f2abca 100644 --- a/patches/server/0480-Brand-support.patch +++ b/patches/server/0480-Brand-support.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Brand support diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index baa80ce55e815b179fcf55b3cda3f59d3efe1354..4b6f6bf8c79f2d496218ab02833c25242beb1067 100644 +index 3b2e91b7ba431c4096d8ea03d8475bf30b46d0ac..32dac718c49ab6693aae8a56991792dfe7d4ff87 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -38,6 +38,7 @@ import net.minecraft.nbt.CompoundTag; @@ -25,7 +25,7 @@ index baa80ce55e815b179fcf55b3cda3f59d3efe1354..4b6f6bf8c79f2d496218ab02833c2524 public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) { this.server = server; this.connection = connection; -@@ -3033,6 +3036,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -3036,6 +3039,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser private static final ResourceLocation CUSTOM_REGISTER = new ResourceLocation("register"); private static final ResourceLocation CUSTOM_UNREGISTER = new ResourceLocation("unregister"); @@ -34,7 +34,7 @@ index baa80ce55e815b179fcf55b3cda3f59d3efe1354..4b6f6bf8c79f2d496218ab02833c2524 @Override public void handleCustomPayload(ServerboundCustomPayloadPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); -@@ -3060,6 +3065,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -3063,6 +3068,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser try { byte[] data = new byte[packet.data.readableBytes()]; packet.data.readBytes(data); @@ -50,7 +50,7 @@ index baa80ce55e815b179fcf55b3cda3f59d3efe1354..4b6f6bf8c79f2d496218ab02833c2524 this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data); } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex); -@@ -3069,6 +3083,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -3072,6 +3086,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } diff --git a/patches/server/0499-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch b/patches/server/0499-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch index 2624dd65c2..d9de1c8b61 100644 --- a/patches/server/0499-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch +++ b/patches/server/0499-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch @@ -9,10 +9,10 @@ as this is how Vanilla teleports entities. Cancel any pending motion when teleported. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 4b6f6bf8c79f2d496218ab02833c25242beb1067..b7f876a00abdedcf6822b7dae61144e7fd94fdb3 100644 +index 32dac718c49ab6693aae8a56991792dfe7d4ff87..fd936bc83b325f8cd7ead03afb9ef2a966c01c06 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -685,7 +685,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -688,7 +688,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser public void handleAcceptTeleportPacket(ServerboundAcceptTeleportationPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); if (packet.getId() == this.awaitingTeleport && this.awaitingPositionFromClient != null) { // CraftBukkit @@ -21,7 +21,7 @@ index 4b6f6bf8c79f2d496218ab02833c25242beb1067..b7f876a00abdedcf6822b7dae61144e7 this.lastGoodX = this.awaitingPositionFromClient.x; this.lastGoodY = this.awaitingPositionFromClient.y; this.lastGoodZ = this.awaitingPositionFromClient.z; -@@ -1569,7 +1569,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1572,7 +1572,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // CraftBukkit end this.awaitingTeleportTime = this.tickCount; diff --git a/patches/server/0510-Fix-for-large-move-vectors-crashing-server.patch b/patches/server/0510-Fix-for-large-move-vectors-crashing-server.patch index ce662351de..a8c4264295 100644 --- a/patches/server/0510-Fix-for-large-move-vectors-crashing-server.patch +++ b/patches/server/0510-Fix-for-large-move-vectors-crashing-server.patch @@ -6,28 +6,23 @@ Subject: [PATCH] Fix for large move vectors crashing server Check movement distance also based on current position. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index b7f876a00abdedcf6822b7dae61144e7fd94fdb3..def6838c09a859e5b3297b8251432f921720235e 100644 +index fd936bc83b325f8cd7ead03afb9ef2a966c01c06..341137b1cba0432c246006dd56cd63dab2b82ae8 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -508,20 +508,31 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -508,9 +508,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser if (entity != this.player && entity.getControllingPassenger() == this.player && entity == this.lastVehicle) { ServerLevel worldserver = this.player.getLevel(); - double d0 = entity.getX(); - double d1 = entity.getY(); - double d2 = entity.getZ(); -- double d3 = ServerGamePacketListenerImpl.clampHorizontal(packet.getX()); -- double d4 = ServerGamePacketListenerImpl.clampVertical(packet.getY()); -- double d5 = ServerGamePacketListenerImpl.clampHorizontal(packet.getZ()); + double d0 = entity.getX();final double fromX = d0; // Paper - OBFHELPER + double d1 = entity.getY();final double fromY = d1; // Paper - OBFHELPER + double d2 = entity.getZ();final double fromZ = d2; // Paper - OBFHELPER -+ double d3 = ServerGamePacketListenerImpl.clampHorizontal(packet.getX());final double toX = d3; // Paper - OBFHELPER -+ double d4 = ServerGamePacketListenerImpl.clampVertical(packet.getY());final double toY = d4; // Paper - OBFHELPER -+ double d5 = ServerGamePacketListenerImpl.clampHorizontal(packet.getZ());final double toZ = d5; // Paper - OBFHELPER - float f = Mth.wrapDegrees(packet.getYRot()); - float f1 = Mth.wrapDegrees(packet.getXRot()); - double d6 = d3 - this.vehicleFirstGoodX; + double d3 = ServerGamePacketListenerImpl.clampHorizontal(packet.getX()); final double toX = d3; // Paper - OBFHELPER + double d4 = ServerGamePacketListenerImpl.clampVertical(packet.getY()); final double toY = d4; // Paper - OBFHELPER + double d5 = ServerGamePacketListenerImpl.clampHorizontal(packet.getZ()); final double toZ = d5; // Paper - OBFHELPER +@@ -520,8 +520,19 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser double d7 = d4 - this.vehicleFirstGoodY; double d8 = d5 - this.vehicleFirstGoodZ; double d9 = entity.getDeltaMovement().lengthSqr(); @@ -49,7 +44,7 @@ index b7f876a00abdedcf6822b7dae61144e7fd94fdb3..def6838c09a859e5b3297b8251432f92 // CraftBukkit start - handle custom speeds and skipped ticks this.allowedPlayerTicks += (System.currentTimeMillis() / 50) - this.lastTick; -@@ -564,9 +575,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -567,9 +578,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser boolean flag = worldserver.noCollision(entity, entity.getBoundingBox().deflate(0.0625D)); @@ -62,15 +57,7 @@ index b7f876a00abdedcf6822b7dae61144e7fd94fdb3..def6838c09a859e5b3297b8251432f92 boolean flag1 = entity.verticalCollisionBelow; entity.move(MoverType.PLAYER, new Vec3(d6, d7, d8)); -@@ -1242,14 +1253,25 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser - float prevPitch = this.player.getXRot(); - // CraftBukkit end - double d3 = this.player.getX(); final double toX = d3; // Paper - OBFHELPER -- double d4 = this.player.getY(); -+ double d4 = this.player.getY(); final double toY = d4; // Paper - OBFHELPER - double d5 = this.player.getZ(); final double toZ = d5; // Paper - OBFHELPER - double d6 = this.player.getY(); - double d7 = d0 - this.firstGoodX; +@@ -1252,7 +1263,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser double d8 = d1 - this.firstGoodY; double d9 = d2 - this.firstGoodZ; double d10 = this.player.getDeltaMovement().lengthSqr(); @@ -90,7 +77,7 @@ index b7f876a00abdedcf6822b7dae61144e7fd94fdb3..def6838c09a859e5b3297b8251432f92 if (this.player.isSleeping()) { if (d11 > 1.0D) { -@@ -1301,9 +1323,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1304,9 +1326,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser AABB axisalignedbb = this.player.getBoundingBox(); diff --git a/patches/server/0540-Limit-recipe-packets.patch b/patches/server/0540-Limit-recipe-packets.patch index 7856d5e929..5fab409840 100644 --- a/patches/server/0540-Limit-recipe-packets.patch +++ b/patches/server/0540-Limit-recipe-packets.patch @@ -23,7 +23,7 @@ index d58429ef5c7e866ce36a00fd55462cb024043a71..7413cbbcf0ab572483adc0ab91597859 public static boolean velocityOnlineMode; public static byte[] velocitySecretKey; diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 8095858836774dd2b34c0361408a4adfec3c3bc6..9dd934166b96b9379f549d52386fc83894079212 100644 +index 87fb3ecc9f0365dafccdd17ff51ba3d6a60a00f8..f8275d35b198665b32696a1fb49e1821c383705d 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -230,6 +230,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -42,7 +42,7 @@ index 8095858836774dd2b34c0361408a4adfec3c3bc6..9dd934166b96b9379f549d52386fc838 /* Use thread-safe field access instead if (this.chatSpamTickCount > 0) { --this.chatSpamTickCount; -@@ -2843,6 +2845,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2846,6 +2848,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @Override public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) { diff --git a/patches/server/0557-Fix-interact-event-not-being-called-in-adventure.patch b/patches/server/0557-Fix-interact-event-not-being-called-in-adventure.patch index 49080fbb8e..e28d7dde5c 100644 --- a/patches/server/0557-Fix-interact-event-not-being-called-in-adventure.patch +++ b/patches/server/0557-Fix-interact-event-not-being-called-in-adventure.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix interact event not being called in adventure Call PlayerInteractEvent when left-clicking on a block in adventure mode diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 9dd934166b96b9379f549d52386fc83894079212..1bd25f0d74ab3a018b56df7a517e661b9af32341 100644 +index f8275d35b198665b32696a1fb49e1821c383705d..cf01bc6e0b0f626647699e00e6839930be6afb23 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1760,7 +1760,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1763,7 +1763,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser MutableComponent ichatmutablecomponent = (new TranslatableComponent("build.tooHigh", new Object[]{i - 1})).withStyle(ChatFormatting.RED); this.player.sendMessage(ichatmutablecomponent, ChatType.GAME_INFO, Util.NIL_UUID); @@ -18,7 +18,7 @@ index 9dd934166b96b9379f549d52386fc83894079212..1bd25f0d74ab3a018b56df7a517e661b this.player.swing(enumhand, true); } } -@@ -2238,7 +2238,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2241,7 +2241,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser Vec3 vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3); HitResult movingobjectposition = this.player.level.clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, this.player)); diff --git a/patches/server/0608-Allow-using-signs-inside-spawn-protection.patch b/patches/server/0608-Allow-using-signs-inside-spawn-protection.patch index 0775386a0c..578eda8bf0 100644 --- a/patches/server/0608-Allow-using-signs-inside-spawn-protection.patch +++ b/patches/server/0608-Allow-using-signs-inside-spawn-protection.patch @@ -19,10 +19,10 @@ index cdcb877e374bcd2dd944c754bfc91e23ef6986ae..3ea410faba8412fa5aa1c1b6bcdd3aed + } } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 1bd25f0d74ab3a018b56df7a517e661b9af32341..ecd5068a8bfc8d0d4339cf7d6b8da8f81371bbfc 100644 +index cf01bc6e0b0f626647699e00e6839930be6afb23..cb0c6202b25933aa7770060873c7873f9790f5a1 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1752,7 +1752,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1755,7 +1755,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser int i = this.player.level.getMaxBuildHeight(); if (blockposition.getY() < i) { diff --git a/patches/server/0616-Don-t-ignore-result-of-PlayerEditBookEvent.patch b/patches/server/0616-Don-t-ignore-result-of-PlayerEditBookEvent.patch index a80d297e37..5baf1db8d2 100644 --- a/patches/server/0616-Don-t-ignore-result-of-PlayerEditBookEvent.patch +++ b/patches/server/0616-Don-t-ignore-result-of-PlayerEditBookEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Don't ignore result of PlayerEditBookEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index ecd5068a8bfc8d0d4339cf7d6b8da8f81371bbfc..bfe47c83a94a3f8024cfdefaecdb149a2a3a2346 100644 +index cb0c6202b25933aa7770060873c7873f9790f5a1..444c92e067dd20d0e2e9e1b3d249f2a9a8d86c4f 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1187,7 +1187,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1190,7 +1190,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } itemstack.addTagElement("pages", nbttaglist); diff --git a/patches/server/0619-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch b/patches/server/0619-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch index 1935ce4852..7e63a8f446 100644 --- a/patches/server/0619-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch +++ b/patches/server/0619-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Allow for Component suggestion tooltips in diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index bfe47c83a94a3f8024cfdefaecdb149a2a3a2346..8c202a0ecbff003a4cb6cd1cbc3cf9ba77e37128 100644 +index 444c92e067dd20d0e2e9e1b3d249f2a9a8d86c4f..4b07e134ce85e4650896e5a75c33321aa36fa18f 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -767,12 +767,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -770,12 +770,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // Paper start - async tab completion com.destroystokyo.paper.event.server.AsyncTabCompleteEvent event; @@ -24,7 +24,7 @@ index bfe47c83a94a3f8024cfdefaecdb149a2a3a2346..8c202a0ecbff003a4cb6cd1cbc3cf9ba // If the event isn't handled, we can assume that we have no completions, and so we'll ask the server if (!event.isHandled()) { if (!event.isCancelled()) { -@@ -791,10 +790,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -794,10 +793,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser }); } } else if (!completions.isEmpty()) { diff --git a/patches/server/0629-fix-PlayerItemHeldEvent-firing-twice.patch b/patches/server/0629-fix-PlayerItemHeldEvent-firing-twice.patch index 7a332176ff..91971abb9e 100644 --- a/patches/server/0629-fix-PlayerItemHeldEvent-firing-twice.patch +++ b/patches/server/0629-fix-PlayerItemHeldEvent-firing-twice.patch @@ -5,10 +5,10 @@ Subject: [PATCH] fix PlayerItemHeldEvent firing twice diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 8c202a0ecbff003a4cb6cd1cbc3cf9ba77e37128..f9b817f2ec0f1c390393c4795c28de193636ca68 100644 +index 4b07e134ce85e4650896e5a75c33321aa36fa18f..06cda3132d811019a94ea8212e6569da1be3ac62 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1959,6 +1959,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1962,6 +1962,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); if (this.player.isImmobile()) return; // CraftBukkit if (packet.getSlot() >= 0 && packet.getSlot() < Inventory.getSelectionSize()) { diff --git a/patches/server/0636-add-RespawnFlags-to-PlayerRespawnEvent.patch b/patches/server/0636-add-RespawnFlags-to-PlayerRespawnEvent.patch index 5fff43eeb8..fba50c127c 100644 --- a/patches/server/0636-add-RespawnFlags-to-PlayerRespawnEvent.patch +++ b/patches/server/0636-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 f9b817f2ec0f1c390393c4795c28de193636ca68..6764cfef07169db97662177837aa7815f7346a5d 100644 +index 06cda3132d811019a94ea8212e6569da1be3ac62..63a459e13e183107c4626f1df36c795af4b4948c 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2497,7 +2497,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2500,7 +2500,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser case PERFORM_RESPAWN: if (this.player.wonGame) { this.player.wonGame = false; diff --git a/patches/server/0649-additions-to-PlayerGameModeChangeEvent.patch b/patches/server/0649-additions-to-PlayerGameModeChangeEvent.patch index 769f85c58f..3b13804453 100644 --- a/patches/server/0649-additions-to-PlayerGameModeChangeEvent.patch +++ b/patches/server/0649-additions-to-PlayerGameModeChangeEvent.patch @@ -126,10 +126,10 @@ index f97d97426144527cff9ebb91b26fe8541a9c6d9b..b6eef41079120fffd63f06f681378b1b } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 6764cfef07169db97662177837aa7815f7346a5d..1dce75b762c2b9134819bcd66d14fc07826dc48f 100644 +index 63a459e13e183107c4626f1df36c795af4b4948c..2eee1e57895f53416b7c5820f5fd59e8555387c1 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2506,7 +2506,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2509,7 +2509,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser this.player = this.server.getPlayerList().respawn(this.player, false); if (this.server.isHardcore()) { diff --git a/patches/server/0660-Add-PlayerKickEvent-causes.patch b/patches/server/0660-Add-PlayerKickEvent-causes.patch index 3823cfc3c7..11113bfe4a 100644 --- a/patches/server/0660-Add-PlayerKickEvent-causes.patch +++ b/patches/server/0660-Add-PlayerKickEvent-causes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerKickEvent causes diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 4a92ea5d6db5873277708d9fba6e1dd04205da78..65d5d96a687712d87bbc61d85f80438811bae07d 100644 +index b8ffd95bbad81521b9f91e83f63188553c09d4bd..8aaf73d24ddff65c45eeb18d573e20fb8a1439a5 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -2117,7 +2117,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop com.destroystokyo.paper.PaperConfig.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper start - split and make configurable @@ -156,7 +156,7 @@ index 1dce75b762c2b9134819bcd66d14fc07826dc48f..feb3fafd3e958ae86aa95c68b5118aeb return; } // Paper end -@@ -906,7 +914,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -909,7 +917,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // 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 +165,7 @@ index 1dce75b762c2b9134819bcd66d14fc07826dc48f..feb3fafd3e958ae86aa95c68b5118aeb return; } this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed -@@ -1071,7 +1079,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1074,7 +1082,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser 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 +174,7 @@ index 1dce75b762c2b9134819bcd66d14fc07826dc48f..feb3fafd3e958ae86aa95c68b5118aeb return; } byteTotal += byteLength; -@@ -1094,14 +1102,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1097,14 +1105,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser 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,7 +191,7 @@ index 1dce75b762c2b9134819bcd66d14fc07826dc48f..feb3fafd3e958ae86aa95c68b5118aeb return; } this.lastBookTick = MinecraftServer.currentTick; -@@ -1225,7 +1233,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1228,7 +1236,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser 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))) { @@ -200,7 +200,7 @@ index 1dce75b762c2b9134819bcd66d14fc07826dc48f..feb3fafd3e958ae86aa95c68b5118aeb } else { ServerLevel worldserver = this.player.getLevel(); -@@ -1652,7 +1660,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1655,7 +1663,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser this.dropCount++; if (this.dropCount >= 20) { ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " dropped their items too quickly!"); @@ -209,7 +209,7 @@ index 1dce75b762c2b9134819bcd66d14fc07826dc48f..feb3fafd3e958ae86aa95c68b5118aeb return; } } -@@ -1871,7 +1879,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1874,7 +1882,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser 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 +218,7 @@ index 1dce75b762c2b9134819bcd66d14fc07826dc48f..feb3fafd3e958ae86aa95c68b5118aeb } // Paper start PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packet.action.ordinal()]; -@@ -1976,7 +1984,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1979,7 +1987,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser this.player.resetLastActionTime(); } else { ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString()); @@ -227,7 +227,7 @@ index 1dce75b762c2b9134819bcd66d14fc07826dc48f..feb3fafd3e958ae86aa95c68b5118aeb } } -@@ -1992,7 +2000,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1995,7 +2003,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser for (int i = 0; i < s.length(); ++i) { if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) { @@ -236,7 +236,7 @@ index 1dce75b762c2b9134819bcd66d14fc07826dc48f..feb3fafd3e958ae86aa95c68b5118aeb return; } } -@@ -2065,7 +2073,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2068,7 +2076,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser Waitable waitable = new Waitable() { @Override protected Object evaluate() { @@ -245,7 +245,7 @@ index 1dce75b762c2b9134819bcd66d14fc07826dc48f..feb3fafd3e958ae86aa95c68b5118aeb return null; } }; -@@ -2080,7 +2088,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2083,7 +2091,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser throw new RuntimeException(e); } } else { @@ -254,7 +254,7 @@ index 1dce75b762c2b9134819bcd66d14fc07826dc48f..feb3fafd3e958ae86aa95c68b5118aeb } // CraftBukkit end } -@@ -2353,7 +2361,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2356,7 +2364,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // Spigot Start if ( entity == this.player && !this.player.isSpectator() ) { @@ -263,7 +263,7 @@ index 1dce75b762c2b9134819bcd66d14fc07826dc48f..feb3fafd3e958ae86aa95c68b5118aeb return; } // Spigot End -@@ -2448,7 +2456,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2451,7 +2459,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } // CraftBukkit end } else { @@ -272,7 +272,7 @@ index 1dce75b762c2b9134819bcd66d14fc07826dc48f..feb3fafd3e958ae86aa95c68b5118aeb ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString()); } } -@@ -2854,7 +2862,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2857,7 +2865,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // Paper start if (!org.bukkit.Bukkit.isPrimaryThread()) { if (recipeSpamPackets.addAndGet(com.destroystokyo.paper.PaperConfig.autoRecipeIncrement) > com.destroystokyo.paper.PaperConfig.autoRecipeLimit) { @@ -281,7 +281,7 @@ index 1dce75b762c2b9134819bcd66d14fc07826dc48f..feb3fafd3e958ae86aa95c68b5118aeb return; } } -@@ -3042,7 +3050,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -3045,7 +3053,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } else if (!this.isSingleplayerOwner()) { // Paper start - This needs to be handled on the main thread for plugins server.submit(() -> { @@ -290,7 +290,7 @@ index 1dce75b762c2b9134819bcd66d14fc07826dc48f..feb3fafd3e958ae86aa95c68b5118aeb }); // Paper end } -@@ -3088,7 +3096,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -3091,7 +3099,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex); @@ -299,7 +299,7 @@ index 1dce75b762c2b9134819bcd66d14fc07826dc48f..feb3fafd3e958ae86aa95c68b5118aeb } } else if (packet.identifier.equals(CUSTOM_UNREGISTER)) { try { -@@ -3098,7 +3106,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -3101,7 +3109,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex); @@ -308,7 +308,7 @@ index 1dce75b762c2b9134819bcd66d14fc07826dc48f..feb3fafd3e958ae86aa95c68b5118aeb } } else { try { -@@ -3116,7 +3124,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -3119,7 +3127,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data); } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex); diff --git a/patches/server/0677-Ensure-disconnect-for-book-edit-is-called-on-main.patch b/patches/server/0677-Ensure-disconnect-for-book-edit-is-called-on-main.patch index 61eab94f77..2f9a6afb51 100644 --- a/patches/server/0677-Ensure-disconnect-for-book-edit-is-called-on-main.patch +++ b/patches/server/0677-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 feb3fafd3e958ae86aa95c68b5118aebd6bf45e4..12fa5b4a5d9997c442dbc17e77a5fb320f9f2ed1 100644 +index f5231c0e0352bb0e8dd89a3a7db756b4a4b0427e..a4a565a83b67a652e045e0af80d8a4d30bd0c7fe 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1109,7 +1109,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1112,7 +1112,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // Paper end // CraftBukkit start if (this.lastBookTick + 20 > MinecraftServer.currentTick) { diff --git a/patches/server/0679-Use-getChunkIfLoadedImmediately-in-places.patch b/patches/server/0679-Use-getChunkIfLoadedImmediately-in-places.patch index 99213d6d81..254153e83b 100644 --- a/patches/server/0679-Use-getChunkIfLoadedImmediately-in-places.patch +++ b/patches/server/0679-Use-getChunkIfLoadedImmediately-in-places.patch @@ -8,7 +8,7 @@ ticket level 33 (yes getChunkIfLoaded will actually perform a chunk load in that case). diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 3864f6756f07c96607b277e250d906223cf178f6..6a526474ca4683b8df3d4a61950e661963cbc737 100644 +index c37934d1319dcd5e9cbba8d4f08550656354cf30..8fbf0b2f6bd0bdc9eef8e9b950a81e258e1cc552 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -215,7 +215,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -20,19 +20,6 @@ index 3864f6756f07c96607b277e250d906223cf178f6..6a526474ca4683b8df3d4a61950e6619 } @Override -diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 12fa5b4a5d9997c442dbc17e77a5fb320f9f2ed1..4cfc463818964acbd695e6cb4767883835b90eab 100644 ---- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1320,7 +1320,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser - speed = this.player.getAbilities().walkingSpeed * 10f; - } - // Paper start - Prevent moving into unloaded chunks -- if (player.level.paperConfig.preventMovingIntoUnloadedChunks && (this.player.getX() != toX || this.player.getZ() != toZ) && !worldserver.hasChunk((int) Math.floor(toX) >> 4, (int) Math.floor(toZ) >> 4)) { -+ if (player.level.paperConfig.preventMovingIntoUnloadedChunks && (this.player.getX() != toX || this.player.getZ() != toZ) && worldserver.getChunkIfLoadedImmediately((int) Math.floor(toX) >> 4, (int) Math.floor(toZ) >> 4) == null) { // Paper - use getIfLoadedImmediately - this.internalTeleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot(), Collections.emptySet(), true); - return; - } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java index c3ae2b4b5b4eb14d24f2c15a7e8ace8ebee84c1a..c293531a6913b365c3bf804d6d0bfae24378dc43 100644 --- a/src/main/java/net/minecraft/world/level/Level.java diff --git a/patches/server/0681-Adds-PlayerArmSwingEvent.patch b/patches/server/0681-Adds-PlayerArmSwingEvent.patch index 0ac17873c1..43377e357c 100644 --- a/patches/server/0681-Adds-PlayerArmSwingEvent.patch +++ b/patches/server/0681-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 4cfc463818964acbd695e6cb4767883835b90eab..a11647ab2b75870c6d7366260865c261e5cfd52d 100644 +index a4a565a83b67a652e045e0af80d8a4d30bd0c7fe..8a60c81c80ecf6c8d29cc1e24e9a8d63c5edaecb 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2257,7 +2257,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2260,7 +2260,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } // Arm swing animation diff --git a/patches/server/0682-Fixes-kick-event-leave-message-not-being-sent.patch b/patches/server/0682-Fixes-kick-event-leave-message-not-being-sent.patch index 316e9e0de5..cdda9796f2 100644 --- a/patches/server/0682-Fixes-kick-event-leave-message-not-being-sent.patch +++ b/patches/server/0682-Fixes-kick-event-leave-message-not-being-sent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fixes kick event leave message not being sent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index a11647ab2b75870c6d7366260865c261e5cfd52d..aaa1466c420e346d20aace4115f2d83cb9fb2d0b 100644 +index 8a60c81c80ecf6c8d29cc1e24e9a8d63c5edaecb..d9eec6be067b858001c31f25788a63f2d50051ce 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -455,7 +455,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -17,7 +17,7 @@ index a11647ab2b75870c6d7366260865c261e5cfd52d..aaa1466c420e346d20aace4115f2d83c this.connection.setReadOnly(); MinecraftServer minecraftserver = this.server; Connection networkmanager = this.connection; -@@ -1904,6 +1904,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1907,6 +1907,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @Override public void onDisconnect(Component reason) { @@ -29,7 +29,7 @@ index a11647ab2b75870c6d7366260865c261e5cfd52d..aaa1466c420e346d20aace4115f2d83c // CraftBukkit start - Rarely it would send a disconnect line twice if (this.processedDisconnect) { return; -@@ -1920,7 +1925,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1923,7 +1928,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser this.player.disconnect(); // Paper start - Adventure diff --git a/patches/server/0777-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch b/patches/server/0777-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch index 5f48d6b3b1..f87bd6c9cd 100644 --- a/patches/server/0777-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch +++ b/patches/server/0777-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 e1f530d8b9faf7258a4d4c6dee689548b43b31a2..50311a996960b6907ae9d538d68ca327c2a0206e 100644 +index cfb827f64eaacf9835f950b963b850609347a708..6c50add50f2c6c41806ce08916f3d374fd19827c 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -767,6 +767,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -770,6 +770,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } // Paper end // CraftBukkit end diff --git a/patches/server/0813-Optimise-collision-checking-in-player-move-packet-ha.patch b/patches/server/0813-Optimise-collision-checking-in-player-move-packet-ha.patch index f33b2ef6aa..b77dcf3570 100644 --- a/patches/server/0813-Optimise-collision-checking-in-player-move-packet-ha.patch +++ b/patches/server/0813-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 50311a996960b6907ae9d538d68ca327c2a0206e..cb5df601391a05c1c7cfc1c5d86043f89d673407 100644 +index 6c50add50f2c6c41806ce08916f3d374fd19827c..f62af0697dbf7d15dfbe064e2eb3ff385ffb3325 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -584,7 +584,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -587,7 +587,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser return; } @@ -18,7 +18,7 @@ index 50311a996960b6907ae9d538d68ca327c2a0206e..cb5df601391a05c1c7cfc1c5d86043f8 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 -@@ -592,6 +592,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -595,6 +595,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser boolean flag1 = entity.verticalCollisionBelow; entity.move(MoverType.PLAYER, new Vec3(d6, d7, d8)); @@ -26,7 +26,7 @@ index 50311a996960b6907ae9d538d68ca327c2a0206e..cb5df601391a05c1c7cfc1c5d86043f8 double d11 = d7; d6 = d3 - entity.getX(); -@@ -605,16 +606,24 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -608,16 +609,24 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser boolean flag2 = false; if (d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot @@ -54,7 +54,7 @@ index 50311a996960b6907ae9d538d68ca327c2a0206e..cb5df601391a05c1c7cfc1c5d86043f8 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)); -@@ -700,7 +709,32 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -703,7 +712,32 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } private boolean noBlocksAround(Entity entity) { @@ -88,7 +88,7 @@ index 50311a996960b6907ae9d538d68ca327c2a0206e..cb5df601391a05c1c7cfc1c5d86043f8 } @Override -@@ -1248,7 +1282,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1251,7 +1285,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } if (this.awaitingPositionFromClient != null) { @@ -97,7 +97,7 @@ index 50311a996960b6907ae9d538d68ca327c2a0206e..cb5df601391a05c1c7cfc1c5d86043f8 this.awaitingTeleportTime = this.tickCount; this.teleport(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot()); } -@@ -1342,7 +1376,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1345,7 +1379,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } } @@ -106,7 +106,7 @@ index 50311a996960b6907ae9d538d68ca327c2a0206e..cb5df601391a05c1c7cfc1c5d86043f8 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 -@@ -1383,6 +1417,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1386,6 +1420,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser boolean flag1 = this.player.verticalCollisionBelow; this.player.move(MoverType.PLAYER, new Vec3(d7, d8, d9)); @@ -114,7 +114,7 @@ index 50311a996960b6907ae9d538d68ca327c2a0206e..cb5df601391a05c1c7cfc1c5d86043f8 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) { -@@ -1402,12 +1437,23 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1405,12 +1440,23 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser 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 50311a996960b6907ae9d538d68ca327c2a0206e..cb5df601391a05c1c7cfc1c5d86043f8 this.teleport(d3, d4, d5, f, f1); } else { // CraftBukkit start - fire PlayerMoveEvent -@@ -1493,6 +1539,27 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1496,6 +1542,27 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } } diff --git a/patches/server/0844-Kick-on-main-for-illegal-chars.patch b/patches/server/0844-Kick-on-main-for-illegal-chars.patch index f5c7e34afc..5960bd65d4 100644 --- a/patches/server/0844-Kick-on-main-for-illegal-chars.patch +++ b/patches/server/0844-Kick-on-main-for-illegal-chars.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Kick on main for illegal chars diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index cb5df601391a05c1c7cfc1c5d86043f89d673407..dea4d455d05945505f9ef33793a61783b521bf11 100644 +index f62af0697dbf7d15dfbe064e2eb3ff385ffb3325..952debf2fb4abf675e226224909b14c866528e62 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2077,7 +2077,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2080,7 +2080,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser for (int i = 0; i < s.length(); ++i) { if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) { diff --git a/patches/server/0878-Don-t-allow-vehicle-movement-from-players-while-tele.patch b/patches/server/0878-Don-t-allow-vehicle-movement-from-players-while-tele.patch new file mode 100644 index 0000000000..bd0b399825 --- /dev/null +++ b/patches/server/0878-Don-t-allow-vehicle-movement-from-players-while-tele.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Mon, 14 Mar 2022 12:35:37 -0700 +Subject: [PATCH] Don't allow vehicle movement from players while teleporting + +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 952debf2fb4abf675e226224909b14c866528e62..68e1ab0057452228817ecbc6556338a8906c2538 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -517,6 +517,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + } else { + Entity entity = this.player.getRootVehicle(); + ++ // Paper start ++ if (this.awaitingPositionFromClient != null) { ++ return; ++ } ++ // Paper end ++ + if (entity != this.player && entity.getControllingPassenger() == this.player && entity == this.lastVehicle) { + ServerLevel worldserver = this.player.getLevel(); + double d0 = entity.getX();final double fromX = d0; // Paper - OBFHELPER