geforkt von Mirrors/Paper
709d95ae00
This will force the saves to spread over multiple ticks even when many players auto save interval is aligned, avoiding spikes on large servers. Closes #1021
58 Zeilen
2.6 KiB
Diff
58 Zeilen
2.6 KiB
Diff
From eb0e0d138fb18e6ecb794916ee2a251cd0a63fb9 Mon Sep 17 00:00:00 2001
|
|
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
|
|
index 459c86bce..ea6fcb39f 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
@@ -262,4 +262,13 @@ public class PaperConfig {
|
|
maxPlayerAutoSavePerTick = (playerAutoSaveRate == -1 || playerAutoSaveRate > 100) ? 10 : 20;
|
|
}
|
|
}
|
|
+
|
|
+ public static boolean removeInvalidStatistics = false;
|
|
+ private static void removeInvalidStatistics() {
|
|
+ if (version < 12) {
|
|
+ boolean oldValue = getBoolean("remove-invalid-statistics", false);
|
|
+ set("settings.remove-invalid-statistics", oldValue);
|
|
+ }
|
|
+ removeInvalidStatistics = getBoolean("settings.remove-invalid-statistics", false);
|
|
+ }
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/ServerStatisticManager.java b/src/main/java/net/minecraft/server/ServerStatisticManager.java
|
|
index 14af226f3..e3d2c0ff7 100644
|
|
--- a/src/main/java/net/minecraft/server/ServerStatisticManager.java
|
|
+++ b/src/main/java/net/minecraft/server/ServerStatisticManager.java
|
|
@@ -86,6 +86,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();
|
|
@@ -119,9 +120,17 @@ public class ServerStatisticManager extends StatisticManager {
|
|
hashmap.put(statistic, statisticwrapper);
|
|
} else {
|
|
ServerStatisticManager.b.warn("Invalid statistic in {}: Don\'t know what {} is", 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;
|
|
}
|
|
}
|
|
--
|
|
2.16.2
|
|
|