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.
@confuser
I dont understand well how to use this API...
I have a command, i want that when an admin toggle that command on, all the players read a bossbar message. And when this command is toggle off the message disappears. How can i make that?
Thanks!
@Avery246813579
I've solved the shield effect. Just need to get rid of the smoke particles now somehow. They're added within the m() method of EntityWither.
@Avery246813579
By the looks of it, the datawatcher is responsible for the Invul tag. I'll have a play around with it today if I get time or tomorrow if not.
@confuser
Well I have seem to found how to shut the shield down, but when you add it in the health gets reset to full. Here is the Gists: https://gist.github.com/Avery246813579/8ae3d994c4a0f0434de4#file-gistfile1-txt-L42 Line 32 is the start of the method inside EntityWither where you can set the integer of the 'Invul' parameter using a NBTTagCompound.
I am tired and will be going to sleep, if you can find a fix to this please share it ASAP.
@confuser
Please explain to me what shield effect is? I have never heard of it. When I use it below 50% nothing weird happens.I now see what you mean, I am looking into a way to fix this.I have found the lines in craftbukkit where the effects are added, they are on EntityWither line 147 and 149. Here is a quick screen cap: http://prntscr.com/5r1nz6. Going to see if their is a way to remove these effects.I have got a way to remove the shield, but when I do it sets the withers health to full. Weird, going into more debugging.Check comment above.
@Avery246813579
Does it still have the shield effect below 50% health?
I have fixed the errors for 1.8 with adding a fake wither. If anyone wants a copy of this plugin that works up to date, please just ask. If @confuserr wants me to fix the code on github, just ask.
I don't why but when I'm in 1.8 the bar is blinking and sometimes doesn't show. It only shows when I'm look directly at the enderdragon.
@confuser
but, why dragon bug happen if a player joins with 1.7 version? shoudn't happen if a player joins with 1.8 version only?
@Qwahchees
It's not possible to make the dragon invisible.
Just a note to the plugin dev (thanks for your work btw.), make the dragon invis + chunk dist. 4?
I am seeing a enderdragon in the distance flattering. Its not moving and i cant hit it and it stays there until i unload the plugin. I have the offical spigot 1.8 release and wonder if this is just me or am i missing something important ?
@confuser
Actually I make plugins that use this, so IDK what my users want.
Ill just code so both work and they can choose.
@jacob_vejvoda
It uses a wither, which suffers from smoke particles and a rather obnoxious shield effect. Both have caveats, use whichever your players hate the least.
@confuser
Then how come BossBarAPI has bars working fine in 1.8, no ender dragon in the distance, and the bar does not flicker?
It seems people are unable to read "Known Caveats" when downloading a plugin, so I'm just going to say this once more.
Due to a client side bug with 1.8, the bar is only visible to a player if they are looking at the enderdragon. This means players will be able to see an enderdragon in the distance.
I can see a ender dragon in the distance, please fix this.
Also the bar keeps disappearing even when I don't want it to.
@confuser
I sent you a pm.
@comniemeer
The code that is calling BarAPI, unless you can clone the repo, and add some debugging in to find what is causing the NPE? Never had any notices from the Frostcast logs of such an error, so I'm curious as to what it could be.
@WeBBHosts
What if the client has it set to less than 16? As far as I'm aware, the minimum it can be set to is 2. I'm not aware of any way of getting what the render distance the client has to change it on a per player basis.I could set it to 2 chunks away by default, but then it'd be right in front of the player.
@confuser
I have a custom plugin that uses BarAPI on my server. What information do you need?