Do not access world state to see if we can see a Player

Thrown into the adventure patch because I don't see the justification of a patch existing
for something like this.
This commit is contained in:
Shane Freeder 2024-02-22 16:23:15 +00:00
parent 4939f87118
commit 3ea95efdeb
No known key found for this signature in database
GPG Key ID: A3F61EA5A085289C
21 changed files with 61 additions and 48 deletions

View File

@ -2952,7 +2952,7 @@ index a60fef571c94858998a91711b17d3670c28a81bd..04a728a16bb629adbae1cd8586764a6d
@Override @Override
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 58872976048a1162602d5f11a85eaead837cd805..acd53d9005fc5f43b94c80ec5e7d0e1f9c86ca98 100644 index 58872976048a1162602d5f11a85eaead837cd805..93ef520b8f047870f48e908ae55590547ad88729 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -44,6 +44,7 @@ import net.minecraft.nbt.ListTag; @@ -44,6 +44,7 @@ import net.minecraft.nbt.ListTag;
@ -3018,7 +3018,20 @@ index 58872976048a1162602d5f11a85eaead837cd805..acd53d9005fc5f43b94c80ec5e7d0e1f
Player player = this.getCraftPlayer(); Player player = this.getCraftPlayer();
AsyncPlayerChatEvent event = new AsyncPlayerChatEvent(async, player, s, new LazyPlayerSet(this.server)); AsyncPlayerChatEvent event = new AsyncPlayerChatEvent(async, player, s, new LazyPlayerSet(this.server));
String originalFormat = event.getFormat(), originalMessage = event.getMessage(); String originalFormat = event.getFormat(), originalMessage = event.getMessage();
@@ -2918,6 +2931,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2239,7 +2252,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
public void sendPlayerChatMessage(PlayerChatMessage message, ChatType.Bound params) {
// CraftBukkit start - SPIGOT-7262: if hidden we have to send as disguised message. Query whether we should send at all (but changing this may not be expected).
- if (!this.getCraftPlayer().canSee(message.link().sender())) {
+ // Paper start - Do not query the world for players, if they're not in the player list, then they're not in the world - don't query world state
+ // Also, mirror the logic for canSee in terms of "missing" players
+ final ServerPlayer sender = this.server.getPlayerList().getPlayer(message.link().sender());
+ if (sender == null || !this.getCraftPlayer().canSee(sender.getBukkitEntity())) {
+ // Paper end
this.sendDisguisedChatMessage(message.decoratedContent(), params);
return;
}
@@ -2918,6 +2935,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
public void handleClientInformation(ServerboundClientInformationPacket packet) { public void handleClientInformation(ServerboundClientInformationPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
this.player.updateOptions(packet.information()); this.player.updateOptions(packet.information());

View File

@ -28,10 +28,10 @@ index 644a0fdea6576647539b96528717dbaeab498d93..221e64a66ff12a8de5c75992fc26a54a
+ // Paper end - PlayerUseUnknownEntityEvent + // Paper end - PlayerUseUnknownEntityEvent
} }
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index dedd0aa332412eec5f976959b67da5405d980ded..c1c1abd45cae5f1fe010e73199e4b228f919c6a6 100644 index 37cba1e693490e42908f45dc68e60ac3afebbb49..801e1727bd291f647c91e2c325810ead070f3752 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2400,7 +2400,26 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2404,7 +2404,26 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}); });
} }
} }

View File

