Can you try double h = player.getHealth()
? From what I understand there are two getHealth methods because of backwards compatibility. There is probably some reflection magic to figure out whether the new (type double) or the old (type int) is requested.
Likewise setHealth has two versions so the compiler cannot figure out whether it should cast getHealth() + health
to int and use setHealth(int)
or whether it should castgetHealth() + health
to double and use setHealth(double)
because getHealth()
is ambigious.
@Yourcomment It is deprecated but still supported for backwards compatibility, at this point I am clueless as to why this would happen, seems bukkit has a complicated build procedure with its jars so something might have gone wrong there, however a solution I found on google suggests that casting the player to Damageable gets rid of the problem.
Damageable d = (Damageable) player;