From 09edb9af1134d544ec8734fb39ef8686c08e611d Mon Sep 17 00:00:00 2001 From: Pepich Date: Wed, 1 Feb 2017 20:15:51 +0100 Subject: [PATCH] Fixed debugger/module loader not registering their own commands --- .../redstoner/coremods/debugger/Debugger.java | 18 ++++++++---------- .../coremods/moduleLoader/ModuleLoader.java | 17 +++++++---------- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/src/com/redstoner/coremods/debugger/Debugger.java b/src/com/redstoner/coremods/debugger/Debugger.java index 83ae327..fd595fb 100644 --- a/src/com/redstoner/coremods/debugger/Debugger.java +++ b/src/com/redstoner/coremods/debugger/Debugger.java @@ -20,21 +20,22 @@ import com.redstoner.modules.CoreModule; /** The Debugger class, first Module to be loaded, responsible for debug interactions such as subscribing to method calls and getting field values on runtime. * * @author Pepich */ -@Version(major = 1, minor = 0, revision = 2, compatible = -1) +@Version(major = 1, minor = 0, revision = 3, compatible = -1) public final class Debugger implements CoreModule, Listener { private static Debugger instance; private static HashMap> subs; - static - { - instance = new Debugger(); - } - private Debugger() { subs = new HashMap<>(); - CommandManager.registerCommand(getCommandString(), instance, Main.plugin); + } + + public static void init() + { + if (instance == null) + instance = new Debugger(); + CommandManager.registerCommand(instance.getCommandString(), instance, Main.plugin); } public static void notifyMethod(Object... params) @@ -173,7 +174,4 @@ public final class Debugger implements CoreModule, Listener { notifyMethod(recipient, message); } - - public static void init() - {} } diff --git a/src/com/redstoner/coremods/moduleLoader/ModuleLoader.java b/src/com/redstoner/coremods/moduleLoader/ModuleLoader.java index d4d5cef..88e81d3 100644 --- a/src/com/redstoner/coremods/moduleLoader/ModuleLoader.java +++ b/src/com/redstoner/coremods/moduleLoader/ModuleLoader.java @@ -21,24 +21,21 @@ import com.redstoner.modules.Module; /** The module loader, mother of all modules. Responsible for loading and taking care of all modules. * * @author Pepich */ -@Version(major = 1, minor = 1, revision = 1, compatible = -1) +@Version(major = 1, minor = 1, revision = 2, compatible = -1) public final class ModuleLoader implements CoreModule { private static ModuleLoader instance; private static final ArrayList modules = new ArrayList(); - static - { - instance = new ModuleLoader(); - } - private ModuleLoader() - { - CommandManager.registerCommand(getCommandString(), instance, Main.plugin); - } + {} public static void init() - {} + { + if (instance == null) + instance = new ModuleLoader(); + CommandManager.registerCommand(instance.getCommandString(), instance, Main.plugin); + } /** This method will add a module to the module list, without enabling it *