0

Fixed debugger/module loader not registering their own commands

This commit is contained in:
Pepich 2017-02-01 20:15:51 +01:00
parent 0d2b8ad267
commit 09edb9af11
2 changed files with 15 additions and 20 deletions

View File

@ -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. /** 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 */ * @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 public final class Debugger implements CoreModule, Listener
{ {
private static Debugger instance; private static Debugger instance;
private static HashMap<CommandSender, ArrayList<String>> subs; private static HashMap<CommandSender, ArrayList<String>> subs;
static
{
instance = new Debugger();
}
private Debugger() private Debugger()
{ {
subs = new HashMap<>(); 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) public static void notifyMethod(Object... params)
@ -173,7 +174,4 @@ public final class Debugger implements CoreModule, Listener
{ {
notifyMethod(recipient, message); notifyMethod(recipient, message);
} }
public static void init()
{}
} }

View File

@ -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. /** The module loader, mother of all modules. Responsible for loading and taking care of all modules.
* *
* @author Pepich */ * @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 public final class ModuleLoader implements CoreModule
{ {
private static ModuleLoader instance; private static ModuleLoader instance;
private static final ArrayList<Module> modules = new ArrayList<Module>(); private static final ArrayList<Module> modules = new ArrayList<Module>();
static
{
instance = new ModuleLoader();
}
private ModuleLoader() private ModuleLoader()
{ {}
CommandManager.registerCommand(getCommandString(), instance, Main.plugin);
}
public static void init() 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 /** This method will add a module to the module list, without enabling it
* *