Fix null profile key breaking nullability contracts for PlayerProfile API (#8233)

This commit is contained in:
Jake Potrebic 2022-08-03 13:46:33 -07:00 committed by GitHub
parent a817697e8a
commit ef42d2a575
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 80 additions and 62 deletions

View File

@ -598,6 +598,24 @@ index a48a12a31a3d09a9373b688dcc093035f8f8a300..97b29bcb20e199c2d02457f8025e67e2
// CraftBukkit start
String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName);
LevelStorageSource convertable = LevelStorageSource.createDefault(file.toPath());
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index dc18cc9818fef3e7193a22353aea957a47dbbdb5..ae676b46937f821e358ca4176b162bbca7048e62 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1989,6 +1989,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
private boolean tryHandleChat(String message, Instant timestamp, LastSeenMessages.Update acknowledgment) {
+ // Paper start
+ final ProfilePublicKey key = this.player.getProfilePublicKey();
+ if (key != null && key.data().hasExpired()) {
+ this.disconnect(Component.translatable("multiplayer.disconnect.missing_public_key"), org.bukkit.event.player.PlayerKickEvent.Cause.CHAT_VALIDATION_FAILED);
+ return false;
+ }
+ // Paper end
if (!this.updateChatOrder(timestamp)) {
ServerGamePacketListenerImpl.LOGGER.warn("{} sent out-of-order chat: '{}'", this.player.getName().getString(), message);
this.disconnect(Component.translatable("multiplayer.disconnect.out_of_order_chat"));
diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java
index 2a0cf0a8a79c09566c598197fc6f8c447d4bbd72..5e3bc0590e59770490b1c6c818d99be054214a8a 100644
--- a/src/main/java/net/minecraft/server/players/GameProfileCache.java

View File

@ -15,10 +15,10 @@ also adding some additional logging in order to help work out what is causing
random disconnections for clients.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 12325f4eafb7c7f4fd273464c1244d8c4f99fce7..d2641f1aad42f9e3930e5fe106a3a40f833e3945 100644
index c61d51360f610e15c4cefa62b74d267646fe9c0c..e288e1dafa9fa4b485e3dc985d5764e9a0050f51 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3217,14 +3217,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3224,14 +3224,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override
public void handleKeepAlive(ServerboundKeepAlivePacket packet) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix exploit that allowed colored signs to be created
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index da09a756a0e0489ac6dc0262ac01e3b0c36e4caf..f7398719a3acb564f6c20d864293361053d5de92 100644
index 23c229d807cb039edb814433e3761a06396fd579..e0a770839b5567718382a97a6007b6b1e2d5a035 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3231,9 +3231,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3238,9 +3238,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
FilteredText filteredtext = (FilteredText) signText.get(i);
if (this.player.isTextFilteringEnabled()) {

View File

@ -75,7 +75,7 @@ index 73de8e676a68fa77301ad0417d86bcc7dc0c47e4..367546d6ebaf6227b097f3afb2e57a2f
this.doCloseContainer();
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index f7398719a3acb564f6c20d864293361053d5de92..2e256ea84eb153a5671894c72c2386312f20cf20 100644
index e0a770839b5567718382a97a6007b6b1e2d5a035..de79397e763edc36333b1f57508228bd4b2e1dab 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -216,6 +216,7 @@ import org.bukkit.event.inventory.ClickType;
@ -86,7 +86,7 @@ index f7398719a3acb564f6c20d864293361053d5de92..2e256ea84eb153a5671894c72c238631
import org.bukkit.event.inventory.InventoryCreativeEvent;
import org.bukkit.event.inventory.InventoryType.SlotType;
import org.bukkit.event.inventory.SmithItemEvent;
@@ -2757,10 +2758,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2764,10 +2765,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override
public void handleContainerClose(ServerboundContainerClosePacket packet) {

View File

@ -16,10 +16,10 @@ Refresh the player inventory when PlayerInteractEntityEvent is
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
index 2e256ea84eb153a5671894c72c2386312f20cf20..dd71cd72081897402abf06a9c2e11b18b3500eed 100644
index de79397e763edc36333b1f57508228bd4b2e1dab..8f9cfa9b42a0ccbf325b4c031a85ff1ae82ab42d 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2642,6 +2642,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2649,6 +2649,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
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
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index df6eed12d8e2b9f2027f31b4db304ba771d771ec..434458b5f4017712d3ae0d77015378ecd2f4806e 100644
index 4f9adc601ccc84beaee91a6ca9d6cd2740c4416e..b7425dce2bd65716896bd37477514faa2ceb68e8 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -293,6 +293,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@ -33,7 +33,7 @@ index df6eed12d8e2b9f2027f31b4db304ba771d771ec..434458b5f4017712d3ae0d77015378ec
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) {
this.lastChatTimeStamp = new AtomicReference(Instant.EPOCH);
@@ -3278,7 +3279,19 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3285,7 +3286,19 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override
public void handleSignUpdate(ServerboundSignUpdatePacket packet) {

View File

@ -22,10 +22,10 @@ index d6f34adbdf45bbef4a39e629dd7cb6d7fcb5db0f..7881176a900daa3306c691454f688c1f
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 434458b5f4017712d3ae0d77015378ecd2f4806e..ef655a49a71a112b2e0bd8899107ae115e53a065 100644
index b7425dce2bd65716896bd37477514faa2ceb68e8..2cd75a2411aa184ce80b7b7f8c5a09d0cd6fec26 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2719,7 +2719,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2726,7 +2726,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
if (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem) {
// Refresh the current entity metadata

View File

@ -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 293e50e957ce32b4a2f80ee4196eb7ea42ac6469..3b8cd6e3d44d569d08c99ae5fbf213fc4ffc81ef 100644
index fc05bdab6653bdc9da7a6f4cea4a5323fe114a30..c5d80c61f33aa0b1f1d97abe16f8175ec9259381 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3323,6 +3323,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3330,6 +3330,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
if (!tileentitysign.isEditable() || !this.player.getUUID().equals(tileentitysign.getPlayerWhoMayEdit())) {
ServerGamePacketListenerImpl.LOGGER.warn("Player {} just tried to change non-editable sign", this.player.getName().getString());

View File

@ -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 61651af0056b68d3d7f72f4924c113252cdfe0b6..7a589e98c2a30ac1a6233f1b3f3c8634d1c20b7c 100644
index 760c2a7b532139ddcb0ae0177429940fea825254..01002d5b37863f1c072e4cb2909d82101a016a47 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3220,9 +3220,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3227,9 +3227,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
if (!this.player.containerMenu.stillValid(this.player)) {
ServerGamePacketListenerImpl.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu);
} else {

View File

@ -89,10 +89,10 @@ index 1d021366aa5ffd20365e96a335388aea3238845b..93e7f2dc5b5db8b3ec54e70b44f531d3
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 c8f7f6b384578341f4f605757c12d9690b40f1ae..ce65c9de24f5d3a7980a93498bab14ca9e42db20 100644
index e12a1e923dd7de6ccc4b8f06c402d6ede17b0b64..2f4e3363281a8a068353d433df42bc3b4e9d792c 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3490,7 +3490,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3497,7 +3497,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
public void handleChangeDifficulty(ServerboundChangeDifficultyPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (this.player.hasPermissions(2) || this.isSingleplayerOwner()) {

View File

@ -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 ce65c9de24f5d3a7980a93498bab14ca9e42db20..2f343a06e8e18f216a470a620d5a087c7eccc234 100644
index 2f4e3363281a8a068353d433df42bc3b4e9d792c..e3e8ced9fcf5888811eebe3b55777fa212829b2f 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -296,6 +296,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@ -17,7 +17,7 @@ index ce65c9de24f5d3a7980a93498bab14ca9e42db20..2f343a06e8e18f216a470a620d5a087c
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) {
this.lastChatTimeStamp = new AtomicReference(Instant.EPOCH);
this.lastSeenMessagesValidator = new LastSeenMessagesValidator();
@@ -3445,6 +3447,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3452,6 +3454,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private static final ResourceLocation CUSTOM_REGISTER = new ResourceLocation("register");
private static final ResourceLocation CUSTOM_UNREGISTER = new ResourceLocation("unregister");
@ -26,7 +26,7 @@ index ce65c9de24f5d3a7980a93498bab14ca9e42db20..2f343a06e8e18f216a470a620d5a087c
@Override
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
@@ -3472,6 +3476,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3479,6 +3483,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
try {
byte[] data = new byte[packet.data.readableBytes()];
packet.data.readBytes(data);
@ -42,7 +42,7 @@ index ce65c9de24f5d3a7980a93498bab14ca9e42db20..2f343a06e8e18f216a470a620d5a087c
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data);
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
@@ -3481,6 +3494,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3488,6 +3501,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}

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
index f1f64a5f7c5eaf6dacccf855d7b392f3813f0c6d..7f401294dcabed6ca46b4374ebe2b77bcfea10c4 100644
index 2b4e2a9c801f47ee64ebb3cb76f8c093b6ed1670..daaf71ba59fab7ed0b11f1fc6a182fe5f0537404 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -261,6 +261,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@ -24,7 +24,7 @@ index f1f64a5f7c5eaf6dacccf855d7b392f3813f0c6d..7f401294dcabed6ca46b4374ebe2b77b
/* Use thread-safe field access instead
if (this.chatSpamTickCount > 0) {
--this.chatSpamTickCount;
@@ -3239,6 +3241,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3246,6 +3248,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override
public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) {

View File

@ -6,7 +6,7 @@ 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 7f401294dcabed6ca46b4374ebe2b77bcfea10c4..2c89c189d9acb6101cc9347834ac147d9d92cea4 100644
index daaf71ba59fab7ed0b11f1fc6a182fe5f0537404..a4acceb3b944ce034e101f90b5df535fe0211ad0 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1855,7 +1855,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@ -18,7 +18,7 @@ index 7f401294dcabed6ca46b4374ebe2b77bcfea10c4..2c89c189d9acb6101cc9347834ac147d
this.player.swing(enumhand, true);
}
}
@@ -2607,7 +2607,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2614,7 +2614,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
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));

View File

@ -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 30cb1dad2a2b1809e30a40bff64227fd7c0f9c11..fe40e0ffdb9f9a1c0ce2accba0dbb46238fc5ced 100644
index 3d3f7ce2dc77071b191da532f3baa05cac111f60..bcc08fee18c8dbe239ac996293bc8613d75f47da 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2886,7 +2886,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2893,7 +2893,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
case PERFORM_RESPAWN:
if (this.player.wonGame) {
this.player.wonGame = false;

View File

@ -126,10 +126,10 @@ index 32746dfbc2fdfc150583676b1bf0762398b76d75..1ad1f958a9b6e1bc21f1c505aa7ea549
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index fe40e0ffdb9f9a1c0ce2accba0dbb46238fc5ced..3737b9c62d8d1820041e49e4ec75a61fcfbcf10b 100644
index bcc08fee18c8dbe239ac996293bc8613d75f47da..e18f8cc29683f886aef70ca29f1760ce63a1a748 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2895,7 +2895,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2902,7 +2902,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.player = this.server.getPlayerList().respawn(this.player, false);
if (this.server.isHardcore()) {

View File

@ -57,7 +57,7 @@ index 65637a33ba171a4b598f70cd943d24b0ee44a69f..57a9146bf2dee7a60aab16716e25348f
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 7a7ce8bf83f02fc17e68fe4468d80f79490c9daa..c6d6973e15e3a7f81b908eef6d4de81b51958b14 100644
index 8b11a59c915b606b4b377dc335c6eae540314798..5d237142e5dfb0b0bd4a764dca924dccd8d9c52a 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -372,7 +372,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@ -258,8 +258,8 @@ index 7a7ce8bf83f02fc17e68fe4468d80f79490c9daa..c6d6973e15e3a7f81b908eef6d4de81b
} else {
if (this.tryHandleChat(packet.command(), packet.timeStamp(), packet.lastSeenMessages())) {
this.server.submit(() -> {
@@ -2205,7 +2215,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private boolean tryHandleChat(String message, Instant timestamp, LastSeenMessages.Update acknowledgment) {
@@ -2212,7 +2222,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// Paper end
if (!this.updateChatOrder(timestamp)) {
ServerGamePacketListenerImpl.LOGGER.warn("{} sent out-of-order chat: '{}'", this.player.getName().getString(), message);
- this.disconnect(Component.translatable("multiplayer.disconnect.out_of_order_chat"));
@ -267,7 +267,7 @@ index 7a7ce8bf83f02fc17e68fe4468d80f79490c9daa..c6d6973e15e3a7f81b908eef6d4de81b
return false;
} else if (this.player.isRemoved() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) { // CraftBukkit - dead men tell no tales
this.send(new ClientboundSystemChatPacket(Component.translatable("chat.disabled.options").withStyle(ChatFormatting.RED), false));
@@ -2457,7 +2467,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2464,7 +2474,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
ChatSender chatsender = this.player.asChatSender();
if (chatsender.profilePublicKey() != null && !message.verify(chatsender)) {
@ -276,7 +276,7 @@ index 7a7ce8bf83f02fc17e68fe4468d80f79490c9daa..c6d6973e15e3a7f81b908eef6d4de81b
return false;
} else {
if (message.hasExpiredServer(Instant.now())) {
@@ -2484,7 +2494,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2491,7 +2501,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// this.chatSpamTickCount += 20;
if (this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) {
// CraftBukkit end
@ -285,7 +285,7 @@ index 7a7ce8bf83f02fc17e68fe4468d80f79490c9daa..c6d6973e15e3a7f81b908eef6d4de81b
}
}
@@ -2587,7 +2597,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2594,7 +2604,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private void handleValidationFailure(Set<LastSeenMessagesValidator.ErrorCondition> reasons) {
ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message from {}, reasons: {}", this.player.getName().getString(), reasons.stream().map(LastSeenMessagesValidator.ErrorCondition::message).collect(Collectors.joining(",")));
@ -294,7 +294,7 @@ index 7a7ce8bf83f02fc17e68fe4468d80f79490c9daa..c6d6973e15e3a7f81b908eef6d4de81b
}
@Override
@@ -2734,7 +2744,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2741,7 +2751,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
if (i > 4096) {
@ -303,7 +303,7 @@ index 7a7ce8bf83f02fc17e68fe4468d80f79490c9daa..c6d6973e15e3a7f81b908eef6d4de81b
}
}
@@ -2749,7 +2759,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2756,7 +2766,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// Spigot Start
if ( entity == this.player && !this.player.isSpectator() )
{
@ -312,7 +312,7 @@ index 7a7ce8bf83f02fc17e68fe4468d80f79490c9daa..c6d6973e15e3a7f81b908eef6d4de81b
return;
}
// Spigot End
@@ -2842,7 +2852,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2849,7 +2859,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
// CraftBukkit end
} else {
@ -321,7 +321,7 @@ index 7a7ce8bf83f02fc17e68fe4468d80f79490c9daa..c6d6973e15e3a7f81b908eef6d4de81b
ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString());
}
}
@@ -3250,7 +3260,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3257,7 +3267,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// Paper start
if (!org.bukkit.Bukkit.isPrimaryThread()) {
if (recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) {
@ -330,7 +330,7 @@ index 7a7ce8bf83f02fc17e68fe4468d80f79490c9daa..c6d6973e15e3a7f81b908eef6d4de81b
return;
}
}
@@ -3453,7 +3463,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3460,7 +3470,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
} else if (!this.isSingleplayerOwner()) {
// Paper start - This needs to be handled on the main thread for plugins
server.submit(() -> {
@ -339,7 +339,7 @@ index 7a7ce8bf83f02fc17e68fe4468d80f79490c9daa..c6d6973e15e3a7f81b908eef6d4de81b
});
// Paper end
}
@@ -3499,7 +3509,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3506,7 +3516,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex);
@ -348,7 +348,7 @@ index 7a7ce8bf83f02fc17e68fe4468d80f79490c9daa..c6d6973e15e3a7f81b908eef6d4de81b
}
} else if (packet.identifier.equals(CUSTOM_UNREGISTER)) {
try {
@@ -3509,7 +3519,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3516,7 +3526,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex);
@ -357,7 +357,7 @@ index 7a7ce8bf83f02fc17e68fe4468d80f79490c9daa..c6d6973e15e3a7f81b908eef6d4de81b
}
} else {
try {
@@ -3527,7 +3537,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3534,7 +3544,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data);
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);

View File

@ -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 63b7150eca9300a8befc5d39184cb1ae4b3ac242..f104ac728fa27237dce28ec661f03101257ad222 100644
index ad68a631c28e95eec5e35a60f9adeebbe3ecc6fc..e9869cc1ab42427f832d383eef0dc332a133efdd 100644
--- a/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 implements ServerPlayerConnection, Tic
@@ -2635,7 +2635,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
// Arm swing animation

View File

@ -7,7 +7,7 @@ Makes the PlayerKickEvent fire on the main thread for
illegal characters or chat out-of-order errors.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 7933bdb29056ddf8cb29a12166598cd15c155b3a..3bf7bcf3d5a57175a1ac8b886734ca869a407f05 100644
index dfc4a0d7a5d91d6fb874203c88d051bf42cb7e5c..aedea81d08c2fb0df6471481c89c706c614e9a2f 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2177,7 +2177,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@ -30,8 +30,8 @@ index 7933bdb29056ddf8cb29a12166598cd15c155b3a..3bf7bcf3d5a57175a1ac8b886734ca86
} else {
if (this.tryHandleChat(packet.command(), packet.timeStamp(), packet.lastSeenMessages())) {
this.server.submit(() -> {
@@ -2291,7 +2295,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private boolean tryHandleChat(String message, Instant timestamp, LastSeenMessages.Update acknowledgment) {
@@ -2298,7 +2302,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// Paper end
if (!this.updateChatOrder(timestamp)) {
ServerGamePacketListenerImpl.LOGGER.warn("{} sent out-of-order chat: '{}'", this.player.getName().getString(), message);
+ this.server.scheduleOnMain(() -> { // Paper - push to main

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
index 192389ac370b40b0e5f0bfdeea4c76e87b996cde..87c10cd9da0e9f053d7e5a51e57408f130c85243 100644
index baf7d167435a2ebe99c00dfecf3a82079e4ec45a..b2b4c8369d7a1a4f7939621612c69abdb0e607d8 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3403,7 +3403,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3410,7 +3410,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound);
if (this.player.level.isLoaded(blockposition)) {

View File

@ -18,10 +18,10 @@ index 20670bc075c387ee0422eb1014207e26105efccd..bdd6560fe85950b0a857a949cb38c044
if (dedicatedserverproperties.enableQuery) {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 87c10cd9da0e9f053d7e5a51e57408f130c85243..4a5f9df55e8dce0b031e78569b009a5f9dfebe10 100644
index b2b4c8369d7a1a4f7939621612c69abdb0e607d8..5226d69712d372eaf2e82dca0d224f9853441687 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2999,7 +2999,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3006,7 +3006,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.player = this.server.getPlayerList().respawn(this.player, false);
if (this.server.isHardcore()) {
this.player.setGameMode(GameType.SPECTATOR, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.HARDCORE_DEATH, null); // Paper

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
index 4a5f9df55e8dce0b031e78569b009a5f9dfebe10..30217b09e35a229c3825ee835288c884e9233a7c 100644
index 5226d69712d372eaf2e82dca0d224f9853441687..b47af8a8fd42ba38191e22292f7bc8929ea4a0ed 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3582,6 +3582,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3589,6 +3589,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override
public void handleClientInformation(ServerboundClientInformationPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());

View File

@ -6,19 +6,19 @@ Subject: [PATCH] Add some minimal debug information to chat packet errors
TODO: potentially add some kick leeway
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 87ab9261d85a9cbc89d040561847b97b901c24de..4a9f616c66533197dbc285bd483bdbed16ae1f31 100644
index b6865ce0d6b0cc5c4366f6977bac2294b628b68e..456a542438e9e2ea47b024daf90d0132b936d02b 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2300,7 +2300,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private boolean tryHandleChat(String message, Instant timestamp, LastSeenMessages.Update acknowledgment) {
@@ -2307,7 +2307,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
// Paper end
if (!this.updateChatOrder(timestamp)) {
- ServerGamePacketListenerImpl.LOGGER.warn("{} sent out-of-order chat: '{}'", this.player.getName().getString(), message);
+ ServerGamePacketListenerImpl.LOGGER.warn("{} sent out-of-order chat: '{}': {} > {}", this.player.getName().getString(), message, this.lastChatTimeStamp.get().getEpochSecond(), timestamp.getEpochSecond()); // Paper
this.server.scheduleOnMain(() -> { // Paper - push to main
this.disconnect(Component.translatable("multiplayer.disconnect.out_of_order_chat"), org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event cause
}); // Paper - push to main
@@ -2559,7 +2559,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2566,7 +2566,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
return false;
} else {
if (message.hasExpiredServer(Instant.now())) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix Spigot Config not using commands.spam-exclusions
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 4a9f616c66533197dbc285bd483bdbed16ae1f31..75505766d6a1c6693e1545df83cc09fb3b7359e3 100644
index 456a542438e9e2ea47b024daf90d0132b936d02b..3ec16bc35e29d178d4ed99fbeae559d41361efc3 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2580,7 +2580,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2587,7 +2587,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
// Spigot end
// this.chatSpamTickCount += 20;