Paper/patches/server/0093-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch

33 lines
1.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 7 May 2016 23:33:08 -0400
Subject: [PATCH] Don't save empty scoreboard teams to scoreboard.dat
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index c8242aa5b4a896111b23de60fa120ec6be06d0ca..c6ca15a5cc53995ca0ada9c9ac9dc1d084963eb5 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -249,4 +249,9 @@ public class PaperConfig {
private static void enablePlayerCollisions() {
enablePlayerCollisions = getBoolean("settings.enable-player-collisions", true);
}
+
+ public static boolean saveEmptyScoreboardTeams = false;
+ private static void saveEmptyScoreboardTeams() {
+ saveEmptyScoreboardTeams = getBoolean("settings.save-empty-scoreboard-teams", false);
+ }
}
diff --git a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java b/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
index 819cd341c4e352a75c38a0ed48097170ddd53082..79683676311d0e13383887db5cb8638f13a0af94 100644
--- a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
+++ b/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
@@ -136,6 +136,7 @@ public class ScoreboardSaveData extends SavedData {
ListTag listTag = new ListTag();
for(PlayerTeam playerTeam : this.scoreboard.getPlayerTeams()) {
+ if (!com.destroystokyo.paper.PaperConfig.saveEmptyScoreboardTeams && playerTeam.getPlayers().isEmpty()) continue; // Paper
CompoundTag compoundTag = new CompoundTag();
compoundTag.putString("Name", playerTeam.getName());
compoundTag.putString("DisplayName", Component.Serializer.toJson(playerTeam.getDisplayName()));