Skip to content

Instantly share code, notes, and snippets.

@Muwbi
Muwbi / gist:8824810
Created February 5, 2014 14:32
register listeners recursively
public void registerListeners() throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException {
PluginManager pluginManager = this.getServer().getPluginManager();
for(ClassPath.ClassInfo classInfo: ClassPath.from(this.getClassLoader()).getTopLevelClasses("de.muwbi.clashofnations.listeners")) {
pluginManager.registerEvents((Listener) Class.forName(classInfo.getName()).newInstance(), this);
}
}