aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/torui/coflsky/CoflSkyCommand.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/torui/coflsky/CoflSkyCommand.java')
-rw-r--r--src/main/java/de/torui/coflsky/CoflSkyCommand.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/main/java/de/torui/coflsky/CoflSkyCommand.java b/src/main/java/de/torui/coflsky/CoflSkyCommand.java
index 20cfeba..411a943 100644
--- a/src/main/java/de/torui/coflsky/CoflSkyCommand.java
+++ b/src/main/java/de/torui/coflsky/CoflSkyCommand.java
@@ -2,6 +2,7 @@ package de.torui.coflsky;
import java.io.IOException;
import java.util.Arrays;
+import java.util.Base64;
import java.util.List;
import de.torui.coflsky.commands.Command;
@@ -89,6 +90,24 @@ public class CoflSkyCommand extends CommandBase {
case "reset":
HandleReset();
break;
+ case "connect":
+
+ if(args.length == 2) {
+ String destination = args[1];
+
+ if(!destination.contains("://")) {
+ destination = new String(Base64.getDecoder().decode(destination));
+ }
+ sender.addChatMessage(new ChatComponentText("Stopping connection!"));
+ CoflSky.Wrapper.stop();
+ sender.addChatMessage(new ChatComponentText("Opening connection to " + destination));
+ if(CoflSky.Wrapper.initializeNewSocket(destination)) {
+ sender.addChatMessage(new ChatComponentText("Success"));
+ } else {
+ sender.addChatMessage(new ChatComponentText("Could not open connection, please check the logs"));
+ }
+ }
+ break;
default:
CommandNotRecognized(args, sender);
return;