Added command registration to plugin config file. Registered commands are sent to the corresponding plugin.onCommand method when executed.

By: VictorD <victor.danell@gmail.com>
This commit is contained in:
Bukkit/Spigot
2011-01-16 16:30:34 +01:00
parent c72a7064d8
commit a17e7470e8
9 changed files with 184 additions and 0 deletions
@@ -0,0 +1,28 @@
package org.bukkit.plugin;
import org.bukkit.entity.Player;
public interface CommandManager {
/**
* Registers all the commands belonging to a certain plugin.
* @param plugin
* @return
*/
public boolean registerCommands(Plugin plugin);
/**
* Adds a command to the registeredCommands map. Returns true on success; false if name is already taken.
*
* @param command Name of command, without '/'-prefix.
* @return Returns true if command string was not already registered; false otherwise.
*/
public boolean registerCommand(String command, String tooltip, String helpMessage, Plugin plugin);
/** Looks up given string in registeredCommands map and calls the onCommand method on the
* appropriate plugin if found.
*
* @param cmdLine command + arguments. Example: "/test abc 123"
* @return targetFound returns false if no target is found.
*/
public boolean dispatchCommand(Player sender, String cmdLine);
}