Solved Action Bar

Discussion in 'Plugin Development' started by Areoace, Jul 6, 2017.

Thread Status:
Not open for further replies.
  1. Offline

    Areoace

    I've been taking a break and decided to make a new plugin from scratch on 1.12, and came back to find that my code for action bars no longer works and gives me an error. The message is sent as a system message by default, how do I change it to an action bar? I get an error when I'm supposed to put a 2 in there

    HTML:
        public void sendPacket(Player p, String text)
        {
            PacketPlayOutChat packet = new PacketPlayOutChat(IChatBaseComponent.ChatSerializer.a("{\"text\":\"" + text + "\"}"),(byte) 2);
            ((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet);
        }
        
    Nvm, fixed the issue, 1.12 changed some things and I haven't found any information searching around, here's the fix;

    HTML:
        public void sendPacket(Player p, String text)
        {
            ChatMessageType b = ChatMessageType.GAME_INFO;
            PacketPlayOutChat packet = new PacketPlayOutChat(IChatBaseComponent.ChatSerializer.a("{\"text\":\"" + text + "\"}"), b);
            ((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet);
        }
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 6, 2017
  2. Offline

    RcExtract

    Try ActionBarAPI <Edit by Moderator: Redacted not allowed paid resource url>
     
    Last edited by a moderator: Feb 10, 2021
Thread Status:
Not open for further replies.

Share This Page