Chat message detector and deleter
-
How to detect any message from chat and how to delete it? I need it for some type of ignore function.
read c02 message and cancel it if it meets your conditions
-
read c02 message and cancel it if it meets your conditions
-
How to detect any message from chat and how to delete it? I need it for some type of ignore function.
@ximatendr In the case of a lower version, may we need the detection of S02Packet?
-
Explaining it in the rudest way possible.
- Import the S02PacketChat as @Aftery and @Plumer-Man said.
var S02PacketChat = Java.type("net.minecraft.network.play.server.S02PacketChat");- Check if the packet is S02PacketChat as @Larissa said, add this in
module.on("packet", function(e) {
if (e.getPacket() instanceof S02PacketChat) {- In order to read the message, you need to add this variable in the same place.
var Message = e.getPacket().getChatComponent().getUnformattedText();- To check if the Message contains the string of your preference, you have to add this in the same place... again:
if (Message.toLowerCase().contains("string of your preference")) { e.cancelEvent(); } // change the "string of your preference" to what you want.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login