PandacraftUtils/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/PandacraftUtilsCommandsManager.java

90 lines
2.1 KiB
Java
Raw Normal View History

package net.mc_pandacraft.java.plugin.pandacraftutils.commands;
import java.util.HashMap;
import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils;
/**
* Initialise et stoque toutes les instances des classes exécutant les commandes Minecraft, géré par le plugin
*/
2015-02-15 08:02:02 +01:00
public class PandacraftUtilsCommandsManager {
2015-02-15 08:02:02 +01:00
private static PandacraftUtilsCommandsManager instance;
/**
* Retourne l'unique instance de la classe. Si elle n'existe pas, on tente de créer
* @return L'unique instance de la classe
*/
2015-02-15 08:02:02 +01:00
public synchronized static PandacraftUtilsCommandsManager getInstance() {
if (instance == null)
loadNewInstance();
return instance;
}
public synchronized static void loadNewInstance() {
2015-02-15 08:02:02 +01:00
instance = new PandacraftUtilsCommandsManager();
}
private PandacraftUtils plugin = PandacraftUtils.getInstance();
private HashMap<String, AbstractCommandExecutor> commandExecutors = new HashMap<String, AbstractCommandExecutor>();
2015-02-15 08:02:02 +01:00
private PandacraftUtilsCommandsManager() {
/*
* Initialisation des commandes
*/
add(new Command_Selection());
2015-01-25 05:49:23 +01:00
add(new CommandAdmin());
add(new CommandAfk());
2015-01-25 05:49:23 +01:00
add(new CommandAutomessager());
add(new CommandBroadcast());
add(new CommandCubo());
add(new CommandList());
add(new CommandMe());
add(new CommandPing());
add(new CommandSetblock());
add(new CommandStaff());
add(new CommandSystem());
add(new CommandAnimal());
add(new CommandCoeur());
2015-02-17 03:48:02 +01:00
add(new CommandMuco());
add(new CommandModo());
2015-04-02 20:46:29 +02:00
add(new CommandGhost());
2015-05-11 04:44:35 +02:00
add(new CommandTell());
add(new CommandMail());
add(new CommandReply());
// complétion des commandes des autres plugins
plugin.getServer().getScheduler().runTaskLater(plugin, new Runnable() {
@Override public void run() {
plugin.getServer().getPluginCommand("region").setTabCompleter(new TabCompleterWorldGuardRegion());
}
}, 1L);
}
private void add(AbstractCommandExecutor ace) {
commandExecutors.put(ace.getCommandName(), ace);
}
public AbstractCommandExecutor get(String cmdName) {
return commandExecutors.get(cmdName);
}
}