Paper/patches/server/0946-Prevent-causing-expired-keys-from-impacting-new-join.patch
Nassim Jahnke 4af62f6d1d
Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
2d009e64 Update SnakeYAML javadoc link
b4fd213c Switch Player#updateInventory deprecation for internal API annotation

CraftBukkit Changes:
f3b2b2210 SPIGOT-7376: Exception with getBlockData when hasBlockData is false
725545630 SPIGOT-7375: Fix crash breeding certain entities
b9873b0d4 Update Brigadier version with fix
68b320562 SPIGOT-7266: Found typo in CraftBukkit package
98b4d2ff8 SPIGOT-7372, SPIGOT-7373: Signs can't be edited, issues with SignChangeEvent
5f7bd4d78 SPIGOT-7371: Sign does not open edit text on placement
b4cf99d24 SPIGOT-7371: Fix editing signs with API
a2b6c2744 PR-1200: Implement open sign by side
a345bb940 SPIGOT-7368: Downgrade SpecialSource version

Spigot Changes:
723951c3 Rebuild patches
b655c57d Drop old collision API deprecated since 1.9.4
55b0fed4 Rebuild patches
2023-06-08 15:25:35 +02:00

60 lines
3.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Mon, 3 Apr 2023 08:55:52 +0100
Subject: [PATCH] Prevent causing expired keys from impacting new joins
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerInfoUpdatePacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerInfoUpdatePacket.java
index 23e0e6937e28f09271a4ec7c35e0076a576cf3d3..4aa8b483841028fbcc43f9ed47730881263e5065 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerInfoUpdatePacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerInfoUpdatePacket.java
@@ -94,7 +94,13 @@ public class ClientboundPlayerInfoUpdatePacket implements Packet<ClientGamePacke
INITIALIZE_CHAT((serialized, buf) -> {
serialized.chatSession = buf.readNullable(RemoteChatSession.Data::read);
}, (buf, entry) -> {
- buf.writeNullable(entry.chatSession, RemoteChatSession.Data::write);
+ // Paper start
+ RemoteChatSession.Data chatSession = entry.chatSession;
+ if (chatSession != null && chatSession.profilePublicKey().hasExpired()) {
+ chatSession = null;
+ }
+ buf.writeNullable(chatSession, RemoteChatSession.Data::write);
+ // Paper end
}),
UPDATE_GAME_MODE((serialized, buf) -> {
serialized.gameMode = GameType.byId(buf.readVarInt());
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 250709d0770b1f2b23eb53f497489631c78a72e4..4862d8911d0dc3facaf02fdbb4f17d8c948ec0ca 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -296,6 +296,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private final AtomicReference<Instant> lastChatTimeStamp;
@Nullable
private RemoteChatSession chatSession;
+ private boolean hasLoggedExpiry = false; // Paper
private SignedMessageChain.Decoder signedMessageDecoder;
private final LastSeenMessagesValidator lastSeenMessages;
private final MessageSignatureCache messageSignatureCache;
@@ -436,6 +437,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.disconnect(Component.translatable("multiplayer.disconnect.idling"), org.bukkit.event.player.PlayerKickEvent.Cause.IDLING); // Paper - kick event cause
}
+ // Paper start
+ if (!hasLoggedExpiry && this.chatSession != null && this.chatSession.profilePublicKey().data().hasExpired()) {
+ LOGGER.info("Player profile key for {} has expired!", this.player.getName().getString());
+ hasLoggedExpiry = true;
+ }
+ // Paper end
+
}
public void resetPosition() {
@@ -3597,6 +3605,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private void resetPlayerChatState(RemoteChatSession session) {
this.chatSession = session;
+ this.hasLoggedExpiry = false; // Paper
this.signedMessageDecoder = session.createMessageDecoder(this.player.getUUID());
this.chatMessageChain.append((executor) -> {
this.player.setChatSession(session);