feat: added method to get module instances
This commit is contained in:
parent
976659d310
commit
4dddbe5fba
1 changed files with 11 additions and 0 deletions
|
@ -25,6 +25,17 @@ public class ModManager {
|
||||||
this.categories = new HashSet<>();
|
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() {
|
public void load() {
|
||||||
for (ILoadable module : ServiceLoader.load(ILoadable.class)) {
|
for (ILoadable module : ServiceLoader.load(ILoadable.class)) {
|
||||||
if(module instanceof IModule) {
|
if(module instanceof IModule) {
|
||||||
|
|
Loading…
Reference in a new issue