diff options
author | alemi <me@alemi.dev> | 2023-03-04 01:23:43 +0100 |
---|---|---|
committer | alemi <me@alemi.dev> | 2023-03-04 01:23:43 +0100 |
commit | 4dddbe5fba9fa246192be453e9f3926c13f93666 (patch) | |
tree | bb651901d559b7d5cacaa2055f2b2ceb9378b7c7 /src/main/java/ftbsc | |
parent | 976659d310605ec3ac546478931e3cf341922ccd (diff) |
feat: added method to get module instances
Diffstat (limited to 'src/main/java/ftbsc')
-rw-r--r-- | src/main/java/ftbsc/bscv/system/ModManager.java | 11 |
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) { |