diff --git a/src/main/java/buttondevteam/lib/chat/TBMCChatAPI.java b/src/main/java/buttondevteam/lib/chat/TBMCChatAPI.java index 54e69b3..b14da5c 100644 --- a/src/main/java/buttondevteam/lib/chat/TBMCChatAPI.java +++ b/src/main/java/buttondevteam/lib/chat/TBMCChatAPI.java @@ -101,15 +101,18 @@ public class TBMCChatAPI { * The command's class to create it (because why let you create the command class) */ public static void AddCommand(JavaPlugin plugin, Class thecmdclass, Object... params) { - plugin.getLogger().info("Registering command " + thecmdclass.getName() + " for " + plugin.getName()); + plugin.getLogger().info("Registering command " + thecmdclass.getSimpleName() + " for " + plugin.getName()); try { - TBMCCommandBase c = thecmdclass - .getConstructor(Arrays.stream(params).map(p -> p.getClass()).toArray(Class[]::new)) - .newInstance(params); + TBMCCommandBase c; + if (params.length > 0) + c = thecmdclass.getConstructor(Arrays.stream(params).map(p -> p.getClass()).toArray(Class[]::new)) + .newInstance(params); + else + c = thecmdclass.newInstance(); c.plugin = plugin; commands.put(c.GetCommandPath(), c); } catch (Exception e) { - TBMCCoreAPI.SendException("An error occured while registering command " + thecmdclass.getName(), e); + TBMCCoreAPI.SendException("An error occured while registering command " + thecmdclass.getSimpleName(), e); } }