1.17.1 Easiest way to make player health above 20 persistent?

Discussion in 'Spigot Plugin Development' started by WaiAi, Oct 17, 2021.

  1. I'm trying to effectively double the max hp on my server so I set max hp for new players to 40, but any health above 20 will be reset when the player logs off or the server restarts or whatever. I have little experience in plugins and am looking for the most simple way to do this.
  2. Check out this thread, a tutorial on the PersistentData API. It contains an example of how to store a double "inside" of a player that can be loaded at any time the player is online.

    Simply set the player's health to the saved value when logging in, and save the player's health to its persistent data container when it logs out.
  3. thanks, it means a lot to me
  4. Do you set it for all players to 40?