Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

LiquidBounce Forum

  1. Home
  2. ScriptAPI
  3. Where is the mistake?

Where is the mistake?

Scheduled Pinned Locked Moved ScriptAPI
9 Posts 4 Posters 926 Views
  • 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.
  • ButterChickenB Offline
    ButterChickenB Offline
    ButterChicken
    wrote on last edited by ButterChicken
    #1

    help me!Why can't it be detected?

    var S45PacketTitle = Java.type("net.minecraft.network.play.server.S45PacketTitle");
    
    	this.onPacket = function(event) {
    			var packet = event.getPacket();
    			if(packet instanceof S45PacketTitle) {
    				if(packet.getType().equals(S45PacketTitle.Type.TITLE)) {
    					var text = packet.getMessage().getUnformattedText();
    					if (text.equals("Victory!")) { //problem
    						mc.thePlayer.sendChatMessage("GG");
    					}
    			}
    }
    
    C 1 Reply Last reply
    0
    • I Offline
      I Offline
      idkwhome v2
      wrote on last edited by
      #2

      gettype()

      ButterChickenB 1 Reply Last reply
      0
      • I idkwhome v2

        gettype()

        ButterChickenB Offline
        ButterChickenB Offline
        ButterChicken
        wrote on last edited by
        #3

        @idkwhome-v2 How to deal with it?

        CzechHekC 1 Reply Last reply
        0
        • ButterChickenB ButterChicken

          @idkwhome-v2 How to deal with it?

          CzechHekC Offline
          CzechHekC Offline
          CzechHek
          wrote on last edited by
          #4

          @ButterChicken Title messages are often in siblings or smth, print the component and find where the "Victory!" is.

          1 Reply Last reply
          1
          • ButterChickenB ButterChicken

            help me!Why can't it be detected?

            var S45PacketTitle = Java.type("net.minecraft.network.play.server.S45PacketTitle");
            
            	this.onPacket = function(event) {
            			var packet = event.getPacket();
            			if(packet instanceof S45PacketTitle) {
            				if(packet.getType().equals(S45PacketTitle.Type.TITLE)) {
            					var text = packet.getMessage().getUnformattedText();
            					if (text.equals("Victory!")) { //problem
            						mc.thePlayer.sendChatMessage("GG");
            					}
            			}
            }
            
            C Offline
            C Offline
            commandblock2
            wrote on last edited by commandblock2
            #5

            @ButterChicken said in Where is the mistake?:

            if (text.equals("Victory!")) { //problem
            mc.thePlayer.sendChatMessage("GG");
            }

            if (text.equals("Victory!")) { //problem
                mc.thePlayer.sendChatMessage("GG");
            } else chat.print(text) //So that u can actually see what the title really is (exact string will be shown in [CHAT in .minecraft/logs/latest.txt)
            

            but anyway I suggest to find/match part of the string. like text.contains("Victory") but it seemed that there is no such method in nashorn so u might have to use text.indexOf("Victory") != -1

            CzechHekC 1 Reply Last reply
            0
            • C commandblock2

              @ButterChicken said in Where is the mistake?:

              if (text.equals("Victory!")) { //problem
              mc.thePlayer.sendChatMessage("GG");
              }

              if (text.equals("Victory!")) { //problem
                  mc.thePlayer.sendChatMessage("GG");
              } else chat.print(text) //So that u can actually see what the title really is (exact string will be shown in [CHAT in .minecraft/logs/latest.txt)
              

              but anyway I suggest to find/match part of the string. like text.contains("Victory") but it seemed that there is no such method in nashorn so u might have to use text.indexOf("Victory") != -1

              CzechHekC Offline
              CzechHekC Offline
              CzechHek
              wrote on last edited by
              #6

              @commandblock2 Text would probably return "". So he would need to get siblings and stuff to get the msg. String.contains() is in Nashorn tho.

              C 1 Reply Last reply
              0
              • CzechHekC CzechHek

                @commandblock2 Text would probably return "". So he would need to get siblings and stuff to get the msg. String.contains() is in Nashorn tho.

                C Offline
                C Offline
                commandblock2
                wrote on last edited by commandblock2
                #7

                @CzechHek nvm I was blind

                if (text.equals("Victory!")) { //problem
                    mc.thePlayer.sendChatMessage("GG");
                } else chat.print(packet.getMessage()) // anyway that's better
                
                1 Reply Last reply
                0
                • ButterChickenB Offline
                  ButterChickenB Offline
                  ButterChicken
                  wrote on last edited by
                  #8

                  So have figured out a solution?

                  CzechHekC 1 Reply Last reply
                  0
                  • ButterChickenB ButterChicken

                    So have figured out a solution?

                    CzechHekC Offline
                    CzechHekC Offline
                    CzechHek
                    wrote on last edited by
                    #9

                    @ButterChicken That's what you were supposed to do.

                    @CzechHek said in Where is the mistake?:

                    @ButterChicken Title messages are often in siblings or smth, print the component and find where the "Victory!" is.

                    Here is the documentation: https://scriptapi.liquidbounce.net/net/minecraft/util/ChatComponentText.html

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    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
                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups