summaryrefslogtreecommitdiff
path: root/src/com/redstoner/modules/Module.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/redstoner/modules/Module.java')
-rw-r--r--src/com/redstoner/modules/Module.java27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/com/redstoner/modules/Module.java b/src/com/redstoner/modules/Module.java
index 78488b7..1c89e15 100644
--- a/src/com/redstoner/modules/Module.java
+++ b/src/com/redstoner/modules/Module.java
@@ -1,11 +1,12 @@
package com.redstoner.modules;
import com.redstoner.annotations.Version;
+import com.redstoner.coremods.moduleLoader.ModuleLoader;
/** Interface for the Module class. Modules must always have an empty constructor to be invoked by the ModuleLoader.
*
* @author Pepich */
-@Version(major = 3, minor = 0, revision = 0, compatible = 2)
+@Version(major = 4, minor = 0, revision = 0, compatible = 0)
public interface Module
{
/** Will be called when the module gets enabled. */
@@ -23,13 +24,31 @@ public interface Module
public default void onDisable()
{}
- /** Gets called on registration of the module.
- * THIS WAS ONLY KEPT FOR COMPATIBILITY REASONS. Please register commands yourself instead using the "postEnable" method.
+ /** Gets called on registration of the module, when this option is selected for command registration
*
* @return The String used for the CommandManager to register the commands. */
- @Deprecated
public default String getCommandString()
{
return null;
}
+
+ public default ModuleLogger getLogger()
+ {
+ return ModuleLoader.getModuleLogger(this);
+ }
+
+ /** This method gets run the very first time a module gets loaded. You can use this to set up file structures or background data. */
+ public default void firstLoad()
+ {}
+
+ /** This method gets run every time a module gets loaded and its version has changed.
+ *
+ * @param old The version of the previous module. */
+ public default void migrate(Version old)
+ {}
+
+ default void setPrefix(final String name)
+ {
+ getLogger().setName(name);
+ }
}