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
Just for helping, I already found the reason why it isn't working: In spigot(dunno about bukkit) there was a field added onGround, this fixed it: public Object getTeleportPacket(Location loc) { .... packet = PacketPlayOutEntityTeleport.getDeclaredConstructor(new Class<?>[] { int.class, int.class, int.class, int.class, byte.class, byte.class, boolean.class }).newInstance(this.id, loc.getBlockX() * 32, loc.getBlockY() * 32, loc.getBlockZ() * 32, (byte) ((int) loc.getYaw() * 256 / 360), (byte) ((int) loc.getPitch() * 256 / 360), true);
And: public Object getTeleportPacket(Location loc) { ..... Field onGround = Util.getField(packet_class, "onGround"); onGround.setAccessible(true); onGround.set(packet, true);
onGround false does remove the error but the Enderdragon still disapears on teleport so i used true and it worked :)
Edit: Problem is, 1.7.8 etc clients can see the bar, 1.8 clients can't :D
@parat26ify
This plugin is an API for other developers to implement. There are NO commands. Go complain to the plugin developer about the errors you are experiencing, as they have nothing to do with this plugin.
@Squawkers13
Yep, will do, just converting Frostcast over to the 1.8 hack first, then I'll sort it out those errors with this plugin :)
Are you guys really serious? I have really no clue how these commands work, the message bar disappears after the seconds if you set it permanently, and the fun part, it seems like there is no command check which means it throws an ArrayOutOfBoundsException if you don't specify enough arguments. Also, all the commands seem to work exactly the same, no matter if its /bm world or just /bm, it's just really confusing.
Could you possibly add compatibility with Spigot's 1.8 protocol hack?
Running API methods on a Spigot 1.8 protocol supporting server throws this error:
Just tested v3.1 with 1.7.10 and it seemed to work just fine.
Those that experienced errors, what build did you have the problem with?
I've recompiled this plugin with 1.7.10 and java 1.7 and it seems to work. However THIS BUILD IS NOT REVIEWED BY BUKKIT (So basically I could make it destroy your server, it won't, but just have to tell you that) http://wwx.be:8283/job/BarAPI/ You can see everything I've changed here: https://github.com/woutwoot/BarAPI
Pssst, SilkSpawners does use BarAPI, too :)
@frickx
I'll take a look at the weekend.
Please update to 1.7.10. :)
seems that it doesnt work with spigot 1.7.10 :/
Caused by: java.lang.NullPointerException
at me.confuser.barapi.Util.sendPacket(Util.java:71) ~[?:?]
at me.confuser.barapi.BarAPI.addDragon(BarAPI.java:423) ~[?:?]
at me.confuser.barapi.BarAPI.getDragon(BarAPI.java:417) ~[?:?]
at me.confuser.barapi.BarAPI.setMessage(BarAPI.java:279) ~[?:?]
Also not with craftbukkit-1.7.9-R0.2
@kevc45
You need the plugin on your server. The maven dependency is simply for building your plugin. Also, why are you using 3.0 when 3.1 is the latest?
Hey, the BarAPI 3.0 maven dependency seems to be broken. Because when I just include the downloaded jar from dev.bukkit it works.
Here is the error I get: "This server is running CraftBukkit version git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks (MC: 1.7.9) (Implementing API version 1.7.9-R0.1-SNAPSHOT) Ambiguous plugin name `BarAPI' for files `plugins\PluginName-1.0.jar' and `plugins\BarAPI.jar' in `plugins'" Also my plugin does not enable.
any permissions for this plugin?
@Lionhard98
Add a check if the percentage you set the boss bar to, is (lower than) 0. If so, set it to 1. =)
@Condolent
No its just like when you use craftbukkit on your build path. It is just there so the program you use knows what you are talking about, which is why you needed to add it to the server.
It only works if the .jar file is in my plugins folder on the server. Shouldn't it just be needed to add it to my buildpath?
Could you add my plugin to your list of plugins using the API, http://dev.bukkit.org/bukkit-plugins/draw-my-thing
Thanks ;)
@kup18
It's not compatible with 1.5.2, only 1.6.4+.
whne i write bm and messige it crushes and my mc server version is 1.5.2 help me plz
which version of this plugin do i need for 1.5.2 mc server?