diff options
author | Torui <44932079+ToruiDev@users.noreply.github.com> | 2022-03-23 19:08:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-23 19:08:57 +0100 |
commit | bb935e5f731214377cbb55d7c00d3e7c0b49db4c (patch) | |
tree | 5b501812588da8439bd54ea3599c1a44cb856ce0 /src/main/java/de/torui/coflsky/CoflSkyCommand.java | |
parent | 1caa3e1840e51800200458b776712f38b470d772 (diff) | |
parent | 22ac509f260f6979038ad6626dd222ce43a3532a (diff) | |
download | COFL-bb935e5f731214377cbb55d7c00d3e7c0b49db4c.tar.gz COFL-bb935e5f731214377cbb55d7c00d3e7c0b49db4c.tar.bz2 COFL-bb935e5f731214377cbb55d7c00d3e7c0b49db4c.zip |
Merge pull request #51 from Coflnet/feature/implicit-connect
implicit connect & bug fixes
Diffstat (limited to 'src/main/java/de/torui/coflsky/CoflSkyCommand.java')
-rw-r--r-- | src/main/java/de/torui/coflsky/CoflSkyCommand.java | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/main/java/de/torui/coflsky/CoflSkyCommand.java b/src/main/java/de/torui/coflsky/CoflSkyCommand.java index c6b38fd..d5ee857 100644 --- a/src/main/java/de/torui/coflsky/CoflSkyCommand.java +++ b/src/main/java/de/torui/coflsky/CoflSkyCommand.java @@ -47,10 +47,11 @@ public class CoflSkyCommand extends CommandBase { } public static final String HelpText = "Available local sub-commands:\n" - + "start: starts a new connection\n" - + "stop: stops the connection\n" - + "reset: resets all local session information and stops the connection\n" - + "status: Emits status information\nServer-Only Commands:"; + + "§bstart: §7starts a new connection\n" + + "§bstop: §7stops the connection\n" + + "§bconnect: §7Connects to a different server\n" + + "§breset: §7resets all local session information and stops the connection\n" + + "§bstatus: §7Emits status information\nServer-Only Commands:"; @Override public void processCommand(ICommandSender sender, String[] args) throws CommandException { new Thread(()->{ @@ -109,10 +110,12 @@ public class CoflSkyCommand extends CommandBase { } else { sender.addChatMessage(new ChatComponentText("Could not open connection, please check the logs")); } + } else { + sender.addChatMessage(new ChatComponentText("§cPleace specify a server to connect to")); } break; default: - CommandNotRecognized(args, sender); + SendCommandToServer(args, sender); return; } } @@ -156,7 +159,7 @@ public class CoflSkyCommand extends CommandBase { return status; } - public void CommandNotRecognized(String[] args, ICommandSender sender) { + public void SendCommandToServer(String[] args, ICommandSender sender) { String command = String.join(" ", Arrays.copyOfRange(args, 1, args.length)); //JsonStringCommand sc = new JsonStringCommand(args[0], WSClient.gson.toJson(command)); @@ -164,7 +167,9 @@ public class CoflSkyCommand extends CommandBase { if(CoflSky.Wrapper.isRunning) { CoflSky.Wrapper.SendMessage(rc); } else { - sender.addChatMessage(new ChatComponentText("CoflSky not active. Server Commands are currently not available.").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED))); + sender.addChatMessage(new ChatComponentText("CoflSky wasn't active.").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED))); + CoflSky.Wrapper.startConnection(); + CoflSky.Wrapper.SendMessage(rc); } |