2015-03-17 23:06:34 +02:00
|
|
|
package modtweaker2.utils;
|
2015-01-11 21:59:45 +02:00
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
|
|
import cpw.mods.fml.common.Loader;
|
|
|
|
|
|
|
|
|
|
public class TweakerPlugin {
|
|
|
|
|
private static ArrayList<String> isLoaded = new ArrayList();
|
2015-04-24 23:25:07 +02:00
|
|
|
|
2015-01-11 21:59:45 +02:00
|
|
|
|
|
|
|
|
public static void register(String mod, Class clazz) {
|
|
|
|
|
if (Loader.isModLoaded(mod)) {
|
2015-04-07 23:16:53 +01:00
|
|
|
load(mod, clazz);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void load(String mod, Class clazz) {
|
|
|
|
|
try {
|
|
|
|
|
clazz.newInstance();
|
|
|
|
|
isLoaded.add(mod);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
isLoaded.remove(mod);
|
2015-01-11 21:59:45 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static boolean isLoaded(String string) {
|
|
|
|
|
return isLoaded.contains(string);
|
|
|
|
|
}
|
2015-04-24 23:25:07 +02:00
|
|
|
|
2015-01-11 21:59:45 +02:00
|
|
|
}
|