Setting the max health

I just feel a little but stupid right now :thinking:

I want more or less a command to to be able to set the players health. If the given value exceeds the default 20 it shall expand the max health in order to be able to hold the hp…

log("Giving "+source+" "+amount+"hp");
Player p = (Player) source;
p.offer(Keys.MAX_HEALTH, amount>20.0?amount:20.0);
p.offer(Keys.HEALTH, amount);

but I still have 10 hearts (à 2 hp) with amount 40.0.
Is it not possible to exceed 20hp anymore? I thought it was (in bukkit at least)

I’m coding with spongeapi-7.0.0-20170726.063744-25

> sponge version
[20:28:26 INFO]: SpongeVanilla
    Minecraft: 1.12
    SpongeAPI: 7.0.0-SNAPSHOT-339a5c70
    SpongeVanilla: 1.12-7.0.0-BETA-306

It should be. Can you test if it still doesn’t work on releases of API 6 or 5 servers?

Now it works… turned out I set up my source wrong thus i couldn’t see any change of course.

Maybe I shouldn’t write code for the same plugin like 12+ hrs a day :sweat_smile: