Random Health 1.0

Provides for randomizing health and food

  1. Strahan
    Tested Minecraft Versions:
    • 1.16
    Source Code:
    https://github.com/Strahan201/RandomHealth
    Threw together because someone asked about it on the forum.

    All commands require permission rndhealth.admin

    Commands:

    RNDHEALTH
    With no arguments, it shows current status

    RNDHEALTH toggle
    Toggles overall plugin functionality on and off

    RNDHEALTH reload
    Reloads config from disk

    RNDHEALTH interval ##
    Sets the interval in seconds to apply randomization

    RNDHEALTH [food/health/maxhealth] toggle
    Toggles whether this attribute randomization is active on the current profile

    RNDHEALTH [food/health/maxhealth] low ##
    Sets the attribute's low value

    RNDHEALTH [food/health/maxhealth] high ##
    Sets the attribute's high value

    RNDHEALTH [food/health] mode [exact/pctmax/pctcur]
    Sets the method the attribute is randomized by. Setting exact means it will randomly be set between the low and high values. Setting pctmax means it will be set to a random value between low and high% of attribute max. pctcur means instead of basing on max value, bases on current value. So if you have food set to low 10 high 50 mode pctmax, it will randomly set the food between 10% and 50% of 20 (food max). If they set it to pctcur and the player is hungry such that half of their food bar has depleted, it will do 10-50% of 10 as that's half the food max. With health, it uses the GENERIC_MAX_HEALTH attribute so if a plugin made the player super beefy with a max health of 500, if you had health set to mode pctmax with low 50 and high 75 then it would pick randomly between 250 and 375 (50-75% of 500). If the same player was beat up and only had 10 health left out of his 500 and mode was pctcur, then it would set health to between 5 and 7.5.

    By default, everyone is subject to profile "global". You can override that if you want people with a certain permission to get different settings. To use permission based profiles, create an entry under "perms" with the permission node as the key. Replace periods in the node with underscore. Perms use period, but YAML also uses period to separate out paths, so I use underscore to avoid that. In a permission based profile, there are a few extra parameters:

    weight: Determines the order in which permission profiles apply. So if a person has multiple matching permission profiles, it will choose whatever one has the heaviest weight. Heavy = larger number.

    explicit: If the person has to have the permission explicitly set. By default, if an op has a permission checked against them it will be true since they're OP. If you set explicit to true, an OP will not get this profile applied unless they have that exact permission directly on them.

    exempt: Users who will not get this profile. Comma delimited.

    I put an example of perm based profiles in the default config so you can see the layout.