diff options
author | Florian Rinke <develop@torui.de> | 2021-10-14 01:13:57 +0200 |
---|---|---|
committer | Florian Rinke <develop@torui.de> | 2021-10-14 01:13:57 +0200 |
commit | 30ec17ea2e0b6337787cc627fbe1efb9c45e8a8e (patch) | |
tree | d2608738e2f179fbb2ffc21b02361de96e55c7ed | |
parent | 1997f001ac51721bf0aa768c6197f60cf68a7b2f (diff) | |
download | COFL-30ec17ea2e0b6337787cc627fbe1efb9c45e8a8e.tar.gz COFL-30ec17ea2e0b6337787cc627fbe1efb9c45e8a8e.tar.bz2 COFL-30ec17ea2e0b6337787cc627fbe1efb9c45e8a8e.zip |
fix an error where /cofl in callbacks fails
-rw-r--r-- | src/main/java/de/torui/coflsky/WSCommandHandler.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/main/java/de/torui/coflsky/WSCommandHandler.java b/src/main/java/de/torui/coflsky/WSCommandHandler.java index bbc3021..eb18dfd 100644 --- a/src/main/java/de/torui/coflsky/WSCommandHandler.java +++ b/src/main/java/de/torui/coflsky/WSCommandHandler.java @@ -13,14 +13,18 @@ import net.minecraft.client.audio.SoundEventAccessorComposite; import net.minecraft.client.audio.SoundHandler; import net.minecraft.client.audio.SoundManager; import net.minecraft.command.ICommandManager; +import net.minecraft.command.ICommandSender; import net.minecraft.entity.Entity; import net.minecraft.event.ClickEvent; import net.minecraft.event.ClickEvent.Action; import net.minecraft.event.HoverEvent; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.integrated.IntegratedServerCommandManager; import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatStyle; import net.minecraft.util.IChatComponent; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.ClientCommandHandler; public class WSCommandHandler { @@ -64,8 +68,14 @@ public class WSCommandHandler { private static void Execute(Command cmd, Entity sender) { System.out.println("Execute: " + cmd.getData() + " sender:" + sender); - - Minecraft.getMinecraft().thePlayer.sendChatMessage(WSClient.gson.fromJson(cmd.getData(), String.class)); + String dummy = WSClient.gson.fromJson(cmd.getData(), String.class); + + if(dummy.startsWith("/cofl")) { + ClientCommandHandler.instance.executeCommand(sender, dummy); + } else { + Minecraft.getMinecraft().thePlayer.sendChatMessage(dummy); + } + } @@ -112,7 +122,7 @@ public class WSCommandHandler { private static void WriteToChat(Command cmd) { WriteToChatCommand wcmd = WSClient.gson.fromJson(cmd.getData(), WriteToChatCommand.class); - + IChatComponent comp = CommandToChatComponent(wcmd); if (comp != null) { |