mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-24 10:09:50 +01:00
Don't treat AFK players as god mode when dealing with food regen.
This commit is contained in:
parent
7051801a85
commit
59f67acfd0
@ -170,12 +170,18 @@ public class EssentialsEntityListener implements Listener
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onFoodLevelChange(final FoodLevelChangeEvent event)
|
||||
{
|
||||
if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled())
|
||||
if (event.getEntity() instanceof Player)
|
||||
{
|
||||
final Player player = (Player)event.getEntity();
|
||||
player.setFoodLevel(20);
|
||||
player.setSaturation(10);
|
||||
event.setCancelled(true);
|
||||
final User user = ess.getUser(event.getEntity());
|
||||
if (user.isGodModeEnabled())
|
||||
{
|
||||
if (user.isGodModeEnabledRaw())
|
||||
{
|
||||
user.setFoodLevel(20);
|
||||
user.setSaturation(10);
|
||||
}
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -200,8 +206,9 @@ public class EssentialsEntityListener implements Listener
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onEntityShootBow (EntityShootBowEvent event)
|
||||
public void onEntityShootBow(EntityShootBowEvent event)
|
||||
{
|
||||
if (event.getEntity() instanceof Player)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user