aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0205-Make-player-data-saving-configurable.patch
blob: 87ddc9131fe8a7b5f3bf2f8321951feadf20a3ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From 0000000000000000000000000000000000000000 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
index cee8740e644c492e3d71fd58791e7d52d57e856d..f22bed69f690f6e4754b87dd61cebe9c6627b12d 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -271,4 +271,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 ef9719bf20db92a7e6690bccb00cc54293d392a9..ae43d8d2af0daa68f13528d25bac1d94964662bc 100644
--- a/src/main/java/net/minecraft/server/WorldNBTStorage.java
+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java
@@ -27,6 +27,7 @@ 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);