public final class ActionBar extends Object
Action bars are text messages that appear above the player's hotbar Note that this is different than 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
ReflectionUtils| Modifier and Type | Method and Description |
|---|---|
static void |
clearActionBar(org.bukkit.entity.Player player)
Clear the action bar by sending an empty message.
|
static void |
clearPlayersActionBar()
Clear the action bar by sending an empty message to all the online players.
|
static void |
sendActionBar(org.bukkit.plugin.java.JavaPlugin 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 |
sendActionBar(org.bukkit.entity.Player player,
String message,
int delay)
Sends an action bar to a player.
|
static void |
sendActionBarWhile(org.bukkit.plugin.java.JavaPlugin 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 |
sendActionBarWhile(org.bukkit.plugin.java.JavaPlugin 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 |
sendPlayersActionBar(String message)
Sends an action bar all the online players.
|
public static void sendActionBar(@Nonnull org.bukkit.entity.Player player, @Nullable String message, int delay)
player - the player to send the action bar to.message - the message to send.sendActionBar(JavaPlugin, Player, String, long)public static void sendPlayersActionBar(@Nullable String message)
message - the message to send.sendActionBar(Player, String, int)public static void clearActionBar(@Nonnull org.bukkit.entity.Player player)
player - the player to send the action bar to.sendActionBar(Player, String, int)public static void clearPlayersActionBar()
clearActionBar(Player player)public static void sendActionBarWhile(@Nonnull org.bukkit.plugin.java.JavaPlugin plugin, @Nonnull org.bukkit.entity.Player player, @Nullable String message, @Nonnull Callable<Boolean> callable)
If the caller returns true, the action bar will continue. If the caller returns false, action bar will not be sent anymore.
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.sendActionBar(JavaPlugin, Player, String, long)public static void sendActionBarWhile(@Nonnull org.bukkit.plugin.java.JavaPlugin plugin, @Nonnull org.bukkit.entity.Player player, @Nullable Callable<String> message, @Nonnull Callable<Boolean> callable)
If the caller returns true, the action bar will continue. If the caller returns false, action bar will not be sent anymore.
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.sendActionBarWhile(JavaPlugin, Player, String, Callable)public static void sendActionBar(@Nonnull org.bukkit.plugin.java.JavaPlugin plugin, @Nonnull org.bukkit.entity.Player player, @Nullable String message, long duration)
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.sendActionBarWhile(JavaPlugin, Player, String, Callable)Copyright © 2022. All rights reserved.