mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-12-04 16:43:53 +01:00
985b5655f5
This has been in work for a bunch of time. Zoe ( duplexsystem or budgidiere, whatever ) has put a ton of work into this. We now have a bugfree build system that works flawlessly. Co-authored-by: Ivan Pekov <ivan@mrivanplays.com> Co-authored-by: Simon Gardling <titaniumtown@gmail.com> Co-authored-by: toinouH <toinouh2003@gmail.com> P.s the one who merged this is ivan and not bud.
54 lines
2.2 KiB
Diff
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
|
|
|
|
}
|
|
|