[SPIGOT-3813] player.setHealth doen't work reliable Created: 11/Feb/18  Updated: 11/Feb/18  Resolved: 11/Feb/18

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Lorenz Lindemann Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: health, spigot
Environment:

Spigot-Server: spigot-1.12.2
Spigot-API: spigot-api-1.12.2-R0.1
Client-OS: Win10
Server-OS- Win10



 Description   

 

I've encountered a Bug in a Plugin I currently develop. I couldn't find an an solution for so I've decided to create an Test-Plugin which only has two simple Commands.

Command "join":

p.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(6);

Command "leave":

p.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(20);
p.setHealth(20);

Expected behaviour:
on "/join"
-  show three hearts.
-  Three of them full.
on "/leave":
-  show ten hearts.
-  Ten of them full.

Result:
on "/join"
-  show three hearts.
-  Three of them full.
on "/leave":
-  show ten hearts.
-  Ten of them full.
It does not always shows the ten hearts as full.
I coudn't find out why and when it works and when not.
Strange thinge about it is, that if I use "p.getHealth()" I get "20" even if it only shows 3 full hearts.

 

 


Generated at Fri Apr 11 16:22:33 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.