Paper/patches/server/0145-Block-player-logins-during-server-shutdown.patch
2022-12-07 19:52:24 +01:00

24 lines
1.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sun, 2 Jul 2017 21:35:56 -0500
Subject: [PATCH] Block player logins during server shutdown
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index d14b7265a075f883f39d078b0d57bccdd7b3ff41..0d55dc89e4577fb6804e08281aaa12ac783bbbe0 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -71,6 +71,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
@Override
public void tick() {
+ // Paper start - Do not allow logins while the server is shutting down
+ if (!MinecraftServer.getServer().isRunning()) {
+ this.disconnect(org.bukkit.craftbukkit.util.CraftChatMessage.fromString(org.spigotmc.SpigotConfig.restartMessage)[0]);
+ return;
+ }
+ // Paper end
if (this.state == ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT) {
this.handleAcceptedLogin();
} else if (this.state == ServerLoginPacketListenerImpl.State.DELAY_ACCEPT) {