From f7185064c90e044516ddd412cdc1c297e3370d46 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Mon, 9 Nov 2020 01:05:27 +0000 Subject: [PATCH] Updated Upstream (Spigot) Restab at the last upstream to add support for migrating the option for disabling player data saving back into spigots config, vs blindly dropping it 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 Spigot Changes: a19903d2 SPIGOT-520: Add option to disable player data saving --- ...le-Alternative-LootPool-Luck-Formula.patch | 2 +- ...ble-connection-throttle-kick-message.patch | 4 +-- Spigot-Server-Patches/MC-Utils.patch | 17 +++++++++++++ ...Make-player-data-saving-configurable.patch | 25 ++++++------------- ...ault-permission-message-configurable.patch | 4 +-- work/Spigot | 2 +- 6 files changed, 31 insertions(+), 23 deletions(-) diff --git a/Spigot-Server-Patches/Configurable-Alternative-LootPool-Luck-Formula.patch b/Spigot-Server-Patches/Configurable-Alternative-LootPool-Luck-Formula.patch index b30d7488df..cead2ac570 100644 --- a/Spigot-Server-Patches/Configurable-Alternative-LootPool-Luck-Formula.patch +++ b/Spigot-Server-Patches/Configurable-Alternative-LootPool-Luck-Formula.patch @@ -40,7 +40,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -0,0 +0,0 @@ public class PaperConfig { - "such as inventories, experience points, advancements and the like will not be saved when they log out."); + SpigotConfig.save(); } } + diff --git a/Spigot-Server-Patches/Configurable-connection-throttle-kick-message.patch b/Spigot-Server-Patches/Configurable-connection-throttle-kick-message.patch index 0b5c3c023f..541bd3cf0b 100644 --- a/Spigot-Server-Patches/Configurable-connection-throttle-kick-message.patch +++ b/Spigot-Server-Patches/Configurable-connection-throttle-kick-message.patch @@ -17,9 +17,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + connectionThrottleKickMessage = getString("messages.kick.connection-throttle", connectionThrottleKickMessage); + } + - public static boolean savePlayerData = true; private static void savePlayerData() { - savePlayerData = getBoolean("settings.save-player-data", savePlayerData); + Object val = config.get("settings.save-player-data"); + if (val instanceof Boolean) { diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/HandshakeListener.java diff --git a/Spigot-Server-Patches/MC-Utils.patch b/Spigot-Server-Patches/MC-Utils.patch index bee4a87ea5..7b517a7afb 100644 --- a/Spigot-Server-Patches/MC-Utils.patch +++ b/Spigot-Server-Patches/MC-Utils.patch @@ -4792,3 +4792,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private int size; private int initialCapacity; +diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/spigotmc/SpigotConfig.java ++++ b/src/main/java/org/spigotmc/SpigotConfig.java +@@ -0,0 +0,0 @@ public class SpigotConfig + } + } + } +- ++ // Paper start ++ SpigotConfig.save(); ++ } ++ public static void save() { ++ // Paper end + try + { + config.save( CONFIG_FILE ); diff --git a/Spigot-Server-Patches/Make-player-data-saving-configurable.patch b/Spigot-Server-Patches/Make-player-data-saving-configurable.patch index 2db25b2cc5..1235f17e1c 100644 --- a/Spigot-Server-Patches/Make-player-data-saving-configurable.patch +++ b/Spigot-Server-Patches/Make-player-data-saving-configurable.patch @@ -3,6 +3,9 @@ From: Mark Vainomaa Date: Mon, 26 Mar 2018 18:30:53 +0300 Subject: [PATCH] Make player data saving configurable +Upstream has added a patch which negates the need for this patch, +however, we should still migrate our configuration back upstream, +to prevent unexpected situations diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -13,24 +16,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 authenticationServersDownKickMessage = Strings.emptyToNull(getString("messages.kick.authentication-servers-down", authenticationServersDownKickMessage)); } + -+ public static boolean savePlayerData = true; + private static void savePlayerData() { -+ savePlayerData = getBoolean("settings.save-player-data", savePlayerData); -+ if(!savePlayerData) { -+ Bukkit.getLogger().log(Level.WARNING, "Player Data Saving is currently disabled. Any changes to your players data, " + -+ "such as inventories, experience points, advancements and the like will not be saved when they log out."); ++ Object val = config.get("settings.save-player-data"); ++ if (val instanceof Boolean) { ++ SpigotConfig.disablePlayerDataSaving = !(Boolean) val; ++ SpigotConfig.config.set("players.disable-saving", SpigotConfig.disableAdvancementSaving); ++ SpigotConfig.save(); + } + } } -diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldNBTStorage.java -+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java -@@ -0,0 +0,0 @@ public class WorldNBTStorage { - } - - public void save(EntityHuman entityhuman) { -+ if(!com.destroystokyo.paper.PaperConfig.savePlayerData) return; // Paper - Make player data saving configurable - try { - NBTTagCompound nbttagcompound = entityhuman.save(new NBTTagCompound()); - File file = File.createTempFile(entityhuman.getUniqueIDString() + "-", ".dat", this.playerDir); diff --git a/Spigot-Server-Patches/Make-the-default-permission-message-configurable.patch b/Spigot-Server-Patches/Make-the-default-permission-message-configurable.patch index 2b34660d3a..cafa7f443d 100644 --- a/Spigot-Server-Patches/Make-the-default-permission-message-configurable.patch +++ b/Spigot-Server-Patches/Make-the-default-permission-message-configurable.patch @@ -25,9 +25,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + noPermissionMessage = ChatColor.translateAlternateColorCodes('&', getString("messages.no-permission", noPermissionMessage)); + } + - public static boolean savePlayerData = true; private static void savePlayerData() { - savePlayerData = getBoolean("settings.save-player-data", savePlayerData); + Object val = config.get("settings.save-player-data"); + if (val instanceof Boolean) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/work/Spigot b/work/Spigot index 37d799b230..a19903d24b 160000 --- a/work/Spigot +++ b/work/Spigot @@ -1 +1 @@ -Subproject commit 37d799b230195de166af55b0a746310ddcf92bc0 +Subproject commit a19903d24b3189e8769657b9b130f7ed5919b8b8