feat: added method to get module instances

This commit is contained in:
əlemi 2023-03-04 01:23:43 +01:00
parent 976659d310
commit 4dddbe5fba
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -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) {