1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-02-03 21:37:28 +01:00

Make sure the player didn't disconnect when processing commands

This commit is contained in:
Nassim Jahnke 2023-05-06 17:10:22 +02:00
parent 2ba17103b9
commit e5c8a57116

View file

@ -30,6 +30,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} else {
Optional<LastSeenMessages> optional = this.tryHandleChat(packet.command(), packet.timeStamp(), packet.lastSeenMessages());
if (optional.isPresent()) {
this.server.submit(() -> {
+ if (player.hasDisconnected()) return; // Paper
this.performChatCommand(packet, (LastSeenMessages) optional.get());
this.detectRateSpam("/" + packet.command()); // Spigot
});
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private Optional<LastSeenMessages> tryHandleChat(String message, Instant timestamp, LastSeenMessages.Update acknowledgment) {
if (!this.updateChatOrder(timestamp)) {