From fb98c623a0f21ae1e65cfa621d589aaed5a0e38d Mon Sep 17 00:00:00 2001 From: Mark Vainomaa Date: Mon, 26 Mar 2018 18:30:53 +0300 Subject: [PATCH] Make player data saving configurable diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java index 2f3cfd4f0a..97a8fb0179 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -291,4 +291,13 @@ public class PaperConfig { private static void authenticationServersDownKickMessage() { 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."); + } + } } diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java index 0fd6efec0b..7553280d21 100644 --- a/src/main/java/net/minecraft/server/WorldNBTStorage.java +++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java @@ -141,6 +141,7 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData { } 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 = new File(this.playerDir, entityhuman.bu() + ".dat.tmp"); -- 2.19.0