From 4965ab12460e64af57430f71c69be3c3243c21dc Mon Sep 17 00:00:00 2001 From: noil Date: Sun, 10 Nov 2019 14:37:50 -0500 Subject: [PATCH] Adds chatsuffix module --- .../impl/management/ModuleManager.java | 1 + .../impl/module/misc/ChatSuffixModule.java | 34 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 src/main/java/me/rigamortis/seppuku/impl/module/misc/ChatSuffixModule.java diff --git a/src/main/java/me/rigamortis/seppuku/impl/management/ModuleManager.java b/src/main/java/me/rigamortis/seppuku/impl/management/ModuleManager.java index 6a28b88..07786df 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/management/ModuleManager.java +++ b/src/main/java/me/rigamortis/seppuku/impl/management/ModuleManager.java @@ -141,6 +141,7 @@ public final class ModuleManager { add(new PortalFinderModule()); add(new ShulkerPreviewModule()); add(new LogoutSpotsModule()); + add(new ChatSuffixModule()); this.loadExternalModules(); } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/misc/ChatSuffixModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/misc/ChatSuffixModule.java new file mode 100644 index 0000000..da4a776 --- /dev/null +++ b/src/main/java/me/rigamortis/seppuku/impl/module/misc/ChatSuffixModule.java @@ -0,0 +1,34 @@ +package me.rigamortis.seppuku.impl.module.misc; + +import me.rigamortis.seppuku.Seppuku; +import me.rigamortis.seppuku.api.event.player.EventSendChatMessage; +import me.rigamortis.seppuku.api.module.Module; +import me.rigamortis.seppuku.impl.module.hidden.CommandsModule; +import net.minecraft.client.Minecraft; +import net.minecraft.network.play.client.CPacketChatMessage; +import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; + +/** + * created by noil on 11/8/19 at 7:48 PM + */ +public final class ChatSuffixModule extends Module { + + private final String prefix = "\u23D0 \uA731\u1D07\u1D18\u1D18\u1D1C\u1D0B\u1D1C"; + + public ChatSuffixModule() { + super("ChatSuffix", new String[]{"Suffix", "Chat_Suffix", "CustomChat", "Custom_Chat"}, "Add a custom suffix to your chat messages.", "NONE", -1, ModuleType.MISC); + } + + @Listener + public void onSendChatMessage(EventSendChatMessage event) { + final CommandsModule cmds = (CommandsModule) Seppuku.INSTANCE.getModuleManager().find(CommandsModule.class); + if (cmds == null) + return; + + if (event.getMessage().startsWith("/") || event.getMessage().startsWith(cmds.prefix.getString())) + return; + + event.setCanceled(true); + Minecraft.getMinecraft().getConnection().sendPacket(new CPacketChatMessage(event.getMessage() + " " + prefix)); + } +}