mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-30 14:13:38 +01:00
Fix scaling of player health bar
This commit is contained in:
parent
505e6b3b90
commit
3650dc7d2a
@ -56,10 +56,10 @@ componentconstructors['playermarkers'] = function(dynmap, configuration) {
|
||||
if (player.health !== undefined && player.armor !== undefined) {
|
||||
player.healthBar = $('<div/>')
|
||||
.addClass('playerHealth')
|
||||
.css('width', (player.health/2*5) + 'px');
|
||||
.css('width', Math.ceil(player.health*2.5) + 'px');
|
||||
player.armorBar = $('<div/>')
|
||||
.addClass('playerArmor')
|
||||
.css('width', (player.armor/2*5) + 'px');
|
||||
.css('width', Math.ceil(player.armor*2.5) + 'px');
|
||||
|
||||
$('<div/>')
|
||||
.addClass('playerHealthBackground')
|
||||
@ -97,8 +97,8 @@ componentconstructors['playermarkers'] = function(dynmap, configuration) {
|
||||
if (configuration.showplayerhealth) {
|
||||
if (player.health !== undefined && player.armor !== undefined) {
|
||||
player.healthContainer.css('display','block');
|
||||
player.healthBar.css('width', (player.health/2*5) + 'px');
|
||||
player.armorBar.css('width', (player.armor/2*5) + 'px');
|
||||
player.healthBar.css('width', Math.ceil(player.health*2.5) + 'px');
|
||||
player.armorBar.css('width', Math.ceil(player.armor*2.5) + 'px');
|
||||
} else {
|
||||
player.healthContainer.css('display','none');
|
||||
}
|
||||
|
@ -631,8 +631,9 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
}
|
||||
@Override
|
||||
public double getHealth() {
|
||||
if(player != null)
|
||||
return helper.getHealth(player);
|
||||
if(player != null) {
|
||||
return Math.ceil(2.0 * player.getHealth() / player.getMaxHealth() * player.getHealthScale()) / 2.0;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user