From 5b97c3fd1c5c78edfcc936daecd28c923a64ef5b Mon Sep 17 00:00:00 2001 From: Ben Woo <30431861+benwoo1110@users.noreply.github.com> Date: Thu, 16 Jan 2025 10:10:33 +0800 Subject: [PATCH] Fix mv dumps unable to get latest.log if world-container is changed --- .../multiverse/core/commands/DumpsCommand.java | 10 +++++----- .../multiverse/core/utils/file/FileUtils.java | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/mvplugins/multiverse/core/commands/DumpsCommand.java b/src/main/java/org/mvplugins/multiverse/core/commands/DumpsCommand.java index 85d03f6d7..cc0003226 100644 --- a/src/main/java/org/mvplugins/multiverse/core/commands/DumpsCommand.java +++ b/src/main/java/org/mvplugins/multiverse/core/commands/DumpsCommand.java @@ -153,7 +153,7 @@ public void run() { */ private String getLogs() { // Get the Path of latest.log - Path logsPath = plugin.getServer().getWorldContainer().toPath().resolve("logs").resolve("latest.log"); + Path logsPath = fileUtils.getServerFolder().toPath().resolve("logs/latest.log"); File logsFile = logsPath.toFile(); if (!logsFile.exists()) { @@ -194,24 +194,24 @@ private void addDebugInfoToEvent(MVDumpsDebugInfoEvent event) { // add config.yml File configFile = new File(plugin.getDataFolder(), "config.yml"); - event.putDetailedDebugInfo("multiverse-core/config.yml", configFile); + event.putDetailedDebugInfo("Multiverse-Core/config.yml", configFile); // add worlds.yml File worldsFile = new File(plugin.getDataFolder(), "worlds.yml"); - event.putDetailedDebugInfo("multiverse-core/worlds.yml", worldsFile); + event.putDetailedDebugInfo("Multiverse-Core/worlds.yml", worldsFile); // Add bukkit.yml if we found it if (fileUtils.getBukkitConfig() != null) { event.putDetailedDebugInfo(fileUtils.getBukkitConfig().getPath(), fileUtils.getBukkitConfig()); } else { - Logging.warning("/mv version could not find bukkit.yml. Not including file"); + Logging.warning("/mv dumps could not find bukkit.yml. Not including file"); } // Add server.properties if we found it if (fileUtils.getServerProperties() != null) { event.putDetailedDebugInfo(fileUtils.getServerProperties().getPath(), fileUtils.getServerProperties()); } else { - Logging.warning("/mv version could not find server.properties. Not including file"); + Logging.warning("/mv dumps could not find server.properties. Not including file"); } } diff --git a/src/main/java/org/mvplugins/multiverse/core/utils/file/FileUtils.java b/src/main/java/org/mvplugins/multiverse/core/utils/file/FileUtils.java index 90229835c..e0e005f53 100644 --- a/src/main/java/org/mvplugins/multiverse/core/utils/file/FileUtils.java +++ b/src/main/java/org/mvplugins/multiverse/core/utils/file/FileUtils.java @@ -38,13 +38,13 @@ public class FileUtils { @Inject protected FileUtils(@NotNull MultiverseCore plugin) { - this.serverFolder = getServerFolder(plugin); + this.serverFolder = getServerFolder(); Logging.fine("Server folder: " + this.serverFolder); this.bukkitYml = findFileFromServerDirectory("bukkit.yml"); this.serverProperties = findFileFromServerDirectory("server.properties"); } - private File getServerFolder(@NotNull Plugin plugin) { + public File getServerFolder() { return new File(System.getProperty("user.dir")); }