[SPIGOT-6353] Allow plugins to modify the server's max health during runtime Created: 10/Feb/21  Updated: 10/Feb/21

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

Type: New Feature Priority: Minor
Reporter: MagmaGuy Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None

Version: 1.16.5+
Plugin: EliteMobs
Guidelines Read: Yes

 Description   

It would be very nice to be able to modify the server's allowed max health during runtime.

Currently users are forced to modify this value manually, so plugins that rely on values above 1024/2048 health are forced to either document a setup step where users change the value manually and then restart or modify the value themselves and then requesting users to restart.

 

Currently I am setting this value myself via

 

Bukkit.getServer().spigot().getConfig().set("settings.attribute.maxHealth.max", 100000000);

 

and then saving the file, which queues a modification for the next restart.

 

However, even though I've documented a request to my users to restart the server once before setting up content that uses values above 2048hp, it has become a consistent point of failure for them, especially for non-English speakers and some of the younger admins.

 

It's a minor thing, but it would be a cool thing to have.



 Comments   
Comment by MagmaGuy [ 10/Feb/21 ]

I appreciate the hint! Currently I do not use NMS code for my projects, but I will keep this info in my back pocket in case it does not get integrated and this devolves into too much of an unmanageable problem.

Comment by Black Hole [ 10/Feb/21 ]

You could cast "net.minecraft.server.<Version>.GenericAttributes.MAX_HEALTH" to "net.minecraft.server.<Version>.AttributeRanged" and change the field "maximum", like Spigot does while reading the config file.

Generated at Sat Apr 05 09:53:28 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.