Fixed/finished cmd system...

This commit is contained in:
Norbi Peti 2016-12-15 18:24:56 +01:00
parent 7719f016e5
commit e54b54bac0

View file

@ -15,6 +15,7 @@ import org.reflections.scanners.SubTypesScanner;
import org.reflections.util.ClasspathHelper; import org.reflections.util.ClasspathHelper;
import org.reflections.util.ConfigurationBuilder; import org.reflections.util.ConfigurationBuilder;
import buttondevteam.core.CommandCaller;
import buttondevteam.core.MainPlugin; import buttondevteam.core.MainPlugin;
import buttondevteam.lib.TBMCChatEvent; import buttondevteam.lib.TBMCChatEvent;
import buttondevteam.lib.TBMCCoreAPI; import buttondevteam.lib.TBMCCoreAPI;
@ -102,6 +103,7 @@ public class TBMCChatAPI {
if (!CheckForNulls(plugin, c)) if (!CheckForNulls(plugin, c))
continue; continue;
commands.put(c.GetCommandPath(), c); commands.put(c.GetCommandPath(), c);
CommandCaller.RegisterCommand(c);
} catch (InstantiationException e) { } catch (InstantiationException e) {
TBMCCoreAPI.SendException("An error occured while registering command " + cmd.getName(), e); TBMCCoreAPI.SendException("An error occured while registering command " + cmd.getName(), e);
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
@ -139,6 +141,7 @@ public class TBMCChatAPI {
if (!CheckForNulls(plugin, c)) if (!CheckForNulls(plugin, c))
return; return;
commands.put(c.GetCommandPath(), c); commands.put(c.GetCommandPath(), c);
CommandCaller.RegisterCommand(c);
} catch (Exception e) { } catch (Exception e) {
TBMCCoreAPI.SendException("An error occured while registering command " + thecmdclass.getSimpleName(), e); TBMCCoreAPI.SendException("An error occured while registering command " + thecmdclass.getSimpleName(), e);
} }
@ -167,6 +170,7 @@ public class TBMCChatAPI {
try { try {
cmd.plugin = plugin; cmd.plugin = plugin;
commands.put(cmd.GetCommandPath(), cmd); commands.put(cmd.GetCommandPath(), cmd);
CommandCaller.RegisterCommand(cmd);
} catch (Exception e) { } catch (Exception e) {
TBMCCoreAPI.SendException("An error occured while registering command " + cmd.GetCommandPath(), e); TBMCCoreAPI.SendException("An error occured while registering command " + cmd.GetCommandPath(), e);
} }