summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPepich <benedikt.abel@yahoo.de>2017-05-05 00:07:07 +0200
committerPepich <benedikt.abel@yahoo.de>2017-05-05 00:07:07 +0200
commit771b83c7d1496aee31d1ae6c38ae58caaf956afd (patch)
treeb6c3e96ac8f65f8e9c9722d7bd08c1db1a58fb28
parentbb95bf2700c8cec7049a1608b6e7f74c5d6d4ea7 (diff)
Added getModule function
-rw-r--r--src/com/redstoner/coremods/moduleLoader/ModuleLoader.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/com/redstoner/coremods/moduleLoader/ModuleLoader.java b/src/com/redstoner/coremods/moduleLoader/ModuleLoader.java
index 8126252..7739db9 100644
--- a/src/com/redstoner/coremods/moduleLoader/ModuleLoader.java
+++ b/src/com/redstoner/coremods/moduleLoader/ModuleLoader.java
@@ -35,7 +35,7 @@ import net.minecraft.server.v1_11_R1.MinecraftServer;
/** The module loader, mother of all modules. Responsible for loading and taking care of all modules.
*
* @author Pepich */
-@Version(major = 3, minor = 1, revision = 5, compatible = 2)
+@Version(major = 3, minor = 1, revision = 6, compatible = 2)
public final class ModuleLoader implements CoreModule
{
private static ModuleLoader instance;
@@ -467,4 +467,16 @@ public final class ModuleLoader implements CoreModule
status[4] = Bukkit.getOnlinePlayers().size();
return status;
}
+
+ /** Finds a module by name for other modules to reference it.
+ *
+ * @param name the name of the module. Use the full path if you are not sure about the module's SimpleClassName being unique.
+ * @return the instance of the module or @null it none could be found */
+ public static Module getModule(String name)
+ {
+ for (Module m : modules.keySet())
+ if (m.getClass().getSimpleName().equals(name) || m.getClass().getName().equals(name))
+ return m;
+ return null;
+ }
}