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.
Oh I see, update coming. Thanks
Updated to 1.7. Includes bug fixes and is backwards compatible with 1.6.4.
Pending approval.
Please Update to 1.7.2
Please update it! I would do it by myself but I dont know the new class names.
It needs to be updated on 1.7.2 there are changes in protocols so of course it does not work.
@confuser
Its broken to me...
Console error:
Add Parkour to the list of Plugins using your plugin? :) It cleverly uses the Bar as a way of showing how far you've progressed in the course :D
Also this plugin breaks in 1.7 but I think you are aware of this :P
@kevc45
Once there is a stable build out I'll update to 1.7 :)
If you could update this when you get a chance that would be great. Thanks.
@Phasesaber
for(Player onlineWorld : Bukkit.getServer().getWorld(player.getWorld().getName()).getPlayers() { BarAPI.setMessage(onlineWorld, "Hello!", 1); }
@Phasesaber
Messages are done on a per player basis as they are unique to each player. Loop through OnlinePlayers and set the message.
How could you just put the message there without a player?
Like: BarAPI.setMessage(world, "Hello!", 1);
@Desle
Added.
Nice API. Maybe a BarAPI.getHealth(), BarAPI.getMessage()?
Hey guys I have posted a plugin request involving bar api if anyone has 5 minutes please fill it! http://forums.bukkit.org/threads/bar-api-plugin-well-explained.195481/ Thank you!
@confuser
Its fine not got something to work and it also brings down the bar health. Thanks for a amazing api!
@shawshark
As in a countdown timer? E.g 120 seconds to go!, 110 seconds to go! etc ?
Not currently without the timer. I could emit an event when the health drops, such as BarHealthChangeEvent and then you can set the message according to the current health?
Server "mc4u.pl" using plugin?
@confuser
Hey confuserr is there a way I can have it count down like this:
BarAPI.setMessage(p, "ChatColor.GOLD" + "SkyWars match staring in" + ChatColor.RED + " 2" + ChatColor.GOLD + " minutes!"); BarAPI.setHealth(p, 100);
without having to do use a runnable task and have over 200 lines just to count it down?
@HiFiGamer
Yes
BarAPI.setMessage(Player player, String message)