diff options
author | Florian Rinke <develop@torui.de> | 2021-10-11 22:05:03 +0200 |
---|---|---|
committer | Florian Rinke <develop@torui.de> | 2021-10-11 22:05:03 +0200 |
commit | 1997f001ac51721bf0aa768c6197f60cf68a7b2f (patch) | |
tree | 560ed0d5bc96aaa71072e9a10293b47cd4c0261c /src | |
parent | 1d6746cf1c04e161d5cbfdba868776c06a34f459 (diff) | |
download | COFL-1997f001ac51721bf0aa768c6197f60cf68a7b2f.tar.gz COFL-1997f001ac51721bf0aa768c6197f60cf68a7b2f.tar.bz2 COFL-1997f001ac51721bf0aa768c6197f60cf68a7b2f.zip |
tried fixing onClick
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/de/torui/coflsky/WSCommandHandler.java | 6 | ||||
-rw-r--r-- | src/main/java/de/torui/coflsky/websocket/WSClientWrapper.java | 7 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/main/java/de/torui/coflsky/WSCommandHandler.java b/src/main/java/de/torui/coflsky/WSCommandHandler.java index 4dbb500..bbc3021 100644 --- a/src/main/java/de/torui/coflsky/WSCommandHandler.java +++ b/src/main/java/de/torui/coflsky/WSCommandHandler.java @@ -80,7 +80,6 @@ public class WSCommandHandler { } else { style = new ChatStyle() .setChatClickEvent(new ClickEvent(Action.RUN_COMMAND, "/cofl callback " + wcmd.OnClick)); - lastOnClickEvent = "/cofl callback " + wcmd.OnClick; } comp.setChatStyle(style); } @@ -116,7 +115,12 @@ public class WSCommandHandler { IChatComponent comp = CommandToChatComponent(wcmd); if (comp != null) + { + if(wcmd.OnClick != null) + lastOnClickEvent = "/cofl callback " + wcmd.OnClick; Minecraft.getMinecraft().thePlayer.addChatMessage(comp); + } + } } diff --git a/src/main/java/de/torui/coflsky/websocket/WSClientWrapper.java b/src/main/java/de/torui/coflsky/websocket/WSClientWrapper.java index 30ec739..30e5bc8 100644 --- a/src/main/java/de/torui/coflsky/websocket/WSClientWrapper.java +++ b/src/main/java/de/torui/coflsky/websocket/WSClientWrapper.java @@ -133,7 +133,12 @@ public class WSClientWrapper { } public synchronized void SendMessage(Command cmd){ - this.socket.SendCommand(cmd); + if(this.isRunning) { + this.socket.SendCommand(cmd); + } else { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("tried sending a callback to coflnet but failed. the connection must be closed.")); + } + } public void SendMessage(StringCommand sc) { |