use of de.sanandrew.mods.claysoldiers.api.ICsmPlugin in project ClaySoldiersMod by SanAndreasP.
the class ClaySoldiersMod method loadPlugins.
private static void loadPlugins(ASMDataTable dataTable) {
String annotationClassName = CsmPlugin.class.getCanonicalName();
Set<ASMDataTable.ASMData> asmDatas = dataTable.getAll(annotationClassName);
for (ASMDataTable.ASMData asmData : asmDatas) {
try {
Class<?> asmClass = Class.forName(asmData.getClassName());
Class<? extends ICsmPlugin> asmInstanceClass = asmClass.asSubclass(ICsmPlugin.class);
ICsmPlugin instance = asmInstanceClass.getConstructor().newInstance();
PLUGINS.add(instance);
} catch (ClassNotFoundException | IllegalAccessException | ExceptionInInitializerError | InstantiationException | NoSuchMethodException | InvocationTargetException e) {
CsmConstants.LOG.log(Level.ERROR, "Failed to load: {}", asmData.getClassName(), e);
}
}
}
Aggregations