From c6a513b0760ce97f38194d02f082f2707e2dfc1a Mon Sep 17 00:00:00 2001 From: S-B99 Date: Mon, 28 Oct 2019 21:17:55 -0400 Subject: [PATCH] add send raw unicode module --- .../experimental/SendUnicodeModule.java | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/main/java/me/zeroeightsix/kami/module/modules/sdashb/experimental/SendUnicodeModule.java diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/sdashb/experimental/SendUnicodeModule.java b/src/main/java/me/zeroeightsix/kami/module/modules/sdashb/experimental/SendUnicodeModule.java new file mode 100644 index 00000000..18eb0fe8 --- /dev/null +++ b/src/main/java/me/zeroeightsix/kami/module/modules/sdashb/experimental/SendUnicodeModule.java @@ -0,0 +1,40 @@ +package me.zeroeightsix.kami.module.modules.sdashb.experimental; + +import me.zero.alpine.listener.EventHandler; +import me.zero.alpine.listener.Listener; +import me.zeroeightsix.kami.event.events.PacketEvent; +import me.zeroeightsix.kami.module.Module; +import net.minecraft.network.play.client.CPacketChatMessage; + +/** + * @author S-B99 + * Updated by S-B99 on 28/10/19 + */ +@Module.Info(name = "SendUnicode", category = Module.Category.MISC, description = "Converts all text into raw unicode") +public class SendUnicodeModule extends Module { + + //private Setting commands = register(Settings.b("Convert", true)); + + //private final String KAMI_SUFFIX = " \u23d0 \u1d0b\u1d00\u1d0d\u026a \u0299\u029f\u1d1c\u1d07"; + + @EventHandler + public Listener listener = new Listener<>(event -> { + if (event.getPacket() instanceof CPacketChatMessage) { + String toSend = ((CPacketChatMessage) event.getPacket()).getMessage(); + if (toSend.startsWith("/")) + return; + else if (toSend.startsWith(",")) + return; + else if (toSend.startsWith(".")) + return; + else if (toSend.startsWith("-")) + return; + + //toSend = toSend;//KAMI_SUFFIX; + if (toSend.length() >= 256) + toSend = toSend.substring(0,256); + ((CPacketChatMessage) event.getPacket()).message = toSend; + } + }); + +}