-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
48 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 43 additions & 10 deletions
53
src/main/java/spigey/asteroide/mixin/ChatMessageC2SMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,60 @@ | ||
package spigey.asteroide.mixin; | ||
|
||
import meteordevelopment.meteorclient.systems.modules.Modules; | ||
import net.minecraft.network.PacketByteBuf; | ||
import net.minecraft.network.message.LastSeenMessageList; | ||
import net.minecraft.network.message.MessageSignatureData; | ||
import net.minecraft.network.packet.c2s.play.ChatMessageC2SPacket; | ||
import net.minecraft.world.border.WorldBorder; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Overwrite; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.*; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.ModifyArg; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import spigey.asteroide.modules.WordFilterModule; | ||
|
||
import java.time.Instant; | ||
|
||
import static meteordevelopment.meteorclient.utils.player.ChatUtils.info; | ||
|
||
@Mixin(ChatMessageC2SPacket.class) | ||
public abstract class ChatMessageC2SMixin { | ||
@Mutable | ||
@Shadow | ||
@Final | ||
private String chatMessage; | ||
|
||
/** | ||
* @author Spigey | ||
* @reason Word Filter | ||
* | ||
@Overwrite | ||
public String chatMessage(){ | ||
if(Modules.get().get(WordFilterModule.class).isActive()) return "WOAH DUDE!!! IT WORKED!!!111"; | ||
return "ermm what the sigma."; | ||
} */ | ||
*/ | ||
@Inject(method = "<init>(Ljava/lang/String;Ljava/time/Instant;JLnet/minecraft/network/message/MessageSignatureData;Lnet/minecraft/network/message/LastSeenMessageList$Acknowledgment;)V", at = @At("RETURN")) | ||
private void onChatMessageC2SPacket(String string, Instant timestamp, long salt, MessageSignatureData signature, LastSeenMessageList.Acknowledgment acknowledgment, CallbackInfo ci){ | ||
if(!Modules.get().get(WordFilterModule.class).isActive()) return; | ||
WordFilterModule filter = Modules.get().get(WordFilterModule.class); | ||
String content = this.chatMessage; | ||
String[] datshit = content.split(" "); | ||
StringBuilder message = new StringBuilder(); | ||
boolean pleasekillme = false; | ||
for (int i = 0; i < datshit.length; i++) { | ||
for (int j = 0; j < filter.messages.get().size(); j++) { | ||
if (datshit[i].toLowerCase().contains(filter.messages.get().get(j).toLowerCase())) { | ||
pleasekillme = true; | ||
if (filter.woblox.get()) { | ||
String temp = ""; | ||
for (int k = 0; k < datshit[i].length(); k++) { | ||
temp += filter.roblock.get(); | ||
} | ||
datshit[i] = temp; | ||
} else { | ||
datshit[i] = filter.replacement.get(); | ||
} | ||
} | ||
} | ||
} | ||
for (int i = 0; i < datshit.length; i++) { | ||
message.append(datshit[i]).append(" "); | ||
} | ||
if (pleasekillme && !content.trim().equalsIgnoreCase(message.toString().trim())) this.chatMessage = content; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters