Added an actually logical overload

This commit is contained in:
Norbi Peti 2016-11-03 16:58:54 +01:00
parent 7131021a86
commit 90dd6d190e

View file

@ -105,6 +105,32 @@ public class TBMCChatAPI {
}
}
/**
* <p>
* This method adds a plugin's command to help and sets it's executor.
* </p>
* <p>
* The <u>command must be registered</u> in the caller plugin's plugin.yml. Otherwise the plugin will output a messsage to console.
* </p>
* <p>
* <i>Using this method after the server is done loading will have no effect.</i>
* </p>
*
* @param plugin
* The caller plugin
* @param cmd
* The command to add
*/
public static void AddCommand(JavaPlugin plugin, TBMCCommandBase cmd) {
plugin.getLogger().info("Registering command " + cmd.GetCommandPath() + " for " + plugin.getName());
try {
cmd.plugin = plugin;
commands.put(cmd.GetCommandPath(), cmd);
} catch (Exception e) {
TBMCCoreAPI.SendException("An error occured while registering command " + cmd.GetCommandPath(), e);
}
}
/**
* <p>
* Add player information for {@link PlayerInfoCommand}. Only mods can see the given information.