Yatopia/patches/server/0022-Add-JsonList-save-timings.patch
Simon Gardling d059af01b6
Updated Upstream and Sidestream(s) (Paper/Purpur/AirplaneLite) (#362)
* Updated Upstream and Sidestream(s) (Paper/Purpur/AirplaneLite)

Upstream/An Sidestream has released updates that appears to apply and compile correctly
This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing.

Paper Changes:
fc4c0bc42 Reset shield blocking on dimension change
1c8b6065e Skip distance map update when spawning is disabled
091e6700f Added PlayerStonecutterRecipeSelectEvent
fc885f966 Add toggle for always placing the dragon egg
b3a6da3a7 Updated Upstream (Bukkit/CraftBukkit)
18ccc062d [Auto] Updated Upstream (Spigot)

Purpur Changes:
df9bd08 Config to use infinity bows without arrows (#149)
9d537bc Fix PlayerEditBookEvent not saving new book
3f8816d [ci-skip] Oops
5508728 [ci-skip] Add granny to funding
4c7ab70 Updated Upstream (Paper)
5eefb52 [ci-skip] Update Gradle to 6.8.1

AirplaneLite Changes:
459bb20 Remove patch
515fec7 Remove streams
fc94d7b Correct launcher name
0b153bd Update gradle version

* add Remove-streams.patch from AirplaneLite
2021-01-25 13:22:51 -06: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 1fc0139cb9694ddea41f57d95774c3b47e8530c5..a674140b61547841a1a6060e9f36aa14d0a86ff9 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
}