From 547932978e4d4d6a883320e6c77bcec9811f114e Mon Sep 17 00:00:00 2001 From: DieZeitungsente Date: Sun, 28 Apr 2024 19:19:22 +0200 Subject: [PATCH] did some other coding today --- .../asteroide/modules/AntiAnnouncement.java | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/main/java/spigey/asteroide/modules/AntiAnnouncement.java b/src/main/java/spigey/asteroide/modules/AntiAnnouncement.java index daa56ec..25a06a3 100644 --- a/src/main/java/spigey/asteroide/modules/AntiAnnouncement.java +++ b/src/main/java/spigey/asteroide/modules/AntiAnnouncement.java @@ -8,6 +8,7 @@ import meteordevelopment.meteorclient.systems.modules.Module; import meteordevelopment.orbit.EventHandler; import meteordevelopment.orbit.EventPriority; +import net.minecraft.network.packet.s2c.play.ChatMessageS2CPacket; import net.minecraft.network.packet.s2c.play.GameMessageS2CPacket; import spigey.asteroide.AsteroideAddon; @@ -34,11 +35,22 @@ public AntiAnnouncement() { @EventHandler(priority = EventPriority.HIGHEST + 1) private void PacketReceive(PacketEvent.Receive event){ banstuff(); - if(!(event.packet instanceof GameMessageS2CPacket)){return;} - String content = String.valueOf(((GameMessageS2CPacket) event.packet).content().getString()); - for(int i = 0; i < messages.get().size(); i++){ - if(content.toLowerCase().contains(messages.get().get(i).toLowerCase())){event.cancel();} + if(event.packet instanceof GameMessageS2CPacket) { + String content = String.valueOf(((GameMessageS2CPacket) event.packet).content().getString()); + for (int i = 0; i < messages.get().size(); i++) { + if (content.toLowerCase().contains(messages.get().get(i).toLowerCase())) { + event.cancel(); + } + } + if (content.replaceAll(" ", "") == "" && mtmsg.get()) { + event.cancel(); + } + } else if(event.packet instanceof ChatMessageS2CPacket){ + String content = String.valueOf(event.packet.toString()); + for(int i = 0; i < messages.get().size(); i++){ + if(content.toLowerCase().contains(messages.get().get(i).toLowerCase())){event.cancel();} + } + if(content.replaceAll(" ", "").replaceAll("\\n", "") == "" && mtmsg.get()){event.cancel();} } - if(content.replaceAll(" ", "") == "" && mtmsg.get()){event.cancel();} } }