Skip to content

Instantly share code, notes, and snippets.

@Muwbi
Created February 5, 2014 14:32
Show Gist options
  • Save Muwbi/8824810 to your computer and use it in GitHub Desktop.
Save Muwbi/8824810 to your computer and use it in GitHub Desktop.
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);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment