summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
author alemi <me@alemi.dev>2023-03-04 01:23:43 +0100
committer alemi <me@alemi.dev>2023-03-04 01:23:43 +0100
commit4dddbe5fba9fa246192be453e9f3926c13f93666 (patch)
treebb651901d559b7d5cacaa2055f2b2ceb9378b7c7 /src/main
parent976659d310605ec3ac546478931e3cf341922ccd (diff)
feat: added method to get module instances
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/ftbsc/bscv/system/ModManager.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main/java/ftbsc/bscv/system/ModManager.java b/src/main/java/ftbsc/bscv/system/ModManager.java
index 2668a79..974142e 100644
--- a/src/main/java/ftbsc/bscv/system/ModManager.java
+++ b/src/main/java/ftbsc/bscv/system/ModManager.java
@@ -25,6 +25,17 @@ public class ModManager {
this.categories = new HashSet<>();
}
+
+ @Nullable
+ public IModule get(Class<? extends IModule> clazz) {
+ for (IModule m : this.mods) {
+ if (clazz.isAssignableFrom(m.getClass())) {
+ return m;
+ }
+ }
+ return null;
+ }
+
public void load() {
for (ILoadable module : ServiceLoader.load(ILoadable.class)) {
if(module instanceof IModule) {