@ -75,10 +75,10 @@ index 19cd69fc911bb9b95257b1fdc19645bbdfe05de3..38a3b264ba72631c27203a178ac0bbdd
this.doCloseContainer(); this.doCloseContainer();
} }
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 39af3e197502c1f262fbdd4e06dc0e3fc7537b77..f9e961bc76f0ae1d7737f3840dfc667567f969d0 100644 index f19ab219dc51e9f9fff119637b33281dac4e03d2..29ffe034b3b7838e20be4d6a52a82cec004eb2a1 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2526,10 +2526,15 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2530,10 +2530,15 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override @Override
public void handleContainerClose(ServerboundContainerClosePacket packet) { public void handleContainerClose(ServerboundContainerClosePacket packet) {

View File

@ -16,10 +16,10 @@ Refresh the player inventory when PlayerInteractEntityEvent is
cancelled to avoid this problem. cancelled to avoid this problem.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index f9e961bc76f0ae1d7737f3840dfc667567f969d0..3d6355f50d04035f62fa9eddee076d0a157c89a6 100644 index 29ffe034b3b7838e20be4d6a52a82cec004eb2a1..91cc18da4f0beca4cc4a9e13627b87931262efb6 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2417,6 +2417,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2421,6 +2421,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
} }
if (event.isCancelled()) { if (event.isCancelled()) {

View File

@ -22,7 +22,7 @@ it only impacts data sent from the client.
Set -DPaper.maxSignLength=XX to change limit or -1 to disable Set -DPaper.maxSignLength=XX to change limit or -1 to disable
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 7c5b550845035bf896358b7aad2101ab0b48b3fe..89da9267c4c1a884e5483c423ccc68ed1d79259b 100644 index 7fc5078b0fff8746daf6d3ee873e4d85df702cf1..f78f5be4a1d3e551649090b296881d8dafea1ab9 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -290,6 +290,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -290,6 +290,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -33,7 +33,7 @@ index 7c5b550845035bf896358b7aad2101ab0b48b3fe..89da9267c4c1a884e5483c423ccc68ed
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player, CommonListenerCookie clientData) { public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player, CommonListenerCookie clientData) {
super(server, connection, clientData, player); // CraftBukkit super(server, connection, clientData, player); // CraftBukkit
@@ -3055,7 +3056,19 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -3059,7 +3060,19 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override @Override
public void handleSignUpdate(ServerboundSignUpdatePacket packet) { public void handleSignUpdate(ServerboundSignUpdatePacket packet) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerRecipeBookClickEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 67470ad0c09ae94e5fab775a28cdefdf1241c5fa..98826ba4ab062e029359968c221ba320b2d2daeb 100644 index 2eeeb1f1b07db439a68d70c55192aa9fb54f620c..80b6871516c45291f63b1ae521dcdf34199fd9b4 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2962,16 +2962,40 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2966,16 +2966,40 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (!this.player.containerMenu.stillValid(this.player)) { if (!this.player.containerMenu.stillValid(this.player)) {
ServerGamePacketListenerImpl.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu); ServerGamePacketListenerImpl.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu);
} else { } else {

View File

@ -89,10 +89,10 @@ index e5653695a3fbcd260ce44ca37291406a1033a3fa..966b86a2b26a32aad2656d1f2beb6daf
playerlist.sendPlayerPermissionLevel(this); 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 diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index e9a3edbb66c79664f35150f052b6ff3534d0904c..18c7189725cc7c2d4438ea711fd72b752d0db0e0 100644 index d78d411879275f11f395b4f9c94b7aab88342236..67e75982d712fdd2f751f2a0fcafba7aec779d74 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3165,7 +3165,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -3169,7 +3169,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
public void handleChangeDifficulty(ServerboundChangeDifficultyPacket packet) { public void handleChangeDifficulty(ServerboundChangeDifficultyPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (this.player.hasPermissions(2) || this.isSingleplayerOwner()) { if (this.player.hasPermissions(2) || this.isSingleplayerOwner()) {

View File

@ -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 diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 18c7189725cc7c2d4438ea711fd72b752d0db0e0..22d6c914ffbe591d3de19b89a0e87d1042bf1772 100644 index 67e75982d712fdd2f751f2a0fcafba7aec779d74..789576f8b7b3001c243972b320b7dffbbf3baa5f 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3157,6 +3157,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -3161,6 +3161,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override @Override
public void handleClientInformation(ServerboundClientInformationPacket packet) { public void handleClientInformation(ServerboundClientInformationPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Limit recipe packets
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 5e605b9bdb76ca0c9529e7351432578855cc7fa2..87ff69ffbd1e8fa3e88ce2561b56958c23040a10 100644 index e08c3e0d09896da60cbec7923882bc2263de1bae..5190939658fce990e166b7c4f5998dd030a156e8 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -257,6 +257,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -257,6 +257,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -24,7 +24,7 @@ index 5e605b9bdb76ca0c9529e7351432578855cc7fa2..87ff69ffbd1e8fa3e88ce2561b56958c
/* Use thread-safe field access instead /* Use thread-safe field access instead
if (this.chatSpamTickCount > 0) { if (this.chatSpamTickCount > 0) {
--this.chatSpamTickCount; --this.chatSpamTickCount;
@@ -2974,6 +2976,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2978,6 +2980,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override @Override
public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) { public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) {

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Expand PlayerRespawnEvent, fix passed parameter issues
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 8fcb3361c510cb1ef0b6405d0077c82ba155d586..2004712adede7e3307785389dd7aa4ba5465110f 100644 index 12b81d6dc04586d2491a382b6198f986b2b5bae1..e12740f601acbe2b344d8e1fffc4bee2c752face 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2628,7 +2628,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2632,7 +2632,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
case PERFORM_RESPAWN: case PERFORM_RESPAWN:
if (this.player.wonGame) { if (this.player.wonGame) {
this.player.wonGame = false; this.player.wonGame = false;

View File

@ -131,10 +131,10 @@ index a03d1a85019afdc42de2b8449fc38384c4dac51e..4fe571915b247ec612b2376dce57991e
} }
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 2004712adede7e3307785389dd7aa4ba5465110f..c54a1c2bf8719791047eb9ccc6cbe26c7541f125 100644 index e12740f601acbe2b344d8e1fffc4bee2c752face..c9a8d04d1485a9493f6353beb7998801e286923e 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2637,7 +2637,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2641,7 +2641,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.player = this.server.getPlayerList().respawn(this.player, false, RespawnReason.DEATH); this.player = this.server.getPlayerList().respawn(this.player, false, RespawnReason.DEATH);
if (this.server.isHardcore()) { if (this.server.isHardcore()) {

View File

@ -87,10 +87,10 @@ index 25ddfe8e5da65e4ac70be2820ba139e7f3852c0c..87abd6274f9da9367094bad0c28acfa4
} }
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 60acd12ab02a2a3c1fd788af2695b6a699646986..bd212b89412c099216828ab5653ae3b9e1ec5665 100644 index ba7f0f4e2840b88d8f53c5720752cfeed2493c49..a5dd14014fd214ec900e0c49064ee54b2f43ff8e 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2471,6 +2471,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2475,6 +2475,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Spigot Start // Spigot Start
public SocketAddress getRawAddress() public SocketAddress getRawAddress()
{ {

View File

@ -209,7 +209,7 @@ index 6bb846d3ee2fb54ab3ffa116607f2a83e538460e..a65a1466dab52fca75cda16a4b22fef0
if (this.cserver.getServer().isRunning()) { if (this.cserver.getServer().isRunning()) {
this.cserver.getPluginManager().callEvent(event); this.cserver.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 diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index bd212b89412c099216828ab5653ae3b9e1ec5665..28a0570988f93b21f530a6cca87efa429f83079d 100644 index a5dd14014fd214ec900e0c49064ee54b2f43ff8e..2e1a0b3d2dee21d6deba62ec710d92efdf33e1a6 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -341,7 +341,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -341,7 +341,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -391,7 +391,7 @@ index bd212b89412c099216828ab5653ae3b9e1ec5665..28a0570988f93b21f530a6cca87efa42
} }
} }
@@ -2500,7 +2500,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2504,7 +2504,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Spigot Start // Spigot Start
if ( entity == this.player && !this.player.isSpectator() ) if ( entity == this.player && !this.player.isSpectator() )
{ {
@ -400,7 +400,7 @@ index bd212b89412c099216828ab5653ae3b9e1ec5665..28a0570988f93b21f530a6cca87efa42
return; return;
} }
// Spigot End // Spigot End
@@ -2599,7 +2599,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2603,7 +2603,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// CraftBukkit end // CraftBukkit end
} }
} else { } else {
@ -409,7 +409,7 @@ index bd212b89412c099216828ab5653ae3b9e1ec5665..28a0570988f93b21f530a6cca87efa42
ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString()); ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString());
} }
} }
@@ -2997,7 +2997,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -3001,7 +3001,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Paper start - auto recipe limit // Paper start - auto recipe limit
if (!org.bukkit.Bukkit.isPrimaryThread()) { 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) { if (this.recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) {
@ -418,7 +418,7 @@ index bd212b89412c099216828ab5653ae3b9e1ec5665..28a0570988f93b21f530a6cca87efa42
return; return;
} }
} }
@@ -3239,7 +3239,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -3243,7 +3243,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (!Objects.equals(profilepublickey_a, profilepublickey_a1)) { if (!Objects.equals(profilepublickey_a, profilepublickey_a1)) {
if (profilepublickey_a != null && profilepublickey_a1.expiresAt().isBefore(profilepublickey_a.expiresAt())) { if (profilepublickey_a != null && profilepublickey_a1.expiresAt().isBefore(profilepublickey_a.expiresAt())) {
@ -427,7 +427,7 @@ index bd212b89412c099216828ab5653ae3b9e1ec5665..28a0570988f93b21f530a6cca87efa42
} else { } else {
try { try {
SignatureValidator signaturevalidator = this.server.getProfileKeySignatureValidator(); SignatureValidator signaturevalidator = this.server.getProfileKeySignatureValidator();
@@ -3252,7 +3252,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -3256,7 +3256,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator)); this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator));
} catch (ProfilePublicKey.ValidationException profilepublickey_b) { } catch (ProfilePublicKey.ValidationException profilepublickey_b) {
ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage()); ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage());

View File

@ -18,10 +18,10 @@ index 86f6e5bad325dd3d817b643388b196121624b8c7..062225ac8b5fbc44290352d78b215640
} }
} }
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index bf790227e9716a9f678bea1914430c1c65027468..1fb3e89d6f7f9d048f083e80b1259480d4e67ef9 100644 index ace2cab310aa7d89e1b76bf5fdc9fd64f56b6cc7..cf173a2315f3a97a89dc2aabe81be285abe73603 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2561,8 +2561,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2565,8 +2565,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Refresh the current entity metadata // Refresh the current entity metadata
entity.getEntityData().refresh(ServerGamePacketListenerImpl.this.player); entity.getEntityData().refresh(ServerGamePacketListenerImpl.this.player);
// SPIGOT-7136 - Allays // SPIGOT-7136 - Allays
@ -33,7 +33,7 @@ index bf790227e9716a9f678bea1914430c1c65027468..1fb3e89d6f7f9d048f083e80b1259480
} }
} }
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index fa11c0b3125ac74538848018fe6d8c88b78bfb2e..4e781939e7c980d095a4b0fdd11736ec48b4ecfa 100644 index bd2449fd82a2415b9a0c1f588cd1815155a5d300..5c566576703a22bca9ab2cde7e201d893faece03 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3202,7 +3202,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3202,7 +3202,7 @@ public abstract class LivingEntity extends Entity implements Attackable {

View File

@ -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 diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index cd79aa53ec49c80ee3ddf79b7161637e66b688fd..819894dabc8e28a499a6ab5420299e14ab072ff8 100644 index 53a0ad0125e947537ed537b627d1b02c27f0a63d..de2b8ae62bdd9e97aa696768f84543cd4a6522cc 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3107,7 +3107,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -3111,7 +3111,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound); BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound);
if (this.player.level().isLoaded(blockposition)) { if (this.player.level().isLoaded(blockposition)) {

View File

@ -52,10 +52,10 @@ index 5675931fe3ea896027a510944fc484f41f5ef555..1b38d267daa7902bcb7d2a71d28b3f39
} }
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 1eae23b70659b729aaec9d1b5b4dedbefb30a29f..a72af814b81ba3ca82476da47d68ae344bb2b63c 100644 index b8f1549d1ea98a105577927a735bab331aff3840..45a68beff0c97ead5e9f1201b5fb9ef80c08b92b 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3305,7 +3305,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -3309,7 +3309,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator)); this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator));
} catch (ProfilePublicKey.ValidationException profilepublickey_b) { } catch (ProfilePublicKey.ValidationException profilepublickey_b) {

View File

@ -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 diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 6b215d271a884bf60bbda5abc46657ddafdca1dc..006c1fa70bd38a3db9844a77f3f5d22b0d083ddf 100644 index 994787f52ce9eb0b77889ed9bc8021183fa0cb7c..a1196f79968c950fd9d92123bb4018f8d29c3a82 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3335,7 +3335,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -3339,7 +3339,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.signedMessageDecoder = session.createMessageDecoder(this.player.getUUID()); this.signedMessageDecoder = session.createMessageDecoder(this.player.getUUID());
this.chatMessageChain.append(() -> { this.chatMessageChain.append(() -> {
this.player.setChatSession(session); this.player.setChatSession(session);

View File

@ -24,7 +24,7 @@ index 0e54e8faa48751a651b953bec72543a94edf74bc..d43106eb89b14667e85cd6e8fa047d64
UPDATE_GAME_MODE((serialized, buf) -> { UPDATE_GAME_MODE((serialized, buf) -> {
serialized.gameMode = GameType.byId(buf.readVarInt()); 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 diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 2e12d2f22485644bc2fc3d5235cfd3bc755f6c72..d8dd44d0f247ab05bc8323548bdec0f67ab641bc 100644 index c9dab47fe3db73b31b40e071d37f1be63401c19d..69118af2a873f23f6543676db39263bfeb81b4f1 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -286,6 +286,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -286,6 +286,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -49,7 +49,7 @@ index 2e12d2f22485644bc2fc3d5235cfd3bc755f6c72..d8dd44d0f247ab05bc8323548bdec0f6
} }
public void resetPosition() { public void resetPosition() {
@@ -3333,6 +3341,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -3337,6 +3345,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
private void resetPlayerChatState(RemoteChatSession session) { private void resetPlayerChatState(RemoteChatSession session) {
this.chatSession = session; this.chatSession = session;

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Implement PlayerFailMoveEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index d8dd44d0f247ab05bc8323548bdec0f67ab641bc..3141681dc21f7a61fcc77bbf65975072b07c8970 100644 index 69118af2a873f23f6543676db39263bfeb81b4f1..93f5ec2c48bf4bdd4afc1e07ffcf1a34387ce6ac 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1279,8 +1279,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -1279,8 +1279,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -89,7 +89,7 @@ index d8dd44d0f247ab05bc8323548bdec0f67ab641bc..3141681dc21f7a61fcc77bbf65975072
this.internalTeleport(d3, d4, d5, f, f1, Collections.emptySet()); // CraftBukkit - SPIGOT-1807: Don't call teleport event, when the client thinks the player is falling, because the chunks are not loaded on the client yet. this.internalTeleport(d3, d4, d5, f, f1, Collections.emptySet()); // CraftBukkit - SPIGOT-1807: Don't call teleport event, when the client thinks the player is falling, because the chunks are not loaded on the client yet.
this.player.doCheckFallDamage(this.player.getX() - d3, this.player.getY() - d4, this.player.getZ() - d5, packet.isOnGround()); this.player.doCheckFallDamage(this.player.getX() - d3, this.player.getY() - d4, this.player.getZ() - d5, packet.isOnGround());
} else { } else {
@@ -3359,4 +3387,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -3363,4 +3391,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
InteractionResult run(ServerPlayer player, Entity entity, InteractionHand hand); InteractionResult run(ServerPlayer player, Entity entity, InteractionHand hand);
} }

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add slot sanity checks in container clicks
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 9d24b63c9a8a22cafac570421333f6edfd4fd5c6..f59b49a7e9884def9bc9f30dbd4c72dac2915c76 100644 index 270a76e932b76105a8a986b71ac8da8096368c73..e7f51d24868038179b0882c0e2cd4ce1f4fb56b7 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2888,6 +2888,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2892,6 +2892,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
break; break;
case SWAP: case SWAP:
if ((packet.getButtonNum() >= 0 && packet.getButtonNum() < 9) || packet.getButtonNum() == 40) { if ((packet.getButtonNum() >= 0 && packet.getButtonNum() < 9) || packet.getButtonNum() == 40) {

View File

@ -116,7 +116,7 @@ index 692a01b52a71e26887ee42cbd5fd64b0a81bfc99..ef3048a4748113538a0ee0af5b526b2c
return enuminteractionresult; return enuminteractionresult;
// CraftBukkit end // CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 9a3d38365754cf40d8a18aabd1ad1cf27c576599..2f9c62f2c4c4356a896f7004b77f12a595f9c6dc 100644 index a5bee627cd01d42c01751fef79d90062cc0c1603..98496bcc7ab9adde3fdc8b2cd9eaeceee99e28b4 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1990,6 +1990,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -1990,6 +1990,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -127,7 +127,7 @@ index 9a3d38365754cf40d8a18aabd1ad1cf27c576599..2f9c62f2c4c4356a896f7004b77f12a5
this.player.getBukkitEntity().updateInventory(); // SPIGOT-2524 this.player.getBukkitEntity().updateInventory(); // SPIGOT-2524
return; return;
} }
@@ -2704,7 +2705,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2708,7 +2709,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Entity in bucket - SPIGOT-4048 and SPIGOT-6859a // 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)) { 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)) {
@ -150,7 +150,7 @@ index 4816897a82c569717bf7ea139a55ab3fd931a63e..91feb12732564c90656da487664dbc12
this.sendLevelInfo(player, worldserver1); this.sendLevelInfo(player, worldserver1);
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 9f7cb7a2780836c4ce5a6971e9f6004a91509490..578141c88eccaf1c8fd830d8166176f9dab8ed04 100644 index 39609270c5249754783c22526c02672cd4b3b61e..e4c019b88b5605b85f758c85636aa7e6063c6377 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3836,6 +3836,11 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3836,6 +3836,11 @@ public abstract class LivingEntity extends Entity implements Attackable {