aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÄkwav <xekwavx@gmail.com>2021-10-16 17:32:32 +0200
committerÄkwav <xekwavx@gmail.com>2021-10-16 17:32:32 +0200
commit18034bbaa8616042b5bbed62e4128ed0e1b85bbe (patch)
treeeff482f829393da398db80ff9da0458290995a42
parent30ec17ea2e0b6337787cc627fbe1efb9c45e8a8e (diff)
downloadCOFL-18034bbaa8616042b5bbed62e4128ed0e1b85bbe.tar.gz
COFL-18034bbaa8616042b5bbed62e4128ed0e1b85bbe.tar.bz2
COFL-18034bbaa8616042b5bbed62e4128ed0e1b85bbe.zip
fixed hotkey for release
-rw-r--r--src/main/java/de/torui/coflsky/EventRegistry.java2
-rw-r--r--src/main/java/de/torui/coflsky/WSCommandHandler.java17
2 files changed, 11 insertions, 8 deletions
diff --git a/src/main/java/de/torui/coflsky/EventRegistry.java b/src/main/java/de/torui/coflsky/EventRegistry.java
index a05e213..dbca065 100644
--- a/src/main/java/de/torui/coflsky/EventRegistry.java
+++ b/src/main/java/de/torui/coflsky/EventRegistry.java
@@ -65,7 +65,7 @@ public class EventRegistry{
String command = WSCommandHandler.lastOnClickEvent;
WSCommandHandler.lastOnClickEvent = null;
//System.out.println(">>>>> HasLastONClickEvent = " + command);
- Minecraft.getMinecraft().thePlayer.sendChatMessage(command);
+ WSCommandHandler.Execute(command,Minecraft.getMinecraft().thePlayer);
}
diff --git a/src/main/java/de/torui/coflsky/WSCommandHandler.java b/src/main/java/de/torui/coflsky/WSCommandHandler.java
index eb18dfd..701b03d 100644
--- a/src/main/java/de/torui/coflsky/WSCommandHandler.java
+++ b/src/main/java/de/torui/coflsky/WSCommandHandler.java
@@ -69,17 +69,22 @@ public class WSCommandHandler {
private static void Execute(Command cmd, Entity sender) {
System.out.println("Execute: " + cmd.getData() + " sender:" + sender);
String dummy = WSClient.gson.fromJson(cmd.getData(), String.class);
-
- if(dummy.startsWith("/cofl")) {
- ClientCommandHandler.instance.executeCommand(sender, dummy);
+ Execute(dummy,sender);
+ }
+
+ public static void Execute(String cmd, Entity sender)
+ {
+ if(cmd.startsWith("/cofl") || cmd.startsWith("http")) {
+ ClientCommandHandler.instance.executeCommand(sender, cmd);
} else {
- Minecraft.getMinecraft().thePlayer.sendChatMessage(dummy);
+ Minecraft.getMinecraft().thePlayer.sendChatMessage(cmd);
}
-
}
private static IChatComponent CommandToChatComponent(WriteToChatCommand wcmd) {
+ if(wcmd.OnClick != null)
+ lastOnClickEvent = "/cofl callback " + wcmd.OnClick;
if (wcmd.Text != null) {
IChatComponent comp = new ChatComponentText(wcmd.Text);
@@ -126,8 +131,6 @@ public class WSCommandHandler {
IChatComponent comp = CommandToChatComponent(wcmd);
if (comp != null)
{
- if(wcmd.OnClick != null)
- lastOnClickEvent = "/cofl callback " + wcmd.OnClick;
Minecraft.getMinecraft().thePlayer.addChatMessage(comp);
}