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.
@ooOJoeyBoyOoo
BarAPI.hasBar(Player player) isn't a permission node, it's a piece of code that plugin developers use when they're integrating BarAPI into their own plugin.
@minerUGF
"This plugin does nothing on its own. It is simply an API for other plugins to implement with." This is a API this does nothing. This is for Java plugin devs. Unless you are one then leave this plugin alone. If you wont a plugin that will do someone there are a lot out there I recommend BossMessage and BossBroadcast.
What the heck are the commands(in game) AND what the heck a project build path and how do i get to it!?!?!?!?!? please reply i really need help
Hey confuserr,
I use your BarAPI with Boss Message Bar. It works fine , you did good work with that API. But nobody but me can see the bar. The Boss Bar Message Site doesn't give any permission infos or anything else. I tried putting BarAPI.hasBar into default's permissions (I'm no developer so I don't have a clue if its right or not :P) Can you help me with that please?
I've just downloaded the latest dev build and it is working fine?
Doesn't working with latest craftbukkit build (1.7.2)
@Shevchikden
It'll be an issue with the fix I applied for the bar disappearing after teleporting.
https://github.com/confuser/BarAPI/blob/master/src/me/confuser/barapi/BarAPI.java#L73
Runs after 2 ticks. Your bar remove is most likely running before that. I'm surprised you haven't had any NPE's when you remove the bar straight after teleporting?
If you can think of a solution, I'm all ears.
@confuser
manually remove bar -> teleport player | works
teleport player -> manually remove bar | doesn't work
@Shevchikden
The bar will persist even through teleporting. You should still be able to remove the bar after teleporting? I'm not sure what behaviour you're expecting and what is actually occurring?
@tgndev
Read comments 5-6 below yours =)
Ok i found the source of the problem, you should put a warning to the developers somewhere that the bar should be removed before attempting to teleport player
@confuser
spigot real 1.7.2
@Shevchikden @confuser
Can confirm, running spigot real 1.7
Build 8
Do you have maven repo for this?
@Shevchikden
Which version of the plugin are you using? Are you running bukkit or spigot? Which version, 1.7, fake 1.7 or 1.6.4?
For some reason removing bar is not working
@SimSonic
Thanks for the PR. I actually have a CI server already set up with BarAPI.
http://jamesmortemore.com:8080/job/BarAPI/
It also has a maven repo. I just haven't gotten round to editing this page to put it on. No harm in having more than one location though.
Hello, I've setted up CI server and added this library as a job.
Link Removed
Anyone can use it as a maven repository:
I've also sent pull request to you on GitHub to change groupId from "BarAPI" to "me.confuser", this will be right!
Thanks for the update! This one came faster them some plugins :D
Thanks for the update, v2.0 is working as expected!