package me.toalec.RankUp;
import me.toalec.RankUp.Permissions.PermissionsManager;
import me.toalec.RankUp.Permissions.PermissionsManager.PermissionsType;
import me.toalec.RankUp.util.Utility;
import org.bukkit.event.Event;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
public class RankUp extends JavaPlugin{
@Override
public void onDisable() {
Utility.printConsole("Disabled!");
}
@Override
public void onEnable() {
Utility.printConsole("Loading...");
config = new ConfigManager(this);
config.load();
pm = new PermissionsManager(this, config.getString("rankup_permissions"));
if(isEnabled()){
PluginManager pluginManager = getServer().getPluginManager();
getServer().getPluginCommand("rankup").setExecutor(new CommandTrigger(this, config, pm));
pluginManager.registerEvent(Event.Type.PLAYER_CHAT, new WordTrigger(config, pm), Event.Priority.Low, this);
getServer().getPluginCommand("ru").setExecutor(new UtilityCommand(this, config, pm));
SignTrigger signTrigger = new SignTrigger(this, config, pm);
pluginManager.registerEvent(Event.Type.PLAYER_INTERACT, signTrigger, Event.Priority.Monitor, this);
pluginManager.registerEvent(Event.Type.SIGN_CHANGE, signTrigger.new SignPlace(), Event.Priority.Low, this);
if(pm.getPermissionsType().equals(PermissionsType.PERMISSIONS_BUKKIT)){
pluginManager.registerEvent(Event.Type.PLAYER_JOIN, pm, Event.Priority.Monitor, this);
}
}
Utility.printConsole("Finished!");
}
void disablePlugin(){
getServer().getPluginManager().disablePlugin(this);
}
private ConfigManager config;
private PermissionsManager pm;
}