HungerLevel Above 20

Discussion in 'Spigot Help' started by HiiiFishy, Sep 16, 2020.

  1. Hello,

    I apologize if this is the wrong section for this question. Somehow some of my player data files have a hungerlevel of high numbers (it's max is supposed to be 20) but some will be as high as 60.This will result in those players not losing hunger for crazy amounts of time. Is there a way to reset the entire servers hunger? Or a tool to do so?

    Thanks!
     
  2. I can program you a plugin that fixes this when the user joins
     
  3. I'm pretty sure it's supposed to be 60 max, not sure though...how could have this happened anyway?
     
  4. That's the mystery haha. I did not think it was possible to go above this number. I have found some players as high as 127 now upon looking further. Mojangs documentation says: foodLevel: The player's current hunger level, shown on the hunger bar. Its initial value on world creation is 20 (full bar).
     
  5. @lokka30 This would be amazing if you could do that! However I feel as if this would be a temporary fix to the problem since something on the server is still definitely causing this. Wouldn't this also require more resources being used on join?

    Thanks!
     
  6. Nothing at all. All the plugin will do is listen to when a person joins, and then simply set their hunger level to 20.0 if their hunger level is above 20.0. That simple, and it won't make the most smallest mark on your timings since it doesn't do any background tasks or other stupid things :)
     
  7. You'd need those players to login, but theoretically, you could reset all online players by iterating through Bukkit.getOnlinePlayers();
    Alternatively, you could do individual players in a JoinEvent whenever they login, then save that their hunger has been reset in a file so it doesn't do it again.
     
  8. I have narrowed down the issue to be a plugin called NewItems. NewItems adds textures to items and in this specific case, the issue is the items that are textured as food. If a player is one hunger bar down from full and consumes an item that fills +4 hunger their hungerLevel will then be 23. This would explain why my veteran players have a much higher hungerLevel. I have looked through the NewItems config and there is no setting to fix this, it had not done this previously until I switched to paper (which is super weird).
     
  9. This is great news. :) I narrowed down the issue (please see the above post). Possible to make sure the hunger caps at 20 (will not let it go over regardless of this textured food consumption) and reset a player's hunger to 20 on join? (to fix all current holders with the issue).
     
  10. I could easily code that for you too


    playerjoinevent as i originally intended to use is the best solution
     
  11. That would be awesome if you could, send me a PM
     
  12. All done man, could you add me on Discord so I can send it to you? lokka30#6659
     

  13. Sent thanks!