aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0094-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch
blob: dceeebf8fc7436b20890378e36e5df816ef79dc9 (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
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 13debcbff95b26f17677db876a23cff33825c881..a037c09a7616874d26b2a8eda9ebc795b8266431 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 b837b6616a2384b253cca8ed62c9488b639f6298..0efb63d1a4cefede25712daf9cea0f5c3256980f 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()));