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

German - DerFeliix

Source

GitHub

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.

Frostcast CI

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

WelcomeBar

Parkour

QuickSupport

BossBroadcast

BossMessage

PvPGames Automated

BossEventScheduler

Infernal Mobs

MythicMobs

MultiKill

PlayerBoss

BossAds

Item Lore Stats

BossBarPro

VIPLobby

Battle Of Blocks

BossBroadcaster

SilkSpawners

BarJoin

JoinGlobalMessages

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.

You must login to post a comment. Don't have an account? Register to get one!

  • Avatar of confuserr confuserr Dec 19, 2014 at 13:02 UTC - 0 likes

    v3.3 released, supports Spigot 1.8, not just the protocol hack.

  • Avatar of ferrago ferrago Dec 13, 2014 at 21:54 UTC - 0 likes

    @confuserr: Go

    I am aware of the boss shield issue with withers. The api works fine for showing messages, but you are right. I am still playing around with it, but as it is a client side effect it might be close to impossible to remove it. I have been talking with md_5, and the spigot team but they have more pressing issues they have higher on their list of stuff to fix, but they DO intend on fixing issues with ender dragon.

    CQR|CQR BFAK:90678341,d162341bd70f9d48ee9bedc969773e3b0744d0a6da70e240520c96318ec8557b

  • Avatar of jacob_vejvoda jacob_vejvoda Dec 13, 2014 at 21:46 UTC - 0 likes

    I am trying to use this in 1.8 with my plugin, but I am getting this error:

    [13:40:57 WARN]: java.lang.NoSuchMethodException: net.minecraft.server.v1_8_R1.PacketPlayOutEntityTeleport.<init>(int, int, int, int, byte, byte)
    [13:40:57 WARN]: 	at java.lang.Class.getConstructor0(Class.java:2892)
    [13:40:57 WARN]: 	at java.lang.Class.getConstructor(Class.java:1723)
    [13:40:57 WARN]: 	at me.confuser.barapi.nms.v1_7.getTeleportPacket(v1_7.java:139)
    [13:40:57 WARN]: 	at me.confuser.barapi.BarAPI.sendDragon(BarAPI.java:439)
    [13:40:57 WARN]: 	at me.confuser.barapi.BarAPI.setMessage(BarAPI.java:259)
    [13:40:57 WARN]: 	at io.hotmail.com.jacob_vejvoda.infernal_mobs.GUI.fixBar(GUI.java:88)
    [13:40:57 WARN]: 	at io.hotmail.com.jacob_vejvoda.infernal_mobs.infernal_mobs.scoreCheck(infernal_mobs.java:146)
    [13:40:57 WARN]: 	at io.hotmail.com.jacob_vejvoda.infernal_mobs.infernal_mobs$1.run(infernal_mobs.java:169)
    [13:40:57 WARN]: 	at org.bukkit.craftbukkit.v1_8_R1.scheduler.CraftTask.run(CraftTask.java:71)
    [13:40:57 WARN]: 	at org.bukkit.craftbukkit.v1_8_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:350)
    [13:40:57 WARN]: 	at net.minecraft.server.v1_8_R1.MinecraftServer.z(MinecraftServer.java:695)
    [13:40:57 WARN]: 	at net.minecraft.server.v1_8_R1.DedicatedServer.z(DedicatedServer.java:316)
    [13:40:57 WARN]: 	at net.minecraft.server.v1_8_R1.MinecraftServer.y(MinecraftServer.java:625)
    [13:40:57 WARN]: 	at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:528)
    [13:40:57 WARN]: 	at java.lang.Thread.run(Thread.java:745)
    

    Check out my YouTube, my Face-book, my Game, and my Mods!

    PM me, (-;

  • Avatar of Mineraftair Mineraftair Dec 13, 2014 at 12:31 UTC - 0 likes

    I found a craftbukkit version for 1.8! Maybe it helps you! http://spigotmc.info/

    (I use it too, it works perfect ;-))

  • Avatar of DrkMatr1984 DrkMatr1984 Dec 09, 2014 at 06:15 UTC - 0 likes

    PM me for working copy for 1.8 Official and Protocol Hack spigot version. I've updated the plugin for my server. Also, there's an option in Config if you're using latest version, it says "useSpigotHack" you need to put "true" in there.

    MyekaanCraft

  • Avatar of tommyraudy tommyraudy Dec 06, 2014 at 12:16 UTC - 0 likes

    i can see enderdragon if use this plugin on latest spigot patch with/without carbon, and i use the latest dev build (#29)

  • Avatar of confuserr confuserr Dec 05, 2014 at 12:41 UTC - 0 likes

    @ferrago: Go

    Have you solved the shield/particle effects withers show when going below 50% health? If so, I'd be happy to accept a PR for it. If not, I'd recommend testing at below 50% health, you'll see it is far more annoying than simply seeing an enderdragon in the distance.

  • Avatar of mfish56 mfish56 Dec 05, 2014 at 07:19 UTC - 0 likes

    @ferrago: Go

    So when/how do we stop getting the annoying console spam errors?

    5:17:38 PM CONSOLE: WARN]: at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628)
    5:17:39 PM CONSOLE: WARN]: java.lang.NoSuchMethodException: net.minecraft.server.v1_7_R4.PacketPlayOutEntityTeleport.<init>(int, int, int, int, byte, byte)
    5:17:39 PM CONSOLE: WARN]: at java.lang.Class.getConstructor0(Class.java:2721)
    5:17:39 PM CONSOLE: WARN]: at java.lang.Class.getConstructor(Class.java:1674)
    5:17:39 PM CONSOLE: WARN]: at me.confuser.barapi.nms.v1_7.getTeleportPacket(v1_7.java:139)
    5:17:39 PM CONSOLE: WARN]: at me.confuser.barapi.BarAPI.sendDragon(BarAPI.java:439)
    5:17:39 PM CONSOLE: WARN]: at me.confuser.barapi.BarAPI.access$500(BarAPI.java:32)
    5:17:39 PM CONSOLE: WARN]: at me.confuser.barapi.BarAPI$4.run(BarAPI.java:328)
    5:17:39 PM CONSOLE: WARN]: at org.bukkit.craftbukkit.v1_7_R4.scheduler.CraftTask.run(CraftTask.java:71)
    5:17:39 PM CONSOLE: WARN]: at org.bukkit.craftbukkit.v1_7_R4.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:350)
    5:17:39 PM CONSOLE: WARN]: at net.minecraft.server.v1_7_R4.MinecraftServer.v(MinecraftServer.java:641)
    5:17:39 PM CONSOLE: WARN]: at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:289)
    5:17:39 PM CONSOLE: WARN]: at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:584)
    5:17:39 PM CONSOLE: WARN]: at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:490)
    5:17:39 PM CONSOLE: WARN]: at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628)
    5:17:40 PM CONSOLE: WARN]: java.lang.NoSuchMethodException: net.minecraft.server.v1_7_R4.PacketPlayOutEntityTeleport.<init>(int, int, int, int, byte, byte)
    5:17:40 PM CONSOLE: WARN]: at java.lang.Class.getConstructor0(Class.java:2721)
    5:17:40 PM CONSOLE: WARN]: at java.lang.Class.getConstructor(Class.java:1674)
    5:17:40 PM CONSOLE: WARN]: at me.confuser.barapi.nms.v1_7.getTeleportPacket(v1_7.java:139)
    5:17:40 PM CONSOLE: WARN]: at me.confuser.barapi.BarAPI.sendDragon(BarAPI.java:439)
    5:17:40 PM CONSOLE: WARN]: at me.confuser.barapi.BarAPI.access$500(BarAPI.java:32)
    5:17:40 PM CONSOLE: WARN]: at me.confuser.barapi.BarAPI$4.run(BarAPI.java:328)
    5:17:40 PM CONSOLE: WARN]: at org.bukkit.craftbukkit.v1_7_R4.scheduler.CraftTask.run(CraftTask.java:71)
    5:17:40 PM CONSOLE: WARN]: at org.bukkit.craftbukkit.v1_7_R4.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:350)
    5:17:40 PM CONSOLE: WARN]: at net.minecraft.server.v1_7_R4.MinecraftServer.v(MinecraftServer.java:641)
    5:17:40 PM CONSOLE: WARN]: at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:289)
    5:17:40 PM CONSOLE: WARN]: at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:584)
    5:17:40 PM CONSOLE: WARN]: at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:490)
    5:17:40 PM CONSOLE: WARN]: at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628)
    5:17:41 PM CONSOLE: WARN]: java.lang.NoSuchMethodException: net.minecraft.server.v1_7_R4.PacketPlayOutEntityTeleport.<init>(int, int, int, int, byte, byte)
    5:17:41 PM CONSOLE: WARN]: at java.lang.Class.getConstructor0(Class.java:2721)
    5:17:41 PM CONSOLE: WARN]: at java.lang.Class.getConstructor(Class.java:1674)
    5:17:41 PM CONSOLE: WARN]: at me.confuser.barapi.nms.v1_7.getTeleportPacket(v1_7.java:139)
    5:17:41 PM CONSOLE: WARN]: at me.confuser.barapi.BarAPI.sendDragon(BarAPI.java:439)
    5:17:41 PM CONSOLE: WARN]: at me.confuser.barapi.BarAPI.setMessage(BarAPI.java:334)
    5:17:41 PM CONSOLE: WARN]: at me.pjv99.BossBarPro.Main$1.run(Main.java:116)
    5:17:41 PM CONSOLE: WARN]: at org.bukkit.craftbukkit.v1_7_R4.scheduler.CraftTask.run(CraftTask.java:71)
    5:17:41 PM CONSOLE: WARN]: at org.bukkit.craftbukkit.v1_7_R4.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:350)
    5:17:41 PM CONSOLE: WARN]: at net.minecraft.server.v1_7_R4.MinecraftServer.v(MinecraftServer.java:641)
    5:17:41 PM CONSOLE: WARN]: at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:289)
    5:17:41 PM CONSOLE: WARN]: at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:584)
    5:17:41 PM CONSOLE: WARN]: at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:490)
    5:17:41 PM CONSOLE: WARN]: at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628)
    5:17:42 PM CONSOLE: WARN]: java.lang.NoSuchMethodException: net.minecraft.server.v1_7_R4.PacketPlayOutEntityTeleport.<init>(int, int, int, int, byte, byte)
    5:17:42 PM CONSOLE: WARN]: at java.lang.Class.getConstructor0(Class.java:2721)
    5:17:42 PM CONSOLE: WARN]: at java.lang.Class.getConstructor(Class.java:1674)
    5:17:42 PM CONSOLE: WARN]: at me.confuser.barapi.nms.v1_7.getTeleportPacket(v1_7.java:139)
    5:17:42 PM CONSOLE: WARN]: at me.confuser.barapi.BarAPI.sendDragon(BarAPI.java:439)
    5:17:42 PM CONSOLE: WARN]: at me.confuser.barapi.BarAPI.access$500(BarAPI.java:32)
    5:17:42 PM CONSOLE: WARN]: at me.confuser.barapi.BarAPI$4.run(BarAPI.java:328)
    5:17:42 PM CONSOLE: WARN]: at org.bukkit.craftbukkit.v1_7_R4.scheduler.CraftTask.run(CraftTask.java:71)
    5:17:42 PM CONSOLE: WARN]: at org.bukkit.craftbukkit.v1_7_R4.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:350)
    5:17:42 PM CONSOLE: WARN]: at net.minecraft.server.v1_7_R4.MinecraftServer.v(MinecraftServer.java:641)
    5:17:42 PM CONSOLE: WARN]: at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:289)
    5:17:42 PM CONSOLE: WARN]: at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:584)
    

    This is extremely frustrating...and I have no idea how to 'shut it up'. I contacted my server host, and they said simply removing the plugin fixes it....I just tilted my head and thought, "but I want the plugin...what do you say to that?" They didn't know, and just removed it again.

    So where does this leave us server owners using the Spigot 1.8 (1.7 hack, no 1.8 features)???

  • Avatar of ferrago ferrago Dec 04, 2014 at 02:31 UTC - 0 likes

    @NubeBuster: Go

    His plugin was updated for spigot 1.7.10 (fake 1.8 protocol). Therefor the 1_8_R1 stuff isn't in his plugin. That is why you are getting errors. Wait for him to update it.

  • Avatar of ferrago ferrago Dec 04, 2014 at 02:30 UTC - 0 likes

    @confuserr: Go

    I was able to negate the issue of the EnderDragon being in the distance by modifying your code to use fake WIthers instead. The setInvisible() doesn't effect the EnderDragon, but it does effect the Wither. Only problem I am having is the bar fill percent and the name isn't updating. I am looking through the NMS to figure out why. But this was all confirmed on most recent version of spigot.

    EDIT: Fixed the percentage from being wrong by updating max total health to 300. Just need to figure out why name isn't updating. EDIT2: Fixed the message display, by removing the current bar if set, when setting message.

    If you would be so kind I am sure players would love if you used the invisible wither instead so player's couldn't see it.

    If you would like me to send you a pull request for my changes for you to review I can.

    Last edited Dec 04, 2014 by ferrago

Facts

Date created
Sep 01, 2013
Category
Last update
Dec 19, 2014
Development stage
Release
License
Creative Commons Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales
Curse link
BarAPI
Downloads
423,312
Recent files

Authors