1.8.8 Can't send title messages to player

Discussion in 'Spigot Plugin Development' started by Mimifan_, Oct 13, 2021.

  1. Hello everyone, sorry for bothering you if it's something easy to fix but I don't get how to send player a title message, showing on the foreground of their screen.

    This is the code I did:
    Code (Java):
    Player player = (Player)sender;
            IChatBaseComponent chatTitle = ChatSerializer.a("{\"text\":\"" + ChatColor.GREEN + "Hello " + ChatColor.GOLD + " you" + "\"}");
            PacketPlayOutTitle title = new PacketPlayOutTitle(EnumTitleAction.TITLE, chatTitle);
            PacketPlayOutTitle length = new PacketPlayOutTitle(5, 50, 5);
            ((CraftPlayer) player).getHandle().playerConnection.sendPacket(title);
            ((CraftPlayer) player).getHandle().playerConnection.sendPacket(length);
    Waiting for help :S Thank you in advance
    PS: I'm on 1.8 server with ViaVersion and tried without viaversion
  2. if you don't use Reflections for Multi Version Support than just use player#sendTitle()
  3. thanks everyone, I'll try that as soon as possible