BarAPI
BarAPI

Server Owners
This plugin does nothing on its own. It is simply an API for other plugins to implement with.
Developers
Simply add BarAPI.jar to your project build path.
This plugin makes use of reflection and therefore "shouldn't" break on craftbukkit updates.
Limitations
The message can not be more than 64 characters. If it is more, BarAPI will automatically cut it to 64 characters to prevent the client from crashing.
This is a client limitation and cannot be changed.
Examples
BarAPI.setMessage(Player player, String message)
Set a message for the player. It will remain there until the player logs off or another plugin overrides it.
BarAPI.setMessage(Player player, String message, float percent)
Same as above except you can set the % of the health bar. 100 shows the entire health bar, 50 shows half the health bar and so on.
BarAPI.setMessage(final Player player, String message, int seconds)
Sets a timed message for the player. It will remain until the timer runs out. The health automatically reduces based on how long the timer is.
BarAPI.hasBar(Player player)
Pretty self explanatory, returns a boolean.
BarAPI.removeBar(Player player)
Also pretty self explanatory.
BarAPI.setHealth(Player player, float percent)
Allows you to modify the health of an existing bar. If the player has no bar, this does nothing.
Tutorials
Source
Maven
<repositories> <repository> <id>confuser-repo</id> <url>http://ci.frostcast.net/plugin/repository/everything</url> </repository> </repositories> <dependencies> <dependency> <groupId>me.confuser</groupId> <artifactId>BarAPI</artifactId> <version>3.0</version> </dependency> </dependencies>
Developer Builds
These builds have not been approved by BukkitDev staff, therefore, use at your own risk.
Updater
This plugin contains an auto updater which is enabled by default. If you do not wish to automatically download new updates, edit BarAPI/config.yml and set autoUpdate to false.
To Dos
- Scroll messages if string is greater than 64 characters.
Plugins Using BarAPI
Metrics
To determine popularity and usage of BarAPI, plugin installs are automatically tracked by the Metrics plugin tracking system. Your Java version, OS, player count, server country location and plugin & server versions are collected. This is used to determine what environments are using the plugin to ensure full compatibility. This collection is anonymous. If you don't want this tracking, edit plugins/PluginMetrics/config.yml and set opt-out to true.

-
View User Profile
-
Send Message
Posted Feb 3, 2014Although I have pretty much mastered Bukkit API, I have never used packets before, and it wouldn't be worth my time to learn just for a tiny feature to my server's custom plugin. I used this instead, and it helped out a lot. This is an amazing developer tool. =)
-
View User Profile
-
Send Message
Posted Feb 3, 2014My new plugin called PlayerBar uses this API!
-
View User Profile
-
Send Message
Posted Feb 2, 2014Um, the plugin "Parkour" does not work with this plugin but the plugin TNTRun does so just letting you know.
-
View User Profile
-
Send Message
Posted Feb 2, 2014I installed BarAPI Correctly; It Shows Up in My Plugins List Meanwhile I put BossMessage And It doesn't Show up! So I removed It from my Plugins folder, And put BossBroadcast Instead…It Doesn't Work Either! Help? Anyone?
-
View User Profile
-
Send Message
Posted Jan 29, 2014Four things:
1. Sounds useful, will review it and then possibly use it :)
2. Don't use LATEST as a dependency version. It's deprecated, doesn't do what you think it does and makes your builds very unpredictable even if it worked the way you think it does.
3. Your download says it's for 1.7.4, when there is neither a bukkit build nor a craftbukkit build for 1.7.4 yet.
4. Your licence isn't GPL-compatible (the non-commercial bit)
EDIT: 5. Can you add a config option for initializing the metrics stuff as well?
-
View User Profile
-
Send Message
Posted Jan 29, 2014To all complaining about color codes: Bukkit supports section symbols and they even have a method to change from "&".
So simply use chatColor("&astring with &ccolors &band &estuff")
-
View User Profile
-
Send Message
Posted Jan 29, 2014@dome77
This API accepts a string. Use ChatColor to insert colours.
@messageofdeath
What code are you using?
-
View User Profile
-
Send Message
Posted Jan 28, 2014Whenever I use BOLD on the boss bar it moves to the left and doesn't center itself, I tested this with BossBroadcast and it does the same thing, but on this one server they have bold and it's centered. I don't know what's wrong with it I debugged it and everything I can't figure it out.
-
View User Profile
-
Send Message
Posted Jan 28, 2014Please add Color codes to your plugin :D They don't work for me :( My plugin is using your plugin: http://dev.bukkit.org/bukkit-plugins/multikill/ Please insert it into the Using-List :D Do you have Skype? Please add me: MCUNET
-
View User Profile
-
Send Message
Posted Jan 27, 2014@Acer_Mortemo
Only on a per player basis as its done with packets, the server itself won't know about the ender dragon, nor will any other player that can't see the bar.
-
View User Profile
-
Send Message
Posted Jan 26, 2014Just out of curiosity, does BarAPI spawn an Enderdragon for all players on the server? Or only when you call a method?
-
View User Profile
-
Send Message
Posted Jan 25, 2014Just letting you know my plugin uses this: http://dev.bukkit.org/bukkit-plugins/infernal-mobs/
-
View User Profile
-
Send Message
Posted Jan 24, 2014@HeyAwesomePeople
Oh hell! LOL, thanks!
-
View User Profile
-
Send Message
Posted Jan 23, 2014I am getting a ClassNotFoundException when trying to use BarAPI.setMessage(player, string, int). Using Eclipse.EDIT: nvm, forgot to put the plugin in the server :P
-
View User Profile
-
Send Message
Posted Jan 23, 2014Tried implementing this but I'm getting ClassDefError, or something like that. I'm using NetBeans 7.4. Here's my code:
http://pastebin.com/qG3NCEmR
-
View User Profile
-
Send Message
Posted Jan 21, 2014@TheAJ471
Nope, should work just fine. Post your code.
@Revengence_98
Either use the timer which will automatically lower the health depending on the time specified or set the message then set the health.
@james137137
This is nothing to do with BarAPI. The memory leak is within your code. You set the message for the player, but you never call removeBar meaning it'll stay in BarAPI's memory until you restart the server or the player leaves.
-
View User Profile
-
Send Message
Posted Jan 20, 2014@james137137
would I have to BarAPI.removeBar(player); before BarAPI.setMessage(); ???
here was my error http://pastebin.com/KDZsLrMn
-
View User Profile
-
Send Message
Posted Jan 20, 2014@Revengence_98
I have been using your plugin and it seems that it is creating an OutOfMemoryError after a long period of time. could this be caused by spawning too many FakeDragon and not cleaning up. what else could be causing this?
here is my code: http://pastebin.com/agdxpvfF
-
View User Profile
-
Send Message
Posted Jan 20, 2014How could I show ex. 50% of the bar for 5 seconds?
-
View User Profile
-
Send Message
Posted Jan 20, 2014@confuser
How can I make the Bar show up If I stand on a pressure plate. It doesnt work as if typing a command with the same code. Is this a glitch?