Paper/Spigot-Server-Patches/0212-Make-player-data-saving-configurable.patch

40 lines
2.0 KiB
Diff
Raw Normal View History

2019-07-20 06:01:24 +02:00
From af649ec80359ef4ec3bb5288a046a86b77bbc6be Mon Sep 17 00:00:00 2001
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
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
2019-07-20 06:01:24 +02:00
index 11f08c2b73..4169ec9a58 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -270,4 +270,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
2019-07-20 06:01:24 +02:00
index a0254d8e51..e60e10c57d 100644
--- a/src/main/java/net/minecraft/server/WorldNBTStorage.java
+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java
2019-04-28 19:59:47 +02:00
@@ -138,6 +138,7 @@ public class WorldNBTStorage implements IPlayerFileData {
2019-04-28 19:59:47 +02:00
@Override
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());
2019-04-28 19:59:47 +02:00
File file = new File(this.playerDir, entityhuman.getUniqueIDString() + ".dat.tmp");
--
2.22.0