Yatopia/patches/server/0025-Add-JsonList-save-timings.patch
budgidiere c09ee99f7e
Hydrinity optimizations & Lithium generation patches & more
Closes #257 

Ports 2 patches from Purpur: Infinity-bow-settings & Allow-infinite-and-mending-enchantments-together
Added an option for infinity with no arrows too.

Option for custom locale has come! You can put a locale.json file in your server folder to change it. 

We've got the finest patches from Hydrinity ( Mykyta approved & allowed ) too.

We have some amazing new options in yatopia.yml, we're gonna have documentation for them soon so stay tuned!
Last but not least, chunk generation patches. We've tested them extensively so no weirdness happens.

Thanks for using Yatopia as your production server software.

Co-authored-by: Ivan Pekov <ivan@mrivanplays.com>
2020-10-27 21:15:13 +02:00

54 lines
2.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ivan Pekov <ivan@mrivanplays.com>
Date: Fri, 2 Oct 2020 17:48:01 +0300
Subject: [PATCH] Add JsonList save timings
diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java
index 68ab5ccb2fcfe1de0503c9336572f28e11832b2d..d8c1a8dd867437443494ac169569139e25c9a635 100644
--- a/src/main/java/co/aikar/timings/MinecraftTimings.java
+++ b/src/main/java/co/aikar/timings/MinecraftTimings.java
@@ -149,4 +149,6 @@ public final class MinecraftTimings {
public static Timing getCommandFunctionTiming(CustomFunction function) {
return Timings.ofSafe("Command Function - " + function.getMinecraftKey().toString());
}
+
+ public static Timing getJsonListTiming(String className) { return Timings.ofSafe("Save JsonList ( " + className + " )"); } // Yatopia
}
diff --git a/src/main/java/net/minecraft/server/JsonList.java b/src/main/java/net/minecraft/server/JsonList.java
index 9213bfb78e92b838189161045e3945588251b486..4094ef76b7b05de1bfcc28aa0ef13033abadeb7e 100644
--- a/src/main/java/net/minecraft/server/JsonList.java
+++ b/src/main/java/net/minecraft/server/JsonList.java
@@ -44,9 +44,11 @@ public abstract class JsonList<K, V extends JsonListEntry<K>> {
return null;
}
};
+ private final co.aikar.timings.Timing saveTiming; // Yatopia
public JsonList(File file) {
this.c = file;
+ saveTiming = co.aikar.timings.MinecraftTimings.getJsonListTiming(getClass().getSimpleName()); // Yatopia
}
public File b() {
@@ -146,6 +148,9 @@ public abstract class JsonList<K, V extends JsonListEntry<K>> {
}
public void save() throws IOException {
+ // Yatopia start
+ saveTiming.startTiming();
+ try { // Yatopia end
this.removeStaleEntries(); // Paper - remove expired values before saving
JsonArray jsonarray = new JsonArray();
@@ -177,6 +182,9 @@ public abstract class JsonList<K, V extends JsonListEntry<K>> {
}
}
+ } finally { // Yatopia start
+ saveTiming.stopTiming();
+ } // Yatopia end
}