Skip to content

Commit

Permalink
did some other coding today
Browse files Browse the repository at this point in the history
  • Loading branch information
Spigey committed Apr 28, 2024
1 parent 7a6d046 commit 5479329
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/main/java/spigey/asteroide/modules/AntiAnnouncement.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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();}
}
}

0 comments on commit 5479329

Please sign in to comment.