Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. PluginManager pluginManager = getServer().getPluginManager();
  2. try {
  3. for (ClassPath.ClassInfo classInfo : ClassPath.from(getClassLoader()).getTopLevelClasses("de.simon.bedwars.listener")) {
  4. Class clazz = Class.forName(classInfo.getName());
  5.  
  6. if (Listener.class.isAssignableFrom(clazz)) {
  7. pluginManager.registerEvents((Listener) clazz.newInstance(), this);
  8. }
  9. }
  10. } catch (IOException | ClassNotFoundException | IllegalAccessException | InstantiationException ex) {
  11. ex.printStackTrace();
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement