diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/command/commands/CommandEcodebug.java b/Plugin/src/main/java/com/willfp/ecoenchants/command/commands/CommandEcodebug.java index 76f6919c..7f57526e 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/command/commands/CommandEcodebug.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/command/commands/CommandEcodebug.java @@ -5,6 +5,7 @@ import com.willfp.ecoenchants.command.AbstractCommand; import com.willfp.ecoenchants.display.EnchantmentCache; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchants; +import com.willfp.ecoenchants.extensions.ExtensionManager; import com.willfp.ecoenchants.util.Logger; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; @@ -41,6 +42,9 @@ public final class CommandEcodebug extends AbstractCommand { Logger.info("Running Version: " + EcoEnchantsPlugin.getInstance().getDescription().getVersion()); Logger.info(""); + Logger.info("Loaded Extensions: " + ExtensionManager.getLoadedExtensions().values().stream().map(pair -> pair.getFirst() + " v" + pair.getSecond()).collect(Collectors.joining())); + Logger.info(""); + Logger.info("EcoEnchants.getAll(): " + EcoEnchants.getAll().toString()); Logger.info(""); diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/extensions/ExtensionManager.java b/Plugin/src/main/java/com/willfp/ecoenchants/extensions/ExtensionManager.java index 51bdbdf9..e884d55b 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/extensions/ExtensionManager.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/extensions/ExtensionManager.java @@ -1,6 +1,7 @@ package com.willfp.ecoenchants.extensions; import com.willfp.ecoenchants.EcoEnchantsPlugin; +import com.willfp.ecoenchants.util.tuplets.Pair; import org.bukkit.Bukkit; import org.bukkit.configuration.file.YamlConfiguration; @@ -17,7 +18,7 @@ import java.util.Map; * Class containing method to load extensions */ public class ExtensionManager { - private static final Map extensions = new HashMap<>(); + private static final Map> extensions = new HashMap<>(); /** * Load all extensions @@ -63,12 +64,13 @@ public class ExtensionManager { } YamlConfiguration extensionYml = YamlConfiguration.loadConfiguration(new InputStreamReader(ymlIn)); - if (!extensionYml.getKeys(false).contains("main") || !extensionYml.getKeys(false).contains("name")) { + if (!extensionYml.getKeys(false).contains("main") || !extensionYml.getKeys(false).contains("name") || !extensionYml.getKeys(false).contains("version")) { throw new MalformedExtensionException("Invalid extension.yml found in " + extensionJar.getName()); } String mainClass = extensionYml.getString("main"); String name = extensionYml.getString("name"); + String version = extensionYml.getString("version"); Class cls; Object object = null; @@ -84,7 +86,7 @@ public class ExtensionManager { Extension extension = (Extension) object; extension.onEnable(); - extensions.put(extension, name); + extensions.put(extension, new Pair<>(name, version)); } /** @@ -109,7 +111,7 @@ public class ExtensionManager { * Get Map of all loaded extensions and their names * @return {@link Map} of {@link Extension}s and their names */ - public static Map getLoadedExtensions() { + public static Map> getLoadedExtensions() { return extensions; } } diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/loader/Loader.java b/Plugin/src/main/java/com/willfp/ecoenchants/loader/Loader.java index 0a516537..af842214 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/loader/Loader.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/loader/Loader.java @@ -273,8 +273,8 @@ public class Loader { Logger.info("&cNo extensions found"); } else { Logger.info("Extensions Loaded:"); - ExtensionManager.getLoadedExtensions().forEach((extension, name) -> { - Logger.info("- " + name); + ExtensionManager.getLoadedExtensions().forEach((extension, pair) -> { + Logger.info("- " + pair.getFirst() + " v" + pair.getSecond()); }); } Logger.info("");