2018-07-04 09:55:24 +02:00
|
|
|
From aca58cb4ceffa038818092885a94f1d5ba41b5ca Mon Sep 17 00:00:00 2001
|
2016-12-21 19:41:30 +01: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
|
2018-03-05 02:20:27 +01:00
|
|
|
index 459c86bce..ea6fcb39f 100644
|
2016-12-21 19:41:30 +01:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
2018-03-05 02:20:27 +01:00
|
|
|
@@ -262,4 +262,13 @@ public class PaperConfig {
|
|
|
|
maxPlayerAutoSavePerTick = (playerAutoSaveRate == -1 || playerAutoSaveRate > 100) ? 10 : 20;
|
|
|
|
}
|
2016-12-21 19:41:30 +01:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+ public static boolean removeInvalidStatistics = false;
|
|
|
|
+ private static void removeInvalidStatistics() {
|
2016-12-28 02:23:18 +01: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-21 19:41:30 +01:00
|
|
|
+ }
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/ServerStatisticManager.java b/src/main/java/net/minecraft/server/ServerStatisticManager.java
|
2018-01-18 07:00:51 +01:00
|
|
|
index 14af226f3..e3d2c0ff7 100644
|
2016-12-21 19:41:30 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/ServerStatisticManager.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/ServerStatisticManager.java
|
2017-05-14 20:05:01 +02:00
|
|
|
@@ -86,6 +86,7 @@ public class ServerStatisticManager extends StatisticManager {
|
2016-12-21 19:41:30 +01:00
|
|
|
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();
|
2017-05-14 20:05:01 +02:00
|
|
|
@@ -119,9 +120,17 @@ public class ServerStatisticManager extends StatisticManager {
|
2016-12-21 19:41:30 +01:00
|
|
|
hashmap.put(statistic, statisticwrapper);
|
|
|
|
} else {
|
2017-05-14 20:05:01 +02:00
|
|
|
ServerStatisticManager.b.warn("Invalid statistic in {}: Don\'t know what {} is", this.d, entry.getKey());
|
2016-12-21 19:41:30 +01:00
|
|
|
+ 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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--
|
2018-07-04 09:55:24 +02:00
|
|
|
2.18.0
|
2016-12-21 19:41:30 +01:00
|
|
|
|