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.
I'm trying to set a float for the bar, however it's not working =/
Here's my code:
float maxHealth = ((float)calculateMaxHealth(name)); float fhealth = ((float) health); float percent = ((float) ((float) fhealth) / ((float) maxHealth));
BarAPI.setMessage(p, ChatColor.RED + "" + ChatColor.BOLD + "HP: " + health + "/" + ((int) maxHealth), percent); BarAPI.setHealth(p, percent);
Anyone know why this would be happening?
-
You can add a 'time' tag to your sendMessage(final Player, String, int) method on line 277 in the BarAPI.java. So what I mean is when the message contains the tag 'time', that tag will be replaced with the time left integer. I believe the String.replace() method will do that. I understand that there is more than just a simple String.replace() method but that would be very handy.
Can you add my plugin to the "Plugins Using BarAPI" list, please:
http://dev.bukkit.org/bukkit-plugins/bossads/
Could you add my plugin to your list of plugins using the API, http://dev.bukkit.org/bukkit-plugins/playerboss
Thanks ;)
How do you get a player's health? player.getHealth() I'm constantly getting the ambiguous error. Read the sticky on the forums, but it doesn't really help much in the way of examples.
Please add my Plugin to your "Plugins-Using-BarAPI" list:
http://dev.bukkit.org/bukkit-plugins/multikill/
@thetrolololol
When desplaying the message make it send spesific messages to people on a world by useing a for loop?
MythicMobs uses BarAPI now to great effect!
Make It So You Can Make Different Messages For Certain Worlds Plz! It Would Be Awesome
(also speaking for boss message)
anybody has an alternative?
I put BarAPI in the plugin folder and started up the server. Then I stopped it and put in BossMessage and DrawMyThing. BarAPI makes a folder but the other two plugins don't even open or work. Someone please help me!
@Androbot
I have the same thing. It's really annoying, and really laggy. Please help confuserr. :(
i have a problem with version 3.0 there are explosions, that fly up and produce laggs. pls fix thanks
@FeniksMs
Его на 1.5.2 нету.
А кто может подсказать,где можно скачать или найти на версию 1.5.2?
Hi,
I think it would be great if we had the option to give bars a priority, a bar with a higher priority overrides a bar with a lower but a lower not a higher. This would do the handling much easier if you have multiple things that causes bars to be created.
Additionally, I have sometimes (i think when i have a really high ping) a strange bug:
a bar doesnt disappear and shows "Enderdragon" while the invisible Enderdragons seems to spawn endless, my fps drops from 120 to 10 and i see explosion effects at a certain location for the whole time. when i relog, everything is normal again. Had this 2 or 3 times.
Sorry for my bad English :(
bad-ass fakedragon issue: https://github.com/confuser/BarAPI/issues/18
@Codebucket
Your changes are not backwards compatible and break the entire base of the plugin. Please create an issue on the repo with the problem and what your changes do.
@confuserr: Why is the dragon appears only at 0, 0, 0 and then teleported to me? That looks really buggy. Screenshot: http://gyazo.com/a99ee76285c9294659eeb31c535c4bed Modified Source: https://github.com/codebucketdev/BarAPI