Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hunger going down despite player food being disabled #1857

Open
3 tasks done
WillQizza opened this issue Jun 20, 2021 · 0 comments
Open
3 tasks done

Hunger going down despite player food being disabled #1857

WillQizza opened this issue Jun 20, 2021 · 0 comments

Comments

@WillQizza
Copy link

WillQizza commented Jun 20, 2021

Expected Behavior

If I disable the food of a player, that player should not lose hunger ever.

Actual Behavior

Despite disabling the food of a player, they lost hunger when trading hits with another account.

Steps to Reproduce

  • Have a plugin disable food. (in my case, I had this)
public class Plugin extends PluginBase implements Listener {

    @Override
    public void onEnable() {
        this.getServer().getPluginManager().registerEvents(this, this);
    }

    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {
        event.getPlayer().setFoodEnabled(false);
    }


}

The most reliable method to reproduce this is to...

  • Have two accounts online at the same time
  • Have them exchange hits with one another (don't kill the other)
  • After a minute or so of trading hits, you'll notice their hunger goes down despite not having food enabled.

Debug information

  • Debug link:
  • Timings link (if relevant):

Not necessarily the normal debug information, but when using the Java debugger to see what was going on, the server never sent updated attributes for hunger after it initially set the max hunger. (the hunger also never changed server-side) It could be similar to the desync with #1855 in how the client thought it could regenerate health without the server telling it to. (we can apply that here to hunger)

I used gophertunnel and what Hive does is that they send the food attribute after every single action (from what I can see) that consumes food to set the food back to the maximum. This would most likely fix the issue since the client would constantly have it's hunger set back to the maximum preventing it from displaying incorrect hunger.

Crashdump, Backtrace or Other Files

Checklist:

  • [] I included a /debugpaste link
  • I made sure there aren't duplicates of this report (Use Search)
  • I made sure I am using an up-to-date version of Nukkit
  • I Made sure the bug/error is not caused by a plugin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant