From dd35ae9fec2fefd96911a66f5207a61831180b48 Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Tue, 24 Aug 2021 18:45:40 -0500 Subject: [PATCH] Squash "Clear SyncLoadInfo" into "Add debug for sync chunk loads" and add tab completion for the clear argument (#6483) --- .../Add-debug-for-sync-chunk-loads.patch | 28 ++++++++++++- patches/server/Clear-SyncLoadInfo.patch | 40 ------------------- 2 files changed, 27 insertions(+), 41 deletions(-) delete mode 100644 patches/server/Clear-SyncLoadInfo.patch diff --git a/patches/server/Add-debug-for-sync-chunk-loads.patch b/patches/server/Add-debug-for-sync-chunk-loads.patch index 09167263d7..167d2a9e50 100644 --- a/patches/server/Add-debug-for-sync-chunk-loads.patch +++ b/patches/server/Add-debug-for-sync-chunk-loads.patch @@ -7,7 +7,10 @@ This patch adds a tool to find calls to getChunkAt which would load chunks, however it must be enabled by setting the startup flag -Dpaper.debug-sync-loads=true -To get a debug log for sync loads, the command is /paper syncloadinfo +- To get a debug log for sync loads, the command is + /paper syncloadinfo +- To clear clear the currently stored sync load info, use + /paper syncloadinfo clear diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -50,6 +53,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public PaperCommand(String name) { super(name); +@@ -0,0 +0,0 @@ public class PaperCommand extends Command { + return getListMatchingLast(sender, args, worldNames); + } + break; ++ case "syncloadinfo": ++ if (args.length == 2) { ++ return getListMatchingLast(sender, args, "clear"); ++ } ++ break; + } + return Collections.emptyList(); + } @@ -0,0 +0,0 @@ public class PaperCommand extends Command { case "fixlight": this.doFixLight(sender, args); @@ -69,6 +84,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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(); @@ -135,6 +157,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public final Long2IntOpenHashMap coordinateTimes = new Long2IntOpenHashMap(); + } + ++ public static void clear() { ++ SYNC_LOADS.clear(); ++ } ++ + public static void logSyncLoad(final Level world, final int chunkX, final int chunkZ) { + if (!ENABLED) { + return; diff --git a/patches/server/Clear-SyncLoadInfo.patch b/patches/server/Clear-SyncLoadInfo.patch deleted file mode 100644 index 6b97609186..0000000000 --- a/patches/server/Clear-SyncLoadInfo.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Tom -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 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperCommand.java -+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java -@@ -0,0 +0,0 @@ public class PaperCommand extends Command { - 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 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java -+++ b/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java -@@ -0,0 +0,0 @@ public class SyncLoadFinder { - public final Long2IntOpenHashMap coordinateTimes = new Long2IntOpenHashMap(); - } - -+ public static void clear() { -+ SYNC_LOADS.clear(); -+ } -+ - public static void logSyncLoad(final Level world, final int chunkX, final int chunkZ) { - if (!ENABLED) { - return;