aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorFlorian Rinke <develop@torui.de>2021-10-11 20:58:29 +0200
committerFlorian Rinke <develop@torui.de>2021-10-11 20:58:29 +0200
commit1d6746cf1c04e161d5cbfdba868776c06a34f459 (patch)
treefb307c96a61327cf84ddcf40fa5076d0c29deb5c /src/main
parent730982080309fd71134f4922d77591320a26874c (diff)
downloadCOFL-1d6746cf1c04e161d5cbfdba868776c06a34f459.tar.gz
COFL-1d6746cf1c04e161d5cbfdba868776c06a34f459.tar.bz2
COFL-1d6746cf1c04e161d5cbfdba868776c06a34f459.zip
try running every comand async
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/de/torui/coflsky/CoflSkyCommand.java91
1 files changed, 46 insertions, 45 deletions
diff --git a/src/main/java/de/torui/coflsky/CoflSkyCommand.java b/src/main/java/de/torui/coflsky/CoflSkyCommand.java
index f35be3c..fa2dcf8 100644
--- a/src/main/java/de/torui/coflsky/CoflSkyCommand.java
+++ b/src/main/java/de/torui/coflsky/CoflSkyCommand.java
@@ -50,52 +50,53 @@ public class CoflSkyCommand extends CommandBase {
+ "status: Emits status information\nServer-Only Commands:";
@Override
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- System.out.println(Arrays.toString(args));
-
- if(args.length >= 1) {
- switch(args[0]) {
- case "start":
- //todo: start
- sender.addChatMessage(new ChatComponentText("starting connection..."));
- CoflSky.Wrapper.startConnection();
- break;
- case "stop":
- CoflSky.Wrapper.stop();
- sender.addChatMessage(new ChatComponentText("you stopped the connection to ")
- .appendSibling(new ChatComponentText("C").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.DARK_BLUE)))
- .appendSibling(new ChatComponentText("oflnet").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GOLD)))
- .appendSibling(new ChatComponentText(".\n To reconnect enter "))
- .appendSibling(new ChatComponentText("\"").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.AQUA)))
- .appendSibling(new ChatComponentText("/cofl start"))
- .appendSibling(new ChatComponentText("\"").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.AQUA)))
- .appendSibling(new ChatComponentText(" or click this message"))
- .setChatStyle(new ChatStyle().setChatClickEvent(new ClickEvent(Action.RUN_COMMAND, "/cofl start")))
- );
- break;
- case "debug":
- // WSCommandHandler.HandleCommand(new Command(CommandType.Execute, "/me hewwo"), sender.getCommandSenderEntity());
- // WSCommandHandler.HandleCommand(new Command(CommandType.WriteToChat, "{ \"text\": \"Clickable Texts are fun\", \"onClick\": \"me Hello World\"}"), sender.getCommandSenderEntity());
- WSCommandHandler.HandleCommand(new Command(CommandType.PlaySound, "{\"name\":\"random.orb\",\"pitch\":0.5}"), sender.getCommandSenderEntity());
- break;
- case "callback":
- CallbackCommand(args);
- break;
- case "status":
- sender.addChatMessage(new ChatComponentText(StatusMessage()));
- break;
- case "reset":
- HandleReset();
- break;
- default:
- CommandNotRecognized(args, sender);
- return;
+ new Thread(()->{
+ System.out.println(Arrays.toString(args));
+
+ if(args.length >= 1) {
+ switch(args[0]) {
+ case "start":
+ //todo: start
+ sender.addChatMessage(new ChatComponentText("starting connection..."));
+ CoflSky.Wrapper.startConnection();
+ break;
+ case "stop":
+ CoflSky.Wrapper.stop();
+ sender.addChatMessage(new ChatComponentText("you stopped the connection to ")
+ .appendSibling(new ChatComponentText("C").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.DARK_BLUE)))
+ .appendSibling(new ChatComponentText("oflnet").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GOLD)))
+ .appendSibling(new ChatComponentText(".\n To reconnect enter "))
+ .appendSibling(new ChatComponentText("\"").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.AQUA)))
+ .appendSibling(new ChatComponentText("/cofl start"))
+ .appendSibling(new ChatComponentText("\"").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.AQUA)))
+ .appendSibling(new ChatComponentText(" or click this message"))
+ .setChatStyle(new ChatStyle().setChatClickEvent(new ClickEvent(Action.RUN_COMMAND, "/cofl start")))
+ );
+ break;
+ case "debug":
+ // WSCommandHandler.HandleCommand(new Command(CommandType.Execute, "/me hewwo"), sender.getCommandSenderEntity());
+ // WSCommandHandler.HandleCommand(new Command(CommandType.WriteToChat, "{ \"text\": \"Clickable Texts are fun\", \"onClick\": \"me Hello World\"}"), sender.getCommandSenderEntity());
+ WSCommandHandler.HandleCommand(new Command(CommandType.PlaySound, "{\"name\":\"random.orb\",\"pitch\":0.5}"), sender.getCommandSenderEntity());
+ break;
+ case "callback":
+ CallbackCommand(args);
+ break;
+ case "status":
+ sender.addChatMessage(new ChatComponentText(StatusMessage()));
+ break;
+ case "reset":
+ HandleReset();
+ break;
+ default:
+ CommandNotRecognized(args, sender);
+ return;
+ }
+ }
+
+ else {
+ ListHelp(sender);
}
- }
-
- else {
- ListHelp(sender);
- }
-
+ }).start();
}
private void HandleReset() {