Allow plugins to modify the server's max health during runtime

    • Type: New Feature
    • Resolution: Unresolved
    • Priority: Minor
    • None
    • Affects Version/s: None
    • None
    • 1.16.5+
    • EliteMobs
    • Yes

      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.

          [SPIGOT-6353] Allow plugins to modify the server's max health during runtime

          MagmaGuy added a comment -

          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.

          MagmaGuy added a comment - 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.

          Black Hole added a comment - - edited

          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.

          Black Hole added a comment - - edited 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.

            Assignee:
            Unassigned
            Reporter:
            MagmaGuy
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: