-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Save players before plugin disabling on server shutdown
- Loading branch information
1 parent
b4e3b3d
commit ea7e369
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
patches/server/1029-Save-players-before-plugin-disabling-on-server-shutd.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: DerEchtePilz <[email protected]> | ||
Date: Sat, 2 Sep 2023 12:48:58 +0200 | ||
Subject: [PATCH] Save players before plugin disabling on server shutdown | ||
|
||
|
||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java | ||
index 67ee3a4ca8a6cdeb275653d492a1fea8037c51fb..aec1897c57d7888d51e076a5ef2de57ba055ec4c 100644 | ||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java | ||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java | ||
@@ -937,6 +937,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa | ||
MinecraftServer.LOGGER.info("Stopping server"); | ||
Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Shutdown and don't bother finishing | ||
MinecraftTimings.stopServer(); // Paper | ||
+ | ||
+ // Paper start - save players before disabling plugins (matches /restart behaviour) | ||
+ this.isSaving = true; | ||
+ if (this.playerList != null) { | ||
+ MinecraftServer.LOGGER.info("Saving players"); | ||
+ this.playerList.saveAll(); | ||
+ this.playerList.removeAll(this.isRestarting); // Paper | ||
+ try { Thread.sleep(100); } catch (InterruptedException ex) {} // CraftBukkit - SPIGOT-625 - give server at least a chance to send packets | ||
+ } | ||
+ this.isSaving = false; | ||
+ // Paper end | ||
+ | ||
// CraftBukkit start | ||
if (this.server != null) { | ||
this.server.disablePlugins(); | ||
@@ -948,13 +960,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa | ||
} | ||
|
||
this.isSaving = true; | ||
- if (this.playerList != null) { | ||
- MinecraftServer.LOGGER.info("Saving players"); | ||
- this.playerList.saveAll(); | ||
- this.playerList.removeAll(this.isRestarting); // Paper | ||
- try { Thread.sleep(100); } catch (InterruptedException ex) {} // CraftBukkit - SPIGOT-625 - give server at least a chance to send packets | ||
- } | ||
- | ||
MinecraftServer.LOGGER.info("Saving worlds"); | ||
Iterator iterator = this.getAllLevels().iterator(); | ||
|