From 90dd6d190eb91d02f0012a4cd103a601b7cfa665 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Thu, 3 Nov 2016 16:58:54 +0100 Subject: [PATCH] Added an actually logical overload --- .../buttondevteam/lib/chat/TBMCChatAPI.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/main/java/buttondevteam/lib/chat/TBMCChatAPI.java b/src/main/java/buttondevteam/lib/chat/TBMCChatAPI.java index ae46009..21c7a62 100644 --- a/src/main/java/buttondevteam/lib/chat/TBMCChatAPI.java +++ b/src/main/java/buttondevteam/lib/chat/TBMCChatAPI.java @@ -105,6 +105,32 @@ public class TBMCChatAPI { } } + /** + *

+ * This method adds a plugin's command to help and sets it's executor. + *

+ *

+ * The command must be registered in the caller plugin's plugin.yml. Otherwise the plugin will output a messsage to console. + *

+ *

+ * Using this method after the server is done loading will have no effect. + *

+ * + * @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); + } + } + /** *

* Add player information for {@link PlayerInfoCommand}. Only mods can see the given information.