Improvements to the compat manager.

This commit is contained in:
modmuss50 2015-08-30 21:16:22 +01:00
parent a5024d56d0
commit ebc685ba3d

View file

@ -28,11 +28,24 @@ public class CompatManager {
registerCompact(MinetweakerCompat.class, "MineTweaker3");
}
public void registerCompact(Class<?> moduleClass, String... modid) {
for (String id : modid) {
if (!Loader.isModLoaded(id)) {
public void registerCompact(Class<?> moduleClass, Object... objs) {
for(Object obj : objs){
if(obj instanceof String){
String modid = (String) obj;
if(modid.startsWith("!")){
if (Loader.isModLoaded(modid.replace("!", ""))) {
return;
}
} else {
if (!Loader.isModLoaded(modid)) {
return;
}
}
} else if(obj instanceof Boolean){
if(!(Boolean)obj){
return;
}
}
}
try {
compatModules.add((ICompatModule) moduleClass.newInstance());