1.15.2 How to get hunger points food item recovers with NMS?

Discussion in 'Spigot Plugin Development' started by ratquaza, Feb 9, 2020.

  1. Currently, I've added the spigot-1.15.2.jar generated with BuildTools (using IntelliJ, went to Project Structure > Modules > Main > Added the jar generated), so I believe I'm working both with the API and the actual server code, but I was wondering how I'd be able to get the amount of hunger points recovered by an item during PlayerItemConsumeEvent?
  2. Solved, this is how I did it:

    Code (Java):
        public void onConsume(PlayerItemConsumeEvent e) {
            int nutrition = CraftItemStack.asNMSCopy(e.getItem()).getItem().getFoodInfo().getNutrition();