Paper/Spigot-Server-Patches/0135-Enforce-Sync-Player-Saves.patch
Aikar b3f265d1b1
Updated Upstream (Bukkit/CraftBukkit/Spigot)
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

Bukkit Changes:
0ca45a21 #503: Add PlayerHarvestBlockEvent
dfa80a52 SPIGOT-5930: Add PlayerRespawnEvent#isAnchorSpawn

CraftBukkit Changes:
145921e2 #676: Add PlayerHarvestBlockEvent
47abffa2 SPIGOT-5929: Angered zombified piglins do not inherit killed_by_player status
7f6b4f58 SPIGOT-5930: Add PlayerRespawnEvent#isAnchorSpawn
94eff632 SPIGOT-5867, MC-193339: NPE during shutdown when rcon enabled with no password
068618eb SPIGOT-5927: Some items NBT data disappears

Spigot Changes:
beb7d47c Rebuild patches

Fixes #3738
2020-07-03 02:19:33 -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 7fb344d9ef8f5c7a6c6ed5e7256d55860726c6f2..bfe7848655498287e357593259e188f161292d3e 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -961,11 +961,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() {