Paper/Spigot-Server-Patches/0135-Enforce-Sync-Player-Saves.patch
Mariell Hoversholm 8a046c95a4 Updated Upstream (CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
5c77bd28 SPIGOT-6147: InventoryCloseEvent does not fire after closing player inventory
2020-10-01 10:33:58 -04:00

27 lines
1.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 7 Jan 2017 15:41:58 -0500
Subject: [PATCH] Enforce Sync Player Saves
Saving players async is extremely dangerous. This will force it to main
the same way we handle async chunk loads.
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 0287576bf59128583454ca2f60ca05cb978a36d9..4c787974629ce2d39317c7c36036b7e22b0dc35f 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -975,11 +975,13 @@ public abstract class PlayerList {
}
public void savePlayers() {
+ MCUtil.ensureMain("Save Players" , () -> { // Paper - Ensure main
MinecraftTimings.savePlayers.startTiming(); // Paper
for (int i = 0; i < this.players.size(); ++i) {
this.savePlayerFile((EntityPlayer) this.players.get(i));
}
MinecraftTimings.savePlayers.stopTiming(); // Paper
+ return null; }); // Paper - ensure main
}
public WhiteList getWhitelist() {