aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/torui/coflsky/websocket/WSClient.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/torui/coflsky/websocket/WSClient.java')
-rw-r--r--src/main/java/de/torui/coflsky/websocket/WSClient.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/main/java/de/torui/coflsky/websocket/WSClient.java b/src/main/java/de/torui/coflsky/websocket/WSClient.java
index c26edf0..9641277 100644
--- a/src/main/java/de/torui/coflsky/websocket/WSClient.java
+++ b/src/main/java/de/torui/coflsky/websocket/WSClient.java
@@ -9,7 +9,10 @@ import org.java_websocket.handshake.ServerHandshake;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
+import de.torui.coflsky.WSCommandHandler;
import de.torui.coflsky.core.Command;
+import net.minecraft.client.Minecraft;
+import net.minecraft.server.MinecraftServer;
public class WSClient extends WebSocketClient{
@@ -43,12 +46,11 @@ public class WSClient extends WebSocketClient{
@Override
public void onMessage(String message) {
- System.out.println(message);
+ //System.out.println(message);
Command cmd = gson.fromJson(message, Command.class);
-
-
- System.out.println(cmd);
+ //System.out.println(cmd);
+ WSCommandHandler.HandleCommand(cmd, Minecraft.getMinecraft().thePlayer);
}
@Override
@@ -62,7 +64,8 @@ public class WSClient extends WebSocketClient{
}
public void SendCommand(Command command) {
-
+ String json = gson.toJson(command);
+ this.send(json);
}
}