CCBlueX Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Chat message detector and deleter

    Kotlin/Java
    5
    6
    182
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Ximatendr
      Ximatendr last edited by

      How to detect any message from chat and how to delete it? I need it for some type of ignore function.

      Plumer Man Larissa 2 Replies Last reply Reply Quote 0
      • Plumer Man
        Plumer Man @Ximatendr last edited by

        read c02 message and cancel it if it meets your conditions

        Ximatendr 1 Reply Last reply Reply Quote 0
        • Ximatendr
          Ximatendr @Plumer Man last edited by

          Uhm, I didn't get it, how does c02 (packet use entity) relate to message detection?

          1 Reply Last reply Reply Quote 0
          • A
            Aftery last edited by

            This post is deleted!
            Ali00035 1 Reply Last reply Reply Quote 1
            • Larissa
              Larissa @Ximatendr last edited by Larissa

              @ximatendr In the case of a lower version, may we need the detection of S02Packet?

              1 Reply Last reply Reply Quote 5
              • Ali00035
                Ali00035 Banned @Aftery last edited by Ali00035

                Explaining it in the rudest way possible.

                1. Import the S02PacketChat as @Aftery and @Plumer-Man said.
                var S02PacketChat = Java.type("net.minecraft.network.play.server.S02PacketChat");
                
                1. Check if the packet is S02PacketChat as @Larissa said, add this in module.on("packet", function(e) {
                if (e.getPacket() instanceof S02PacketChat) { 
                
                1. In order to read the message, you need to add this variable in the same place.
                var Message = e.getPacket().getChatComponent().getUnformattedText();
                
                1. 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.
                
                1 Reply Last reply Reply Quote 2
                • First post
                  Last post
                About
                • Terms of Service
                • Privacy Policy
                • Status
                • Contact Us
                Downloads
                • Releases
                • Source code
                • License
                Docs
                • Tutorials
                • CustomHUD
                • AutoSettings
                • ScriptAPI
                Community
                • Forum
                • Guilded
                • YouTube
                • Twitter
                • D.Tube