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 PandacraftUtilsCommandsManager { 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 */ public synchronized static PandacraftUtilsCommandsManager getInstance() { if (instance == null) loadNewInstance(); return instance; } public synchronized static void loadNewInstance() { instance = new PandacraftUtilsCommandsManager(); } private HashMap commandExecutors = new HashMap(); private PandacraftUtilsCommandsManager() { /* * Initialisation des commandes */ add(new Command_Selection()); add(new CommandAdmin()); add(new CommandAfk()); 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()); add(new CommandMuco()); } private void add(AbstractCommandExecutor ace) { commandExecutors.put(ace.getCommandName(), ace); } public AbstractCommandExecutor get(String cmdName) { return commandExecutors.get(cmdName); } }