Le commandManager faisait planter le chargment du plugin car la commande /region de WorldGuard n'était pas encore chargé à ce moment La commande /animal info permet de donner des informations sur l'animal sélectionné (si l'utilisateur en a les droits)
90 lines
2.1 KiB
Java
90 lines
2.1 KiB
Java
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
|
|
*/
|
|
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 PandacraftUtils plugin = PandacraftUtils.getInstance();
|
|
|
|
|
|
|
|
|
|
|
|
private HashMap<String, AbstractCommandExecutor> commandExecutors = new HashMap<String, AbstractCommandExecutor>();
|
|
|
|
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());
|
|
add(new CommandModo());
|
|
add(new CommandGhost());
|
|
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);
|
|
}
|
|
|
|
}
|