Solved send Actionbar?

Discussion in 'Spigot Plugin Development' started by aufgosh, Feb 21, 2020.

  1. I tested the code in that link and it works for me on 1.15.2.

    To do this, you need these two imports.

    Code (Text):
    import net.md_5.bungee.api.ChatMessageType;
    The actual method to send messages to the players:
    Code (Java):
    p.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("your message here"));
    Make sure you have the imports that I mentioned.
    Also the object p is the player that you want the message to be sent to.

    If you still have errors, let me know and I can try to help figure it out.
    • Like Like x 2
    • Agree Agree x 1
  2. Code (Text):
    TextComponent text_component = new TextComponent("Hello World");
    pl.spigot().sendMessage(ChatMessageType.ACTION_BAR, text_component);
    Tested and works. Like xUltraGaming said above, make sure you import the right classes. In addition, if you want to keep having it appear you will need it in a timer class and run every 2 seconds.
    • Like Like x 1
    • Agree Agree x 1
  3. Hey, I have a question.
    Is it possible to show a text in the Action bar until I set the text blank?
  4. Sidenote: This thread has been marked as solved a couple of months ago. Usually you shouldn't reply to these threads.

    Anyways, according to this thread, you can't set the duration of an actionbar, so you will need to create a repeating task in order to keep sending the actionbar. As for clearing it, just cancel the task when you are done sending the actionbar.