From dc9bcd2cfd9330fb4b56ff26670c871a91ab24d8 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Sat, 24 Dec 2016 22:44:36 +0100 Subject: [PATCH] Made more commands show in /u help (#57) --- .../chat/commands/ucmds/HelpCommand.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/java/buttondevteam/chat/commands/ucmds/HelpCommand.java b/src/main/java/buttondevteam/chat/commands/ucmds/HelpCommand.java index a8b697c..4f62fc6 100644 --- a/src/main/java/buttondevteam/chat/commands/ucmds/HelpCommand.java +++ b/src/main/java/buttondevteam/chat/commands/ucmds/HelpCommand.java @@ -35,10 +35,15 @@ public final class HelpCommand extends UCommandBase { ArrayList text = new ArrayList(); text.add("§6---- Command list ----"); for (TBMCCommandBase cmd : TBMCChatAPI.GetCommands().values()) - if (!cmd.GetCommandPath().contains(" ")) - if (!cmd.GetModOnly() || PluginMain.permission.has(sender, "tbmc.admin")) - if (!cmd.GetPlayerOnly() || sender instanceof Player) + if (!cmd.GetModOnly() || PluginMain.permission.has(sender, "tbmc.admin")) + if (!cmd.GetPlayerOnly() || sender instanceof Player) + if (!cmd.GetCommandPath().contains(" ")) text.add("/" + cmd.GetCommandPath()); + else { + final String topcmd = cmd.GetCommandPath().substring(0, cmd.GetCommandPath().indexOf(' ')); + if (!text.contains("/" + topcmd)) + text.add("/" + topcmd); + } sender.sendMessage(text.toArray(new String[text.size()])); } else if (args[0].equalsIgnoreCase("colors")) { sender.sendMessage(new String[] { "§6---- Chat colors/formats ----", // @@ -65,8 +70,9 @@ public final class HelpCommand extends UCommandBase { if (subcmds.length > 0) sender.sendMessage(subcmds); else - sender.sendMessage(new String[] { "§cError: Command not found or you don't have permission for it: " + path, - "Usage example: /u accept --> /u help u accept" }); + sender.sendMessage( + new String[] { "§cError: Command not found or you don't have permission for it: " + path, + "Usage example: /u accept --> /u help u accept" }); } else sender.sendMessage(cmd.GetHelpText(args[0])); }