[REQ] Plugins that regenerates Hunger

Discussion in 'Archived: Plugin Requests' started by daniel741852, Nov 20, 2012.

  1. Offline


    Basically what the title says, I use hunger as Stamina on my server, I would like a plugin that regenerates half a food bar each 2 seconds, or configurable
  2. I will attempt to do this, Let me research what your asking first.

    Oh and use the proper format.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 30, 2016
  3. Offline


    Plugin that regenerates the Hunger bar, and configurable if you have the time :)
  4. Offline


    So it always regenerates half a hunger every 2 seconds? I'll get right to it, should be easily configurable as well.
  5. Too busy for this sorry. Eternal it is up to you! xD
  6. Offline


    Done! Currently it is very simple; the two seconds are counted on the server, instead of being individual for each player. This is mostly because it's a small and unnoticeable trade-off for efficiency.
    * <Edit by Moderator: Redacted mediafire url>
    * Source repository

    I hope it works well for you! Keep in mind that in the config generated, it counts the delay in seconds. I defaulted it to 2 seconds, since that's what you asked for.

    Edit: Oh, by the way, it currently logs every single regeneration of hunger. I can remove this if it's a problem, it was mostly meant for debugging.
    Last edited by a moderator: Nov 8, 2016
  7. Offline


    Ill test it, thanks man!

    It wokrs!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 30, 2016
  8. Offline


    Just FYI for those looking back at this and a word of warning:

    #1 you can't reference the player object in an asynchronous thread, nor can you modify the hunger value. The plugin as is, will potentially crash out the server or cause problems.

    #2 don't keep debug logging enabled, you should remove the per-player log spam as it causes a bunch of unnecessary writes to the log file every single interval for any player that has used stamina.
    MrBluebear3 likes this.
  9. Offline


    This could have been done with a global WorldGuard feed-amount and feed-delay flag. ._.
  10. Offline


    Well, I didn't notice the crashing, and daniel isn't complaining, so I don't really see what you mean.

    I know I should've disabled the logging, but the guy requesting it didn't seem to have any issues with it, so I just let it be.
    Not everyone has WG.
  11. Offline


    EternalFacepalm - it wont necessarily be immediately noticable. But if anything else at all increases/reduces hunger while your plugin does it breaks. End of argument. The result can be a wide variety of problems, from server crash, to be as tame as invalid hunger values and the hunger change not doing anything that tic.

    Regardless, it's a bug. You can't modify the player object safely in any thread other than the main one.

Share This Page