Paper/Spigot-Server-Patches/0098-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch

33 lines
1.8 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 3d9a98936cfe933fd71fb82f07e1ba54d5d35800..6fbf9ab53c8b7fab93b55d815060033f945d56cd 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -229,4 +229,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/server/PersistentScoreboard.java b/src/main/java/net/minecraft/server/PersistentScoreboard.java
index 17bb9512e65f1a158efdc39813b04159000d9b33..a08c54da92d87fcd24ef8e2556901d3b1977c5ea 100644
--- a/src/main/java/net/minecraft/server/PersistentScoreboard.java
+++ b/src/main/java/net/minecraft/server/PersistentScoreboard.java
@@ -174,6 +174,7 @@ public class PersistentScoreboard extends PersistentBase {
while (iterator.hasNext()) {
ScoreboardTeam scoreboardteam = (ScoreboardTeam) iterator.next();
+ if (!com.destroystokyo.paper.PaperConfig.saveEmptyScoreboardTeams && scoreboardteam.getPlayerNameSet().isEmpty()) continue; // Paper
NBTTagCompound nbttagcompound = new NBTTagCompound();
nbttagcompound.setString("Name", scoreboardteam.getName());