2015-01-22 09:32:47 +01:00
|
|
|
package net.mc_pandacraft.java.plugin.pandacraftutils.commands;
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialise et stoque toutes les instances des classes exécutant les commandes Minecraft, géré par le plugin
|
|
|
|
*/
|
|
|
|
public class CommandsManager {
|
|
|
|
|
|
|
|
private static CommandsManager 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
|
|
|
|
*/
|
|
|
|
public synchronized static CommandsManager getInstance() {
|
|
|
|
if (instance == null)
|
|
|
|
loadNewInstance();
|
|
|
|
return instance;
|
|
|
|
}
|
|
|
|
|
|
|
|
public synchronized static void loadNewInstance() {
|
|
|
|
instance = new CommandsManager();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private HashMap<String, AbstractCommandExecutor> commandExecutors = new HashMap<String, AbstractCommandExecutor>();
|
|
|
|
|
|
|
|
private CommandsManager() {
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialisation des commandes
|
|
|
|
*/
|
|
|
|
add(new Command_Selection());
|
2015-01-25 05:49:23 +01:00
|
|
|
add(new CommandAdmin());
|
2015-01-22 09:32:47 +01:00
|
|
|
add(new CommandAfk());
|
2015-01-25 05:49:23 +01:00
|
|
|
add(new CommandAutomessager());
|
2015-01-22 09:32:47 +01:00
|
|
|
add(new CommandBroadcast());
|
|
|
|
add(new CommandCubo());
|
|
|
|
add(new CommandList());
|
|
|
|
add(new CommandMe());
|
|
|
|
add(new CommandPing());
|
|
|
|
add(new CommandSetblock());
|
|
|
|
add(new CommandStaff());
|
|
|
|
add(new CommandSystem());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void add(AbstractCommandExecutor ace) {
|
|
|
|
commandExecutors.put(ace.getCommandName(), ace);
|
|
|
|
}
|
|
|
|
|
|
|
|
public AbstractCommandExecutor get(String cmdName) {
|
|
|
|
return commandExecutors.get(cmdName);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|