1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 14:05:25 +01:00

Food level needs to be checked by PLayer object and not HumanEntity

This commit is contained in:
Zrips 2021-06-24 14:42:06 +03:00
parent d25086e3da
commit cd973fd35d

View File

@ -1489,12 +1489,12 @@ public final class JobsPaymentListener implements Listener {
public void onPlayerEat(FoodLevelChangeEvent event) {
HumanEntity human = event.getEntity();
if (event.getFoodLevel() <= human.getFoodLevel() || !(human instanceof Player)
|| !Jobs.getGCManager().canPerformActionInWorld(human.getWorld()) || human.hasMetadata("NPC"))
if (!(human instanceof Player) || !Jobs.getGCManager().canPerformActionInWorld(human.getWorld()) || human.hasMetadata("NPC"))
return;
Player player = (Player) human;
if (!player.isOnline())
if (!player.isOnline() || event.getFoodLevel() <= player.getFoodLevel() )
return;
// check if in creative