From 7b4d8c3f3fb09958c2fbd7ee8ebe87a162985cf0 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Tue, 23 Aug 2016 14:02:48 +1000 Subject: [PATCH] SPIGOT-2622: Ensure all players are safely disconnected on shutdown By: md_5 --- paper-server/nms-patches/PlayerList.patch | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/paper-server/nms-patches/PlayerList.patch b/paper-server/nms-patches/PlayerList.patch index 428ef23524..a1c98d9f30 100644 --- a/paper-server/nms-patches/PlayerList.patch +++ b/paper-server/nms-patches/PlayerList.patch @@ -841,24 +841,28 @@ } public boolean getHasWhitelist() { -@@ -836,16 +1270,26 @@ +@@ -835,17 +1269,29 @@ + } public void u() { - for (int i = 0; i < this.players.size(); ++i) { +- for (int i = 0; i < this.players.size(); ++i) { - ((EntityPlayer) this.players.get(i)).playerConnection.disconnect("Server closed"); -+ ((EntityPlayer) this.players.get(i)).playerConnection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message ++ // CraftBukkit start - disconnect safely ++ for (EntityPlayer player : this.players) { ++ player.playerConnection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message } - - } ++ // CraftBukkit end ++ ++ } + // CraftBukkit start + public void sendMessage(IChatBaseComponent[] iChatBaseComponents) { + for (IChatBaseComponent component : iChatBaseComponents) { + sendMessage(component, true); + } -+ } + } + // CraftBukkit end -+ + public void sendMessage(IChatBaseComponent ichatbasecomponent, boolean flag) { this.server.sendMessage(ichatbasecomponent); int i = flag ? 1 : 0; @@ -870,7 +874,7 @@ } public void sendMessage(IChatBaseComponent ichatbasecomponent) { -@@ -882,8 +1326,10 @@ +@@ -882,8 +1328,10 @@ WorldServer[] aworldserver = this.server.worldServer; int j = aworldserver.length;