ActionBarAPI+: Advanced Action Bar Framework for Minecraft
Forge your perfect action bars with style, control, and endless possibilities.
Introduction
ActionBarAPI+ is a comprehensive library for Minecraft servers that provides control over Minecraft's built-in action bar system. This API allows developers to create, manage, and customize action bars with various styles, colors, and behaviors.
I created this API for myself and for my own projects, but I'm sharing it with the community for those who might find it useful. While it works on Minecraft versions 1.10-1.21, please note that not every feature has been thoroughly tested across all versions. As an open-source project, contributions are welcome to improve and extend its functionality.
There is no guarantee that there will be no bugs or issues. I created this while planning to optimize it and fix any issues that may appear only while I use it on other projects and plugins. I will make honest and reasonable attempts to fix any reported issues. After all, the project is open-source so you may contribute if you have anything in mind. Read the Disclaimer for more info.
Features
Adding as a dependency
There is no Maven or Gradle Deployment at the moment.
Manual Installation
API Documentation
Initialization
Temporary Action Bars
The API fires various events that you can listen to:
Basic Usage Example
The plugin includes a test command that demonstrates (mostly) all the features of the API:
/actionbarapiplus runtest
This command requires the permission
actionbarapiplus.runtest and will run a comprehensive test of all API features.
Warning: This test will cancel all running action bar tasks for all players on the server and may cause lag spikes. It is not recommended to run this on a production server (Run it on a dev server instead)
Compatibility
ActionBarAPI+ is designed to work with Minecraft versions 1.10-1.21. However, not all features have been thoroughly tested on all versions. If you encounter any issues, please report them on the GitHub repository.
Known Limitations
Contributions are welcome! If you'd like to contribute to the project, please:
This project is licensed under the MIT License - see the LICENSE file for details.
Disclaimer
This API was created for personal use and is shared as-is without warranty. While efforts have been made to ensure functionality, you may encounter bugs or issues. Use at your own risk.
For custom plugins on your own server, this API can be very useful. However, it's not recommended for plugins intended for public release due to potential conflicts with other action bar implementations.
Feedback and contributions are always welcome!
Forge your perfect action bars with style, control, and endless possibilities.
Introduction
ActionBarAPI+ is a comprehensive library for Minecraft servers that provides control over Minecraft's built-in action bar system. This API allows developers to create, manage, and customize action bars with various styles, colors, and behaviors.
I created this API for myself and for my own projects, but I'm sharing it with the community for those who might find it useful. While it works on Minecraft versions 1.10-1.21, please note that not every feature has been thoroughly tested across all versions. As an open-source project, contributions are welcome to improve and extend its functionality.
There is no guarantee that there will be no bugs or issues. I created this while planning to optimize it and fix any issues that may appear only while I use it on other projects and plugins. I will make honest and reasonable attempts to fix any reported issues. After all, the project is open-source so you may contribute if you have anything in mind. Read the Disclaimer for more info.
Features
- Send temporary or permanent action bars to players
- Apply various visual styles (rolling, rainbow, flashing, gradient, typewriter, wave)
- Customize colors and sounds
- Global action bars for all players
- Modify existing action bars
- Pause and resume action bars
- Listen to action bar events
- Compatible with Minecraft versions 1.10-1.21
Adding as a dependency
There is no Maven or Gradle Deployment at the moment.
Manual Installation
- Download the latest release from the spigot page.
- Add the JAR file to your project's dependencies/libraries in your IDE.
- Initialize like shown below
- Ensure the JAR file is in your plugins folder.
API Documentation
Initialization
Spoiler: View Initialization Code
import com.codingguru.actionBarAPI.ActionBarAPI ;
@Override
public void onEnable ( ) {
// Initialize ActionBarAPI
new ActionBarAPI ( this ) ;
}
Methods
Code (Java):
import com.codingguru.actionBarAPI.ActionBarAPI ;
@Override
public void onEnable ( ) {
// Initialize ActionBarAPI
new ActionBarAPI ( this ) ;
}
Temporary Action Bars
Spoiler: View Temporary Action Bars Code
/**
* Sends a temporary action bar to a player
* @param player The player to send the action bar to
* @param message The message to display
* @param duration The duration in ticks (20 ticks = 1 second)
* @param style The style of the action bar
* @param colors List of color names to use
* @param sound The sound to play (can be null)
*/
ActionBarAPI. sendActionBar (Player player, String message, int duration, reception. Styles style, List <String > colors, Sound sound ) ;
Permanent Action Bars
Code (Java):
/**
* Sends a temporary action bar to a player
* @param player The player to send the action bar to
* @param message The message to display
* @param duration The duration in ticks (20 ticks = 1 second)
* @param style The style of the action bar
* @param colors List of color names to use
* @param sound The sound to play (can be null)
*/
ActionBarAPI. sendActionBar (Player player, String message, int duration, reception. Styles style, List <String > colors, Sound sound ) ;
Spoiler: View Permanent Action Bars Code
/**
* Starts a permanent action bar for a player
* @param player The player to send the action bar to
* @param message The message to display
* @param style The style of the action bar
* @param colors List of color names to use
* @param sound The sound to play (can be null)
*/
ActionBarAPI. startActionBar (Player player, String message, reception. Styles style, List <String > colors, Sound sound ) ;
Global Action Bars
Code (Java):
/**
* Starts a permanent action bar for a player
* @param player The player to send the action bar to
* @param message The message to display
* @param style The style of the action bar
* @param colors List of color names to use
* @param sound The sound to play (can be null)
*/
ActionBarAPI. startActionBar (Player player, String message, reception. Styles style, List <String > colors, Sound sound ) ;
Spoiler: View Global Action Bars Code
/**
* Sends a temporary global action bar to all online players
*/
ActionBarAPI. sendGlobalActionBar ( String message, int duration, reception. Styles style, List <String > colors, Sound sound ) ;
/**
* Starts a permanent global action bar for all online players
*/
ActionBarAPI. startGlobalActionBar ( String message, reception. Styles style, List <String > colors, Sound sound ) ;
Stopping Action Bars
Code (Java):
/**
* Sends a temporary global action bar to all online players
*/
ActionBarAPI. sendGlobalActionBar ( String message, int duration, reception. Styles style, List <String > colors, Sound sound ) ;
/**
* Starts a permanent global action bar for all online players
*/
ActionBarAPI. startGlobalActionBar ( String message, reception. Styles style, List <String > colors, Sound sound ) ;
Spoiler: View Stop Action Bar Code
/**
* Stops an active action bar for the specified player
* @return true if an action bar was stopped, false if no action bar was active
*/
ActionBarAPI. stopActionBar (Player player ) ;
Modifying Action Bars
Code (Java):
/**
* Stops an active action bar for the specified player
* @return true if an action bar was stopped, false if no action bar was active
*/
ActionBarAPI. stopActionBar (Player player ) ;
Spoiler: View Modify Action Bar Code
/**
* Modifies an active action bar for the specified player
* @return true if an action bar was modified, false if no action bar was active
*/
ActionBarAPI. modifyActionBar (Player player, String newMessage ) ;
Styles
Code (Java):
/**
* Modifies an active action bar for the specified player
* @return true if an action bar was modified, false if no action bar was active
*/
ActionBarAPI. modifyActionBar (Player player, String newMessage ) ;
Spoiler: View Available Styles
reception. Styles. rolling // Text rolls in from the right
reception. Styles. rainbow // Text cycles through rainbow colors
reception. Styles. flashing // Text flashes between colors
reception. Styles. gradient // Text displays a color gradient
reception. Styles. typewriter // Text appears character by character
reception. Styles. wave // Text displays a wave effect
Events
Code (Java):
reception. Styles. rolling // Text rolls in from the right
reception. Styles. rainbow // Text cycles through rainbow colors
reception. Styles. flashing // Text flashes between colors
reception. Styles. gradient // Text displays a color gradient
reception. Styles. typewriter // Text appears character by character
reception. Styles. wave // Text displays a wave effect
The API fires various events that you can listen to:
- ActionBarSentEvent - Fired when an action bar is sent to a player
- ActionBarStartedEvent - Fired when a permanent action bar is started
- ActionBarTaskEndedEvent - Fired when an action bar task ends naturally
- ActionBarTaskModifiedEvent - Fired when an action bar is modified
- ActionBarTaskPausedEvent - Fired when an action bar is paused
- ActionBarTaskResumedEvent - Fired when a paused action bar is resumed
- ActionBarTaskStoppedEvent - Fired when an action bar is stopped manually
Basic Usage Example
Spoiler: View Basic Usage Example with video
// Import necessary classes
import com.codingguru.actionBarAPI.ActionBarAPI ;
import com.codingguru.actionBarAPI.events.ActionBarSentEvent ;
import com.codingguru.actionBarAPI.events.ActionBarTaskEndedEvent ;
import com.codingguru.actionBarAPI.taskHandlers.reception ;
import org.bukkit.Bukkit ;
import org.bukkit.Sound ;
import org.bukkit.entity.Player ;
import org.bukkit.event.EventHandler ;
import org.bukkit.event.Listener ;
import org.bukkit.event.entity.EntityDamageEvent ;
import org.bukkit.event.player.PlayerJoinEvent ;
import org.bukkit.plugin.java.JavaPlugin ;
import java.util.Arrays ;
import java.util.UUID ;
@Override
public void onEnable ( ) {
Bukkit. getPluginManager ( ). registerEvents ( this, this ) ;
new ActionBarAPI ( this ) ;
}
// !!!
// This is just a Usage example, it assumes player full health initially
// and does not handle regen event
// and does not handle player death either.
// Although those could be implemented similarly to this.
// !!!
@EventHandler
public void onPlayerJoin (PlayerJoinEvent event ) {
Player player = event. getPlayer ( ) ;
ActionBarAPI. sendActionBar (player,
"Welcome to the server",
100, reception. Styles. rainbow,
Arrays. asList ( /*Leave empty because rainbow style ignores provided colors and just uses rainbow*/ ),
Sound. ENTITY_PLAYER_LEVELUP
) ;
}
public UUID welcomeEventID ;
String health = "Health: ❤❤❤❤❤❤❤❤❤❤" ;
@EventHandler
public void ActionBarSentEvent (ActionBarSentEvent event ) {
// Confirm this is the event sent on player join
if (event. getMessage ( ). equals ( "Welcome to the server" ) ) {
welcomeEventID = event. getTaskId ( ) ; // store ID of event
}
}
@EventHandler
public void ActionBarTaskEndedEvent (ActionBarTaskEndedEvent event ) {
// check if what has ended is the welcome message task
if (event. getTaskId ( ) ==welcomeEventID ) {
// we confirmed the welcome message has ended, we can start health bar task.
ActionBarAPI. startActionBar (
event. getPlayer ( ),
health,
reception. Styles. flashing,
Arrays. asList ( "RED", "WHITE" ),
Sound. ENTITY_PLAYER_LEVELUP ) ;
}
}
@EventHandler
public void playerHurt (EntityDamageEvent event ) {
if ( ! (event. getEntity ( ) instanceof Player ) ) return ;
Player player = (Player ) event. getEntity ( ) ;
// calculate remaining health after damage (in heart units) one heart = 2 health points
double currentHealth = player. getHealth ( ) ;
double damageAmount = event. getFinalDamage ( ) ;
double healthAfterDamage = Math. max ( 0, currentHealth - damageAmount ) ; // make sure result isnt negative (otherwise player is dead)
int heartsAfterDamage = ( int ) Math. floor (healthAfterDamage / 2.0 ) ;
// I do not have a half heart emoji so in case of half heart, we just truncate to no heart
Bukkit. getScheduler ( ). runTask ( this, ( ) -> {
// build until heartsafterdamage is fulfilled
StringBuilder newhealth = new StringBuilder ( ) ;
for ( int i = 0 ; i < heartsAfterDamage ; i ++ ) {
newhealth. append ( "❤" ) ;
}
// modify already started action bar
ActionBarAPI. modifyActionBar (player, "Health: " + newhealth. toString ( ) ) ;
} ) ;
}
@Override
public void onDisable ( ) {
// Plugin shutdown logic
}
Event Listening
Code (Java):
// Import necessary classes
import com.codingguru.actionBarAPI.ActionBarAPI ;
import com.codingguru.actionBarAPI.events.ActionBarSentEvent ;
import com.codingguru.actionBarAPI.events.ActionBarTaskEndedEvent ;
import com.codingguru.actionBarAPI.taskHandlers.reception ;
import org.bukkit.Bukkit ;
import org.bukkit.Sound ;
import org.bukkit.entity.Player ;
import org.bukkit.event.EventHandler ;
import org.bukkit.event.Listener ;
import org.bukkit.event.entity.EntityDamageEvent ;
import org.bukkit.event.player.PlayerJoinEvent ;
import org.bukkit.plugin.java.JavaPlugin ;
import java.util.Arrays ;
import java.util.UUID ;
@Override
public void onEnable ( ) {
Bukkit. getPluginManager ( ). registerEvents ( this, this ) ;
new ActionBarAPI ( this ) ;
}
// !!!
// This is just a Usage example, it assumes player full health initially
// and does not handle regen event
// and does not handle player death either.
// Although those could be implemented similarly to this.
// !!!
@EventHandler
public void onPlayerJoin (PlayerJoinEvent event ) {
Player player = event. getPlayer ( ) ;
ActionBarAPI. sendActionBar (player,
"Welcome to the server",
100, reception. Styles. rainbow,
Arrays. asList ( /*Leave empty because rainbow style ignores provided colors and just uses rainbow*/ ),
Sound. ENTITY_PLAYER_LEVELUP
) ;
}
public UUID welcomeEventID ;
String health = "Health: ❤❤❤❤❤❤❤❤❤❤" ;
@EventHandler
public void ActionBarSentEvent (ActionBarSentEvent event ) {
// Confirm this is the event sent on player join
if (event. getMessage ( ). equals ( "Welcome to the server" ) ) {
welcomeEventID = event. getTaskId ( ) ; // store ID of event
}
}
@EventHandler
public void ActionBarTaskEndedEvent (ActionBarTaskEndedEvent event ) {
// check if what has ended is the welcome message task
if (event. getTaskId ( ) ==welcomeEventID ) {
// we confirmed the welcome message has ended, we can start health bar task.
ActionBarAPI. startActionBar (
event. getPlayer ( ),
health,
reception. Styles. flashing,
Arrays. asList ( "RED", "WHITE" ),
Sound. ENTITY_PLAYER_LEVELUP ) ;
}
}
@EventHandler
public void playerHurt (EntityDamageEvent event ) {
if ( ! (event. getEntity ( ) instanceof Player ) ) return ;
Player player = (Player ) event. getEntity ( ) ;
// calculate remaining health after damage (in heart units) one heart = 2 health points
double currentHealth = player. getHealth ( ) ;
double damageAmount = event. getFinalDamage ( ) ;
double healthAfterDamage = Math. max ( 0, currentHealth - damageAmount ) ; // make sure result isnt negative (otherwise player is dead)
int heartsAfterDamage = ( int ) Math. floor (healthAfterDamage / 2.0 ) ;
// I do not have a half heart emoji so in case of half heart, we just truncate to no heart
Bukkit. getScheduler ( ). runTask ( this, ( ) -> {
// build until heartsafterdamage is fulfilled
StringBuilder newhealth = new StringBuilder ( ) ;
for ( int i = 0 ; i < heartsAfterDamage ; i ++ ) {
newhealth. append ( "❤" ) ;
}
// modify already started action bar
ActionBarAPI. modifyActionBar (player, "Health: " + newhealth. toString ( ) ) ;
} ) ;
}
@Override
public void onDisable ( ) {
// Plugin shutdown logic
}
Spoiler: View Event Listening Example
import com.codingguru.actionBarAPI.events.* ;
import org.bukkit.event.EventHandler ;
import org.bukkit.event.Listener ;
public class ActionBarListener implements Listener {
@EventHandler
public void onActionBarSent (ActionBarSentEvent event ) {
System. out. println ( "Action bar sent to " + event. getPlayer ( ). getName ( ) + ": " + event. getMessage ( ) ) ;
}
@EventHandler
public void onActionBarTaskEnded (ActionBarTaskEndedEvent event ) {
System. out. println ( "Action bar ended for " + event. getPlayer ( ). getName ( ) ) ;
}
@EventHandler
public void onActionBarTaskModified (ActionBarTaskModifiedEvent event ) {
System. out. println ( "Action bar modified for " + event. getPlayer ( ). getName ( ) +
" from \"" + event. getOldMessage ( ) + "\" to \"" + event. getNewMessage ( ) + "\"" ) ;
}
}
Testing
Code (Java):
import com.codingguru.actionBarAPI.events.* ;
import org.bukkit.event.EventHandler ;
import org.bukkit.event.Listener ;
public class ActionBarListener implements Listener {
@EventHandler
public void onActionBarSent (ActionBarSentEvent event ) {
System. out. println ( "Action bar sent to " + event. getPlayer ( ). getName ( ) + ": " + event. getMessage ( ) ) ;
}
@EventHandler
public void onActionBarTaskEnded (ActionBarTaskEndedEvent event ) {
System. out. println ( "Action bar ended for " + event. getPlayer ( ). getName ( ) ) ;
}
@EventHandler
public void onActionBarTaskModified (ActionBarTaskModifiedEvent event ) {
System. out. println ( "Action bar modified for " + event. getPlayer ( ). getName ( ) +
" from \"" + event. getOldMessage ( ) + "\" to \"" + event. getNewMessage ( ) + "\"" ) ;
}
}
The plugin includes a test command that demonstrates (mostly) all the features of the API:
Code (Text):
/actionbarapiplus runtest
Warning: This test will cancel all running action bar tasks for all players on the server and may cause lag spikes. It is not recommended to run this on a production server (Run it on a dev server instead)
Compatibility
ActionBarAPI+ is designed to work with Minecraft versions 1.10-1.21. However, not all features have been thoroughly tested on all versions. If you encounter any issues, please report them on the GitHub repository.
Known Limitations
- The API may conflict with other plugins that use the action bar at the same time
- Global action bars can impact server performance with many players online
Contributions are welcome! If you'd like to contribute to the project, please:
- Submit a pull request
- Give feedback or suggestions
- Report any bugs or issues
This project is licensed under the MIT License - see the LICENSE file for details.
Disclaimer
This API was created for personal use and is shared as-is without warranty. While efforts have been made to ensure functionality, you may encounter bugs or issues. Use at your own risk.
For custom plugins on your own server, this API can be very useful. However, it's not recommended for plugins intended for public release due to potential conflicts with other action bar implementations.
Feedback and contributions are always welcome!
Quick facts
- Edition: Minecraft Java
- File type: .jar
- Minecraft versions listed: 1.10, 1.11, 1.12
- How to install: Install the matching mod loader (Forge, Fabric or NeoForge) for your Minecraft version. → Download the .jar. → Put it in the .minecraft/mods folder and launch that loader profile.
- Where to get it: Opens on Spigot — not every file is mirrored on our own servers.
Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.
ActionBarAPI+ | Advanced Action Bar Framework for Minecraft | 1.10-1.22 is a free Minecraft Java mod. Compatible with Minecraft 1.10, 1.11, 1.12, 1.13 and newer. Downloaded 172 times (via Spigot). Download it and open it directly in the game.