Allow Disabling Player Data Saving

By: Sander Knauff <sanderknauff@hotmail.com>
This commit is contained in:
CraftBukkit/Spigot 2020-11-07 18:23:42 +11:00
parent 76c24a1454
commit e81bcdf643
2 changed files with 15 additions and 2 deletions

View file

@ -11,7 +11,15 @@
import org.slf4j.Logger;
public class PlayerDataStorage {
@@ -49,34 +51,55 @@
@@ -33,6 +35,7 @@
}
public void save(Player player) {
+ if (org.spigotmc.SpigotConfig.disablePlayerDataSaving) return; // Spigot
try {
CompoundTag nbttagcompound = player.saveWithoutId(new CompoundTag());
Path path = this.playerDir.toPath();
@@ -49,34 +52,55 @@
}
@ -78,7 +86,7 @@
}
}
@@ -84,20 +107,44 @@
@@ -84,20 +108,44 @@
}
public Optional<CompoundTag> load(Player player) {

View file

@ -396,4 +396,9 @@ public class SpigotConfig
SpigotConfig.logVillagerDeaths = SpigotConfig.getBoolean("settings.log-villager-deaths", true);
SpigotConfig.logNamedDeaths = SpigotConfig.getBoolean("settings.log-named-deaths", true);
}
public static boolean disablePlayerDataSaving;
private static void disablePlayerDataSaving() {
SpigotConfig.disablePlayerDataSaving = SpigotConfig.getBoolean("players.disable-saving", false);
}
}