From 058c0837f0455d4a967d18dc22290d145482e701 Mon Sep 17 00:00:00 2001 From: Kermina Awad Date: Sun, 14 Jun 2020 16:04:58 -0400 Subject: [PATCH] bring multi-file pastes to parity with single file pastes --- .../MultiverseCore/commands/VersionCommand.java | 7 ++++--- .../MultiverseCore/event/MVVersionEvent.java | 9 +++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/VersionCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/VersionCommand.java index 00912846..3f4b26f5 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/VersionCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/VersionCommand.java @@ -81,7 +81,7 @@ public class VersionCommand extends MultiverseCommand { "| --- | --- |" + System.lineSeparator() + "| Multiverse-Core Version | `" + this.plugin.getDescription().getVersion() + "` |" + System.lineSeparator() + "| Bukkit Version | `" + this.plugin.getServer().getVersion() + "` |" + System.lineSeparator() + - //"| Loaded Worlds | `" + this.plugin.getMVWorldManager().getMVWorlds() + "` |" + System.lineSeparator() + + "| Loaded Worlds | `" + this.plugin.getMVWorldManager().getMVWorlds() + "` |" + System.lineSeparator() + "| Multiverse Plugins Loaded | `" + this.plugin.getPluginCount() + "` |" + System.lineSeparator() + "| Economy being used | `" + plugin.getEconomist().getEconomyName() + "` |" + System.lineSeparator() + "| Permissions Plugin | `" + this.plugin.getMVPerms().getType() + "` |" + System.lineSeparator() + @@ -134,7 +134,7 @@ public class VersionCommand extends MultiverseCommand { File configFile = new File(this.plugin.getDataFolder(), "config.yml"); files.put(configFile.getName(), this.readFile(configFile.getAbsolutePath())); - // Add the config.yml + // Add the worlds.yml File worldConfig = new File(this.plugin.getDataFolder(), "worlds.yml"); files.put(worldConfig.getName(), this.readFile(worldConfig.getAbsolutePath())); return files; @@ -148,13 +148,14 @@ public class VersionCommand extends MultiverseCommand { } MVVersionEvent versionEvent = new MVVersionEvent(this.getLegacyString(), this.getVersionFiles()); - final Map files = this.getVersionFiles(); this.plugin.getServer().getPluginManager().callEvent(versionEvent); String versionInfo = versionEvent.getVersionInfo(); + Map files = versionEvent.getDetailedVersionInfo(); if (CommandHandler.hasFlag("--include-plugin-list", args)) { versionInfo = versionInfo + System.lineSeparator() + "Plugins: " + getPluginList(); + files.put("plugins.txt", "Plugins: " + getPluginList()); } final String data = versionInfo; diff --git a/src/main/java/com/onarandombox/MultiverseCore/event/MVVersionEvent.java b/src/main/java/com/onarandombox/MultiverseCore/event/MVVersionEvent.java index 43c1ddfc..a63d7020 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/event/MVVersionEvent.java +++ b/src/main/java/com/onarandombox/MultiverseCore/event/MVVersionEvent.java @@ -66,4 +66,13 @@ public class MVVersionEvent extends Event { public void appendVersionInfo(String moreVersionInfo) { this.versionInfoBuilder.append(moreVersionInfo); } + + /** + * Adds a file to to the detailed version-info currently saved in this event. + * @param filename The name of the file. + * @param text The file's content. + */ + public void putDetailedVersionInfo(String filename, String text) { + this.detailedVersionInfo.put(filename, text); + } }