package net.onhaven.discord.faorebot;

import java.util.ArrayList;
import java.util.List;
import net.dv8tion.jda.core.hooks.ListenerAdapter;
import net.onhaven.discord.faorebot.api.ExtListener;
import net.onhaven.discord.faorebot.api.ExtModule;
import org.pf4j.DefaultPluginManager;

public class PluginManager extends DefaultPluginManager {
  public List<ExtModule> getExtModules() {
    return this.getExtensions(ExtModule.class);
  }

  public List<ExtListener> getExtListeners() {
    return this.getExtensions(ExtListener.class);
  }

  public List<ListenerAdapter> getListenerAdapers() {
    List<ExtListener> listeners = getExtListeners();
    List<ListenerAdapter> listenerAdapters = new ArrayList<ListenerAdapter>();
    for(ExtListener listener : listeners) {
      listenerAdapters.add(listener.getListener());
    }
    return listenerAdapters;
  }
}
