Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Commit

Permalink
Add commands option to CustomChat
Browse files Browse the repository at this point in the history
Closes #37
  • Loading branch information
zeroeightysix committed Oct 11, 2018
1 parent a4cc530 commit 4249cbc
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import me.zero.alpine.listener.Listener;
import me.zeroeightsix.kami.event.events.PacketEvent;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.setting.Setting;
import net.minecraft.network.play.client.CPacketChatMessage;

/**
Expand All @@ -12,12 +13,16 @@
@Module.Info(name = "CustomChat", category = Module.Category.MISC, description = "Modifies your chat messages")
public class CustomChat extends Module {

@Setting(name = "Commands")
public boolean commands = false;

private final String KAMI_SUFFIX = " \u23D0 \u1D0B\u1D00\u1D0D\u026A";

@EventHandler
public Listener<PacketEvent.Send> listener = new Listener<>(event -> {
if (event.getPacket() instanceof CPacketChatMessage) {
String s = ((CPacketChatMessage) event.getPacket()).getMessage();
if (s.startsWith("/") && !commands) return;
s += KAMI_SUFFIX;
if (s.length() >= 256) s = s.substring(0,256);
((CPacketChatMessage) event.getPacket()).message = s;
Expand Down

0 comments on commit 4249cbc

Please sign in to comment.