When running the following code:
System.out.println(player.getName() + " max health: " + player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()); player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
I get this error:
[23:51:10] [Server thread/INFO]: KingFaris10 max health: 41.6 [23:51:10] [Server thread/WARN]: java.lang.IllegalArgumentException: Health must be between 0 and 41.599998474121094
It seems getValue() rounds the value, or the server's being way too specific. This error only started occurring when I changed all of my code to use attributes for max health rather than getMaxHealth() and setMaxHealth(). If this cannot be fixed, may I get suggestions on how to heal the player to max health?