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

33 lines
1.9 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
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
2022-03-11 21:13:46 +01:00
index 77a8c86103bc91c696cb4f74e8cfcf4d57ca6c10..fc1933160f0bc70438c40fd3c0adb5675093af07 100644
2021-06-11 14:02:28 +02:00
--- 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 {
2021-06-11 14:02:28 +02:00
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
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
+++ b/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
2021-11-23 14:22:49 +01:00
@@ -136,6 +136,7 @@ public class ScoreboardSaveData extends SavedData {
2021-06-12 07:20:08 +02:00
ListTag listTag = new ListTag();
2021-06-11 14:02:28 +02:00
2021-06-12 07:20:08 +02:00
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()));