Solved Send Packet to Client (LabyMod)

Discussion in 'Spigot Plugin Development' started by ProfSam, Jul 4, 2021.

  1. Hello, I have a problem. I'm trying to send a banner through a plugin to the player for the LabyMod client and I also wrote a method for it. On the 1.8 everything works fine, but on the 1.16 I get errors when sending the packets and I do not know how to transfer the code to the 1.16. On the 1.8 I tested it with ViaVersion and LabyMod3. I have the code from here: https://docs.labymod.net/pages/server/protocol/protocol/

    code:
    Code (Java):
       
    public static void sendLabyModMessage( Player player, String key, JsonElement messageContent ) {
    byte[] bytes = getBytesToSend( key, messageContent.toString() );
    PacketDataSerializer pds = new PacketDataSerializer( Unpooled.wrappedBuffer( bytes ) );
    PacketPlayOutCustomPayload payloadPacket = new PacketPlayOutCustomPayload( "labymod3:main", pds ); //here is the error
    ((CraftPlayer) player).getHandle().playerConnection.sendPacket( payloadPacket );
    }
     
    I have tried for several hours now but it does not work (Im not a big pro)
    Greetings from Germany
     
    • Like Like x 1