Class ActionBar

java.lang.Object
com.cryptomorin.xseries.messages.ActionBar

public final class ActionBar extends Object
A reflection API for action bars in Minecraft. Fully optimized - Supports 1.8.8+ and above. Requires ReflectionUtils. Messages are not colorized by default.

Action bars are text messages that appear above the player's hotbar Note that this is different from the text appeared when switching between items. Those messages show the item's name and are different from action bars. The only natural way of displaying action bars is when mounting.

Action bars cannot fade or stay like titles. For static Action bars you'll need to send the packet every 2 seconds (40 ticks) for it to stay on the screen without fading.

PacketPlayOutTitle: https://wiki.vg/Protocol#Title

Version:
4.0.0
Author:
Crypto Morin
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    clearActionBar(org.bukkit.entity.Player player)
    Clear the action bar by sending an empty message.
    static void
    Clear the action bar by sending an empty message to all the online players.
    static void
    sendActionBar(org.bukkit.entity.Player player, String message)
    Sends an action bar to a player.
    static void
    sendActionBar(org.bukkit.plugin.Plugin plugin, org.bukkit.entity.Player player, String message)
    Sends an action bar to a player.
    static void
    sendActionBar(org.bukkit.plugin.Plugin plugin, org.bukkit.entity.Player player, String message, long duration)
    Sends an action bar to a player for a specific amount of ticks.
    static void
    sendActionBarWhile(org.bukkit.plugin.Plugin plugin, org.bukkit.entity.Player player, String message, Callable<Boolean> callable)
    Sends an action bar to a player for a specific amount of ticks.
    static void
    sendActionBarWhile(org.bukkit.plugin.Plugin plugin, org.bukkit.entity.Player player, Callable<String> message, Callable<Boolean> callable)
    Sends an action bar to a player for a specific amount of ticks.
    static void
    Sends an action bar all the online players.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • sendActionBar

      public static void sendActionBar(@Nonnull org.bukkit.plugin.Plugin plugin, @Nonnull org.bukkit.entity.Player player, @Nullable String message)
      Sends an action bar to a player. This particular method supports a special prefix for configuring the time of the actionbar.

      Format: ^number|
      where number is in seconds.
      E.g. ^7|&2Hello &4World! will keep the actionbar active for 7 seconds.

      Parameters:
      player - the player to send the action bar to.
      message - the message to send.
      Since:
      3.2.0
      See Also:
    • sendActionBar

      public static void sendActionBar(@Nonnull org.bukkit.entity.Player player, @Nullable String message)
      Sends an action bar to a player.
      Parameters:
      player - the player to send the action bar to.
      message - the message to send.
      Since:
      1.0.0
      See Also:
    • sendActionBar

      public static void sendActionBar(@Nonnull org.bukkit.plugin.Plugin plugin, @Nonnull org.bukkit.entity.Player player, @Nullable String message, long duration)
      Sends an action bar to a player for a specific amount of ticks.
      Parameters:
      plugin - the plugin handling the message scheduler.
      player - the player to send the action bar to.
      message - the message to send.
      duration - the duration to keep the action bar in ticks.
      Since:
      1.0.0
      See Also:
    • sendPlayersActionBar

      public static void sendPlayersActionBar(@Nullable String message)
      Sends an action bar all the online players.
      Parameters:
      message - the message to send.
      Since:
      1.0.0
      See Also:
    • clearActionBar

      public static void clearActionBar(@Nonnull org.bukkit.entity.Player player)
      Clear the action bar by sending an empty message.
      Parameters:
      player - the player to send the action bar to.
      Since:
      2.1.1
      See Also:
    • clearPlayersActionBar

      public static void clearPlayersActionBar()
      Clear the action bar by sending an empty message to all the online players.
      Since:
      2.1.1
      See Also:
    • sendActionBarWhile

      public static void sendActionBarWhile(@Nonnull org.bukkit.plugin.Plugin plugin, @Nonnull org.bukkit.entity.Player player, @Nullable String message, @Nonnull Callable<Boolean> callable)
      Sends an action bar to a player for a specific amount of ticks. Plugin instance should be changed in this method for the schedulers.

      If the caller returns true, the action bar will continue. If the caller returns false, action bar will not be sent anymore.

      Parameters:
      plugin - the plugin handling the message scheduler.
      player - the player to send the action bar to.
      message - the message to send. The message will not be updated.
      callable - the condition for the action bar to continue.
      Since:
      1.0.0
      See Also:
    • sendActionBarWhile

      public static void sendActionBarWhile(@Nonnull org.bukkit.plugin.Plugin plugin, @Nonnull org.bukkit.entity.Player player, @Nullable Callable<String> message, @Nonnull Callable<Boolean> callable)
      Sends an action bar to a player for a specific amount of ticks.

      If the caller returns true, the action bar will continue. If the caller returns false, action bar will not be sent anymore.

      Parameters:
      plugin - the plugin handling the message scheduler.
      player - the player to send the action bar to.
      message - the message to send. The message will be updated.
      callable - the condition for the action bar to continue.
      Since:
      1.0.0
      See Also: