Any Update on Hunger / Food Change Event?

Hey guys,

Is there any update on Food Hunger Change Event? I read few old posts and it wasn’t implemented back then. Is it ready now?

If not, what is the work around?

Thanks.

Do you mean this event?

ChangeDataHolderEvent.ValueChange

If so, I personally have no idea if its implemented yet, however I do remember responding to a post back in the days of API 4 so its been a while.

I also can not see any issues relating to the event implementation on the GitHub issues page, so signs are pointing to its implemented.

If its not then your going to need to do it the old bukkit way. By creating a scheduler and save the data that you wish to compare and compare it on the next scheduled run. If different then run your code. Its not efficient nor … Well anything good, except it works.

@Listener
  public void onFoodLevelChange (ChangeDataHolderEvent event) {  ... }

Yeah… Hunger Change doesn’t trigger this event. I think I have to try the scheduler method but I am worried about optimization :frowning:

Depending on what your doing with the hunger you may not notice it.

Edit:,
Second thought you wont as long as you program it correctly as the main lot of code would only run if the hunger is changed. The checking to see if the hunger has changed will take on almost 0% of resources