mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 07:48:53 +01:00
Make sure the player didn't disconnect when processing commands
This commit is contained in:
parent
9846d0d89e
commit
813d0399f9
12 changed files with 29 additions and 23 deletions
|
@ -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 8552f230b4ec64a6e056198d3edb04395138608a..1371ffc0426ff019c47f30f2cdeea51f72b137c3 100644
|
||||
index 8552f230b4ec64a6e056198d3edb04395138608a..c3d4a3d109746866bbade09e0c95d7897c912b4b 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2162,7 +2162,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
|
@ -20,7 +20,7 @@ index 8552f230b4ec64a6e056198d3edb04395138608a..1371ffc0426ff019c47f30f2cdeea51f
|
|||
} else {
|
||||
Optional<LastSeenMessages> optional = this.tryHandleChat(packet.message(), packet.timeStamp(), packet.lastSeenMessages());
|
||||
|
||||
@@ -2196,7 +2198,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@@ -2196,12 +2198,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@Override
|
||||
public void handleChatCommand(ServerboundChatCommandPacket packet) {
|
||||
if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.command())) {
|
||||
|
@ -30,7 +30,13 @@ index 8552f230b4ec64a6e056198d3edb04395138608a..1371ffc0426ff019c47f30f2cdeea51f
|
|||
} else {
|
||||
Optional<LastSeenMessages> optional = this.tryHandleChat(packet.command(), packet.timeStamp(), packet.lastSeenMessages());
|
||||
|
||||
@@ -2276,7 +2280,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
if (optional.isPresent()) {
|
||||
this.server.submit(() -> {
|
||||
+ if (player.hasDisconnected()) return; // Paper
|
||||
this.performChatCommand(packet, (LastSeenMessages) optional.get());
|
||||
this.detectRateSpam("/" + packet.command()); // Spigot
|
||||
});
|
||||
@@ -2276,7 +2281,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
private Optional<LastSeenMessages> tryHandleChat(String message, Instant timestamp, LastSeenMessages.Update acknowledgment) {
|
||||
if (!this.updateChatOrder(timestamp)) {
|
||||
ServerGamePacketListenerImpl.LOGGER.warn("{} sent out-of-order chat: '{}'", this.player.getName().getString(), message);
|
||||
|
|
|
@ -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 bec15299c3421e800465120607d4da1e42787aa7..1c0d3f032b5abc4b1e99555105258376fed1f541 100644
|
||||
index f1155e7df523d2030c3fe9b488a77fae5ad2febd..fd6d2add5d6ecaab8824c90c4cf82254aeee37b6 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -3302,7 +3302,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@@ -3303,7 +3303,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound);
|
||||
|
||||
if (this.player.level.isLoaded(blockposition)) {
|
||||
|
|
|
@ -18,10 +18,10 @@ index 5b46cabf4f2e2a1f7feaad378dd98d64aeef8671..51b3db0b6c2cede95b584268e035c0fb
|
|||
|
||||
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 1c0d3f032b5abc4b1e99555105258376fed1f541..aa70da970602d9c5e076b5036c296d6a9174e2bf 100644
|
||||
index fd6d2add5d6ecaab8824c90c4cf82254aeee37b6..709a0adbb4f869f6e5016ddd009aecfb428228fd 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2893,7 +2893,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@@ -2894,7 +2894,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
this.player = this.server.getPlayerList().respawn(this.player, false, RespawnReason.DEATH);
|
||||
if (this.server.isHardcore()) {
|
||||
this.player.setGameMode(GameType.SPECTATOR, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.HARDCORE_DEATH, null); // Paper
|
||||
|
|
|
@ -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 aa70da970602d9c5e076b5036c296d6a9174e2bf..798eaaaed23c55728a7c48ea900db873cf5c5197 100644
|
||||
index 709a0adbb4f869f6e5016ddd009aecfb428228fd..9ff3af312429a0cd9479d85040b73b5c547c5367 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -3481,6 +3481,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@@ -3482,6 +3482,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@Override
|
||||
public void handleClientInformation(ServerboundClientInformationPacket packet) {
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||
|
|
|
@ -6,10 +6,10 @@ 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 03ee980ae8fdaa174c937f1e5175020f0626556e..5b8e57196b810ac093e66718a3e4d987c5a8f1e3 100644
|
||||
index 5c85a9d609c02498a8f883bf44f5e85c21275318..05841b6e44396ed49618f5b478abe78fde0a73d0 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2285,7 +2285,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@@ -2286,7 +2286,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
|
||||
private Optional<LastSeenMessages> tryHandleChat(String message, Instant timestamp, LastSeenMessages.Update acknowledgment) {
|
||||
if (!this.updateChatOrder(timestamp)) {
|
||||
|
|
|
@ -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 5b8e57196b810ac093e66718a3e4d987c5a8f1e3..dbc815053fc022cc62cd4fc418fecdf64a37a0a9 100644
|
||||
index 05841b6e44396ed49618f5b478abe78fde0a73d0..82d7506988b0e443bf16be93a9e17257aeff9472 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2532,7 +2532,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@@ -2533,7 +2533,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
}
|
||||
// Spigot end
|
||||
// this.chatSpamTickCount += 20;
|
||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Remove invalid signature login stacktrace
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 0909716c7b76bc07a2cd3caee4bede0a83255a06..b2a72e529b60eac033ac609cc11429ddbef0d422 100644
|
||||
index 0f6c2725ff7e9aa6bcef16658aefcbc586d979b5..959e8d2cfa195e28239da03464e45563fcdd1244 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -3611,7 +3611,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@@ -3612,7 +3612,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
|
||||
this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator, Duration.ZERO));
|
||||
} catch (ProfilePublicKey.ValidationException profilepublickey_b) {
|
||||
|
|
|
@ -66,10 +66,10 @@ index a276aed4821eb992e0f20e2d2c6229e0b96eef73..ff7ba7a161cfed7521354bc6e3f21ba0
|
|||
public static class DataItem<T> {
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index b2a72e529b60eac033ac609cc11429ddbef0d422..c3db04aefe288a42d6a82291cc0164c8b09e9afa 100644
|
||||
index 959e8d2cfa195e28239da03464e45563fcdd1244..e7d6e4354dc7e50716b902a54afd4cf2246dea62 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2791,7 +2791,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@@ -2792,7 +2792,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
|
||||
// Entity in bucket - SPIGOT-4048 and SPIGOT-6859a
|
||||
if ((entity instanceof Bucketable && entity instanceof LivingEntity && origItem != null && origItem.asItem() == Items.WATER_BUCKET) && (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem)) {
|
||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add missing SpigotConfig logCommands check
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index c3db04aefe288a42d6a82291cc0164c8b09e9afa..9029be5f8a1f2c0719bf5e4012f72b52cf82b060 100644
|
||||
index e7d6e4354dc7e50716b902a54afd4cf2246dea62..78f5ec6e2f7994fa3fded16c9745c1e6a3f7b8ea 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2249,7 +2249,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@@ -2250,7 +2250,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
private void performChatCommand(ServerboundChatCommandPacket packet, LastSeenMessages lastSeenMessages) {
|
||||
// CraftBukkit start
|
||||
String command = "/" + packet.command();
|
||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Use single player info update packet on join
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 9029be5f8a1f2c0719bf5e4012f72b52cf82b060..f5888a2216a017b0db24ff7bfe2fc8f41b149605 100644
|
||||
index 78f5ec6e2f7994fa3fded16c9745c1e6a3f7b8ea..0b907605b21ce04815643d2ce6d220880aa8f2cf 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -3626,7 +3626,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@@ -3627,7 +3627,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
this.signedMessageDecoder = session.createMessageDecoder(this.player.getUUID());
|
||||
this.chatMessageChain.append((executor) -> {
|
||||
this.player.setChatSession(session);
|
||||
|
|
|
@ -24,7 +24,7 @@ index 23e0e6937e28f09271a4ec7c35e0076a576cf3d3..4aa8b483841028fbcc43f9ed47730881
|
|||
UPDATE_GAME_MODE((serialized, buf) -> {
|
||||
serialized.gameMode = GameType.byId(buf.readVarInt());
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 8258764bafe5ad2d9aeaafd830aab3bb6617d2ff..9c5754ac3b00d3f0cb80ec83a2beefadee6d0a14 100644
|
||||
index dac73f994d416900ef3a3253e040225a805c827a..04a92f33f15d1696e38d38839651adf7d0462cac 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -295,6 +295,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
|
@ -49,7 +49,7 @@ index 8258764bafe5ad2d9aeaafd830aab3bb6617d2ff..9c5754ac3b00d3f0cb80ec83a2beefad
|
|||
}
|
||||
|
||||
public void resetPosition() {
|
||||
@@ -3624,6 +3632,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@@ -3625,6 +3633,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
|
||||
private void resetPlayerChatState(RemoteChatSession session) {
|
||||
this.chatSession = session;
|
||||
|
|
Loading…
Reference in a new issue