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

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

    Modifier and Type
    Method
    Description
    static void
    clearActionBar(@NotNull org.bukkit.entity.Player player)
    Clear the action bar by sending an empty message.
    static void
    Deprecated.
    This method is unnecessary and will be removed.
    static void
    sendActionBar(@NotNull org.bukkit.entity.Player player, @Nullable String message)
    Sends an action bar to a player.
    static void
    sendActionBar(@NotNull org.bukkit.entity.Player player, @Nullable net.md_5.bungee.api.chat.BaseComponent message)
    Sends an action bar to a player.
    static void
    sendActionBar(@NotNull org.bukkit.plugin.Plugin plugin, @NotNull org.bukkit.entity.Player player, @Nullable String message)
    Sends an action bar to a player.
    static void
    sendActionBar(@NotNull org.bukkit.plugin.Plugin plugin, @NotNull org.bukkit.entity.Player player, @Nullable net.md_5.bungee.api.chat.BaseComponent message, long duration)
    Sends an action bar to a player for a specific amount of ticks.
    static void
    sendActionBarWhile(@NotNull org.bukkit.plugin.Plugin plugin, @NotNull org.bukkit.entity.Player player, @Nullable Callable<net.md_5.bungee.api.chat.BaseComponent> message, @NotNull Callable<Boolean> callable)
    Sends an action bar to a player for a specific amount of ticks.
    static void
    sendActionBarWhile(@NotNull org.bukkit.plugin.Plugin plugin, @NotNull org.bukkit.entity.Player player, @Nullable net.md_5.bungee.api.chat.BaseComponent message, @NotNull Callable<Boolean> callable)
    Sends an action bar to a player for a specific amount of ticks.
    static void
    sendPlayersActionBar(@Nullable String message)
    Deprecated.
    This method is unnecessary and will be removed.

    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(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @NotNull @NotNull org.bukkit.entity.Player player, @Nullable @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(@NotNull @NotNull org.bukkit.entity.Player player, @Nullable @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(@NotNull @NotNull org.bukkit.entity.Player player, @Nullable @Nullable net.md_5.bungee.api.chat.BaseComponent message)
      Sends an action bar to a player.
      Parameters:
      player - the player to send the action bar to.
      message - the message to send.
      Since:
      5.0.0
      See Also:
    • sendActionBar

      public static void sendActionBar(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @NotNull @NotNull org.bukkit.entity.Player player, @Nullable @Nullable net.md_5.bungee.api.chat.BaseComponent 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

      @Deprecated public static void sendPlayersActionBar(@Nullable @Nullable String message)
      Deprecated.
      This method is unnecessary and will be removed.
      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(@NotNull @NotNull 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

      @Deprecated public static void clearPlayersActionBar()
      Deprecated.
      This method is unnecessary and will be removed.
      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(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @NotNull @NotNull org.bukkit.entity.Player player, @Nullable @Nullable net.md_5.bungee.api.chat.BaseComponent message, @NotNull @NotNull 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(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @NotNull @NotNull org.bukkit.entity.Player player, @Nullable @Nullable Callable<net.md_5.bungee.api.chat.BaseComponent> message, @NotNull @NotNull 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: