HomeJavaModsBossBarAPI
BossBarAPI
This is my second resource on Spigot, and it is BossBarAPI.
BossBarAPI.png
BossBarAPI, is a very powerful tool for both server owners and developers to take advantage of the BossBar.
Abouts.png
Server Owner Note:
I'm working on better support for your end of the plugin, I didn't put as much time in to the server owner mode compared to the developer mode, but you guys will get better support and more features and such soon!

Developer Note:
When I first used the new Spigot 1.9 BossBar API, I was very confused on why it wasn't showing to players, or functioning as I thought it would.
Examples.png
With BossBarAPI, you can condense your code from:
Code (Text):
BossBar bossBar = Bukkit.createBossBar("Hello", BarColor.PINK, BarStyle.SOLID);
bossBar.addPlayer(player);
bossBar.show();
to
Code (Text):
BossBar bossBar = BarUtility.getInstance().createBossBar(player, "Hello", BarColor.PINK, BarStyle.SOLID);
and it will automatically set the player's boss bar, and you may retrieve it by doing this:
Code (Text):
BarUtility.getInstance().getBossBar(player);
// Will return null if they don't have a bar.
You can remove player's bars with this:
Code (Text):
BarUtility.getInstance().setBossBar(player, null);
Animations.png
You can also create Bar Animations, with the AnimationUtility class.
Usage:
Code (Text):
List<String> frames = new ArrayList<>();
frames.add("Frame 1");
frames.add("Frame 2");
frames.add("Frame 3");
BarAnimationTask barAnimationTask = AnimationUtility.getInstance().createAnimation(frames);
// This will set the global bar animation, because currently this plugin only supports one at a time.
[​IMG]
Event.png
There are also events! BarAnimationCycleEvent, for when an animation frame goes by, and PlayerSetBarEvent, for when a player gets their bar set.

NOTE: By cancelling BarAnimationCycleEvent, it is not needed to cancel PlayerSetBarEvent.
BarAnimationCycleEvent ---> PlayerSetBarEvent ---> The in-game bar.
(BarAnimationTask goes through BarAnimationCycleEvent, then sets the player's bar with the BarUtility class, and BarUtility goes through PlayerSetBarEvent.)

Should be about everything for you awesome developers! If you make anything cool with the API, shoot me a message!

Terms.png
You are free to use this any way you want, as long as:
- You give me credit
- You don't use this in any way that breaks Mojang's EULA and/or Terms
- You don't use this in any way that breaks SpigotMC's EULA and/or Terms
- I can update this resource at any time, and add anything to it that doesn't violate SpigotMC's plugin guidelines.
- I don't have to update this plugin or provide support
- Errors will be PM'd to me instead of left in the review section

Thanks for looking at my resource!

Commands

Plugin details

Read from the plugin's own plugin.yml.

Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

BossBarAPI is a free Minecraft Java mod. Compatible with Minecraft 1.9. Downloaded 1,024 times (via Spigot). Download it and open it directly in the game.

Explore more