Skip to content

Commit

Permalink
Fixed NullPointerException on FoodTracker in InstantEat Check (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
Verox001 authored Jul 12, 2023
1 parent d3bcc4a commit be89aca
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ class InstantEat : Check("checks.inventory.instanteat", CheckType.INVENTORY_INST
if (!(event.packet as WrapperEatFoodPacket).eat) data.setEating(true)
else {
data.setEating(false)
val totalTick = NoCheatPlus.instance.getPlayerProvider(player).movingData.getFoodTracker()!!.getCount()
if (totalTick < FoodData118.DEFAULT_EAT_TICK) {
cancel = true
cancelSaturation = (event.packet as WrapperEatFoodPacket).food.restoreSaturation
cancelFoodLevel = (event.packet as WrapperEatFoodPacket).food.restoreFood
if ((event.packet as WrapperEatFoodPacket).food is EmptyFood) cancel = false
if (NoCheatPlus.instance.getPlayerProvider(player).movingData.getFoodTracker() != null) {
val totalTick = NoCheatPlus.instance.getPlayerProvider(player).movingData.getFoodTracker()!!.getCount()
if (totalTick < FoodData118.DEFAULT_EAT_TICK) {
cancel = true
cancelSaturation = (event.packet as WrapperEatFoodPacket).food.restoreSaturation
cancelFoodLevel = (event.packet as WrapperEatFoodPacket).food.restoreFood
if ((event.packet as WrapperEatFoodPacket).food is EmptyFood) cancel = false
}
}
}
}
Expand Down

0 comments on commit be89aca

Please sign in to comment.