diff options
Diffstat (limited to 'src/main/java/de/torui/coflsky/CoflSkyCommand.java')
-rw-r--r-- | src/main/java/de/torui/coflsky/CoflSkyCommand.java | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/src/main/java/de/torui/coflsky/CoflSkyCommand.java b/src/main/java/de/torui/coflsky/CoflSkyCommand.java index 6bb50de..6fc78a1 100644 --- a/src/main/java/de/torui/coflsky/CoflSkyCommand.java +++ b/src/main/java/de/torui/coflsky/CoflSkyCommand.java @@ -30,7 +30,17 @@ public class CoflSkyCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender sender) { - return "/cofl token <token> to register\n/coflsky start to connect\n/coflsky stop to stop"; + return HelpText; + } + + public static final String HelpText = "Available sub-commands:\n" + + "start: starts a new connection\n" + + "stop: stops the connection"; + + @Override + public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { + // TODO Auto-generated method stub + return super.addTabCompletionOptions(sender, args, pos); } @Override @@ -55,18 +65,29 @@ public class CoflSkyCommand extends CommandBase { CallbackCommand(args); break; default: + QueryServerCommands.QueryCommands(); sender.addChatMessage(new ChatComponentText("" + args[0] +"is not a valid subcommand!")); System.out.println(args[0] +"is not a valid subcommand!"); return; } - } + } - /*if(args.length == 2 && args[0].equals("token")) { - //todo: send authorisation message - }*/ + else { + ListHelp(sender); + } } + public void CommandNotRecognized(String[] args, ICommandSender sender) { + sender.addChatMessage(new ChatComponentText(HelpText)); + sender.addChatMessage(new ChatComponentText(QueryServerCommands.QueryCommands())); + } + + public void ListHelp(ICommandSender sender) { + sender.addChatMessage(new ChatComponentText(HelpText)); + sender.addChatMessage(new ChatComponentText(QueryServerCommands.QueryCommands())); + } + public void CallbackCommand(String[] args) { String command = String.join(" ", Arrays.copyOfRange(args, 1, args.length)); |