2017-01-07 05:45:59 +08:00
|
|
|
From 927e736bfd3f9dfcd1bea907e73f0675ceb1fc2a Mon Sep 17 00:00:00 2001
|
2016-12-22 02:41:30 +08:00
|
|
|
From: Zach Brown <zach.brown@destroystokyo.com>
|
|
|
|
Date: Tue, 20 Dec 2016 23:09:21 -0600
|
|
|
|
Subject: [PATCH] Add option to remove invalid statistics
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
2016-12-28 09:23:18 +08:00
|
|
|
index dcb971a..7e0f670 100644
|
2016-12-22 02:41:30 +08:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
2016-12-28 09:23:18 +08:00
|
|
|
@@ -246,4 +246,13 @@ public class PaperConfig {
|
2016-12-28 05:11:25 +08:00
|
|
|
private static void playerAutoSaveRate() {
|
|
|
|
playerAutoSaveRate = getInt("settings.player-auto-save-rate", -1);
|
2016-12-22 02:41:30 +08:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+ public static boolean removeInvalidStatistics = false;
|
|
|
|
+ private static void removeInvalidStatistics() {
|
2016-12-28 09:23:18 +08:00
|
|
|
+ if (version < 12) {
|
|
|
|
+ boolean oldValue = getBoolean("remove-invalid-statistics", false);
|
|
|
|
+ set("settings.remove-invalid-statistics", oldValue);
|
|
|
|
+ }
|
|
|
|
+ removeInvalidStatistics = getBoolean("settings.remove-invalid-statistics", false);
|
2016-12-22 02:41:30 +08:00
|
|
|
+ }
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/ServerStatisticManager.java b/src/main/java/net/minecraft/server/ServerStatisticManager.java
|
2016-12-28 09:23:18 +08:00
|
|
|
index 99466db..d1bee02 100644
|
2016-12-22 02:41:30 +08:00
|
|
|
--- a/src/main/java/net/minecraft/server/ServerStatisticManager.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/ServerStatisticManager.java
|
|
|
|
@@ -104,6 +104,7 @@ public class ServerStatisticManager extends StatisticManager {
|
|
|
|
JsonObject jsonobject = jsonelement.getAsJsonObject();
|
|
|
|
HashMap hashmap = Maps.newHashMap();
|
|
|
|
Iterator iterator = jsonobject.entrySet().iterator();
|
|
|
|
+ java.util.List<String> invalidStats = com.google.common.collect.Lists.newArrayList(); // Paper
|
|
|
|
|
|
|
|
while (iterator.hasNext()) {
|
|
|
|
Entry entry = (Entry) iterator.next();
|
|
|
|
@@ -137,9 +138,17 @@ public class ServerStatisticManager extends StatisticManager {
|
|
|
|
hashmap.put(statistic, statisticwrapper);
|
|
|
|
} else {
|
|
|
|
ServerStatisticManager.b.warn("Invalid statistic in {}: Don\'t know what {} is", new Object[] { this.d, entry.getKey()});
|
|
|
|
+ if (com.destroystokyo.paper.PaperConfig.removeInvalidStatistics) invalidStats.add((String) entry.getKey()); // Paper
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start - Remove invalid statistics
|
|
|
|
+ for (String invalid : invalidStats) {
|
|
|
|
+ jsonobject.remove(invalid);
|
|
|
|
+ ServerStatisticManager.b.info("Removing invalid statistic: " + invalid);
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
|
|
|
return hashmap;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--
|
2016-12-28 09:23:18 +08:00
|
|
|
2.9.3
|
2016-12-22 02:41:30 +08:00
|
|
|
|