Don't save empty scoreboard teams to scoreboard.dat - Fixes #244

While I can't think of any reason to do this except some REALLY weird workflow, I still added a config
to let you save them incase someone runs into issues.
This commit is contained in:
Aikar 2016-05-07 23:39:22 -04:00
parent 0494f36efe
commit c10df228a7
2 changed files with 36 additions and 0 deletions

View file

@ -0,0 +1,35 @@
From 6b473248bd86bc52923944193dab9587e0a49959 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 1199fa2..f5f1e2a 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -223,4 +223,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 3ef20d3..db72494 100644
--- a/src/main/java/net/minecraft/server/PersistentScoreboard.java
+++ b/src/main/java/net/minecraft/server/PersistentScoreboard.java
@@ -182,6 +182,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());
--
2.8.2

View file

@ -59,6 +59,7 @@ import FileIOThread
import ItemBlock
import NBTTagCompound
import NBTTagList
import PersistentScoreboard
import PacketPlayInResourcePackStatus
import PacketPlayInUseEntity
import PacketPlayOutPlayerListHeaderFooter