Paper/Spigot-Server-Patches/0674-Clear-SyncLoadInfo.patch

41 lines
2.0 KiB
Diff
Raw Permalink Normal View History

2021-02-26 23:14:02 +01:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tom <cryptite@gmail.com>
Date: Fri, 26 Feb 2021 16:10:53 -0600
Subject: [PATCH] Clear SyncLoadInfo
This patch merely adds the extra argument "clear" after /paper syncloadinfo to clear currently stored syncload info.
diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
2021-03-16 14:04:28 +01:00
index 4b3efe01750d79bcc27a42b5a145d9aa6b124d18..12313a37ceeb6a0b6a539c38fdba67e5e43d7413 100644
2021-02-26 23:14:02 +01:00
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
@@ -295,6 +295,13 @@ public class PaperCommand extends Command {
2021-02-26 23:14:02 +01:00
sender.sendMessage(ChatColor.RED + "This command requires the server startup flag '-Dpaper.debug-sync-loads=true' to be set.");
return;
}
+
+ if (args.length > 1 && args[1].equals("clear")) {
+ SyncLoadFinder.clear();
+ sender.sendMessage(ChatColor.GRAY + "Sync load data cleared.");
+ return;
+ }
+
File file = new File(new File(new File("."), "debug"),
"sync-load-info" + DateTimeFormatter.ofPattern("yyyy-MM-dd_HH.mm.ss").format(LocalDateTime.now()) + ".txt");
file.getParentFile().mkdirs();
diff --git a/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java b/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java
2021-03-16 14:04:28 +01:00
index d381f91cf105bfc01846ada90da8971a3618e784..c51401bcfac0a1e45099af1dd355073c19790476 100644
2021-02-26 23:14:02 +01:00
--- a/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java
+++ b/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java
2021-03-16 14:04:28 +01:00
@@ -26,6 +26,10 @@ public class SyncLoadFinder {
2021-02-26 23:14:02 +01:00
public final Long2IntOpenHashMap coordinateTimes = new Long2IntOpenHashMap();
}
+ public static void clear() {
+ SYNC_LOADS.clear();
+ }
+
public static void logSyncLoad(final World world, final int chunkX, final int chunkZ) {
if (!ENABLED) {
return;