PlayerBar
Owners
This plugin is mainly designed as an API but if you use it standalone on your server it will act as a new health system!
Plugin Developers
To use the API just drop the plugin into you're java build path.
API
Functions
PlayerBar.getHealth(player) Will return the health of a specific player.
PlayerBar.getMaxHealth(player) Will return a player max health.
PlayerBar.getMessage(player) Will return the message displayed on a player's bar.
PlayerBar.hasHealth(player) Will return if the player has a bar or not.
PlayerBar.setHealth(player, health, livingEntity, killAble) Will set a player's health, if the player wasn't hit by anything set the livingEntity as null and if the player wont die from the event set the killAble as false.
PlayerBar.updateBar(player, livingEntity, killAble) Will update the bar for a player, leave the livingEnitty as null if the player wasn't hit by something and set killAble as false if the player can't die from the specific event.
PlayerBar.setMainDisplay(player) Will display the bar of a specific player on everyone's screen.
Metadata You can get a players "playerBarHealth" metadata to get his health, if you don't want to use the plugin API it'self!
If you change the damage of the EntityDamageByEntityEvent the damage taken should decrease the player health.
Custom Event
event.getAttacker() Returns the entity which attacked the player, if none will return null.
event.getHealth() Returns the player health after being changed.
event.getMaxHealth() Returns the player max health.
event.getPercentage() Returns player's ..% health.
event.getPlayer() Returns the player triggering the event.
Use "HealthUpdateEvent" to trigger the event!
Configs
Increase Health After Time: true - Set to false if you don't want players to regen hp.
Increase If Player Has Hunger: true - Set to false if you want players always to regen hp.
Health Type: bar - Sets the type of bar which will be used ( bar, normal, text ) [ Keep in mind to restart the server if you change this and you use v0.4! ]
Update Time: 5000 - Set the amount of times for the players to gain hp ( milliseconds ).
Health Increased After Time: 1 - Set the health regenerated every update.
Message: 'You have %health% health and level %level%' - Set's the message on the base ( tags supported: %name%, %level%, %health% , %maxHealth%, %expToLevel%, %food%, %flySpeed%, %speed%).
Default Max Health: 20 - Set's the default max health, which will be set when a player joins for the first time.
Plugins using PlayerBar
Send me a private message with you're plugin if you are using PlayerBar.
What this actually does
If you use this plugin all by it'self it will change the minecraft old healthbar to a new one way more configureable!
Metrics
This plugin utilises Hidendra's plugin metrics system, which means that the following information is collected and sent to mcstats.org:
- A unique identifier.
- The server's version of Java.
- Whether the server is in offline or online mode.
- The plugin's version.
- The server's version.
- The OS version/name and architecture.
- The core count for the CPU.
- The number of players online.
- The Metrics version.
- Opting out of this service can be done by editing plugins/Plugin Metrics/config.yml and changing opt-out to true.
Reminder
This plugins changes the way minecraft health works, keep that in mind!
In the next update, will the plugin use other plugins for its health values? Because as of now, potions do not work and neither does the /heal command because they all affect the vanilla hearts.
@Newiezz
I didn't make it work with more hearts, the only thing I've done is that IF you have more hearts than the normal the ..% of you hp will display on that amount of hearts, bassically the hp system is exactly the same, only if you have plugins which add more hearts it will be compatible.
@99razvan99
I am using default hearts with SkillApi, do not make it depending on your hearts, I work with high heal values and having over 40 hearts on screen will make it look weird.
Huh, it was hard but I've found the formula for the health percent if you have more than the normal hearts!
@Supavitax
Allright except compatibility for most of the plugins in the next update( you're health will be the same but it will show correctly with any amount of hearts )!
@99razvan99
I'd say the most efficient way is run a check through common events to check whether the PlayerBar max value is equal to the players max health as all of the plugins I listed probably update the max health through one of those events.
@Supavitax
Or, I will try to do something for compatibility!
@Supavitax
Yeah, and what should I do, cause bukkit doesn't come with a event for health change so, I can not know when a player max health has changed.
@99razvan99
But I mean any plugin that changes the max health to above 20 will be displayed incorrectly when using it with your plugin.
http://dev.bukkit.org/bukkit-plugins/dakado-health/
http://dev.bukkit.org/bukkit-plugins/level-health/
http://dev.bukkit.org/bukkit-plugins/skillapi/
http://dev.bukkit.org/bukkit-plugins/item-lore-stats/
http://dev.bukkit.org/bukkit-plugins/heroes/
Those are 5 plugins that can change the max health of a player and I'm 99% sure that if you used any of them and set the players max health to above 20 it would be displayed incorrectly with your plugin because you are grabbing a default value from the config.
Surely the bugs are worth fixing to make it compatible with as many other plugins as possible.
@Supavitax
By wrote incorrectly I meant like, if a plugin uses the EntityDamageByEntityEvent and in place of changing the event damage, it changes the player health. And btw my plugin actually displays the hp in another bar, even tho you can change that in the configs.
@xXRoboJackXx
I'm not sure if it work with Heroes, haven't tested it.
@99razvan99
What do you mean by wrote correctly? So any plugin that alters the max health is wrote incorrectly according to you? As your plugin will overwrite any values the other plugins set, because in my opinion yours is wrote incorrectly as yours is only meant to display the players health in a different bar.
Does this work with Heroes?
Btw, I will release the first actual stable build tommorow!
@Supavitax
Yeah, that would add some compatibility but it would also come with a ton of bugs, anyway it should be compatible with almost any plugin wrote correctly.
@99razvan99
Why don't you grab the max health of the player rather than grabbing a default value from the config? Would add compatibility for plugins that alter the max health.
@Newiezz
I've checked SkillAPI api and I don't see anything I can use to implement the health thing, it doesn't contain anything like getPlayerMaxHealth, or any event I can use, sorry. :(
@Newiezz
The thing with creative, should be easy to fix and I will see if I can add support for skillapi.
Btw, how do you decreased/increased the hp.
While on creative I am taking damage from explosions. I use skill api, create a class and increase his Hp per level, I level up, get the heal noticed by skillapi and it applies more hearths but player bar keeps showing 20/20 hp. Also if I decrese the hp or increase it a bit the player bar does not change.
In the new version you can use the player normal health bar instead of the dragon one!
Released v0.4, huh, tons of things done this version!