mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-25 10:38:00 +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,14 +170,20 @@ public class EssentialsEntityListener implements Listener
|
|||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onFoodLevelChange(final FoodLevelChangeEvent event)
|
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();
|
final User user = ess.getUser(event.getEntity());
|
||||||
player.setFoodLevel(20);
|
if (user.isGodModeEnabled())
|
||||||
player.setSaturation(10);
|
{
|
||||||
|
if (user.isGodModeEnabledRaw())
|
||||||
|
{
|
||||||
|
user.setFoodLevel(20);
|
||||||
|
user.setSaturation(10);
|
||||||
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onEntityRegainHealth(final EntityRegainHealthEvent event)
|
public void onEntityRegainHealth(final EntityRegainHealthEvent event)
|
||||||
@ -200,8 +206,9 @@ public class EssentialsEntityListener implements Listener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onEntityShootBow (EntityShootBowEvent event)
|
public void onEntityShootBow(EntityShootBowEvent event)
|
||||||
{
|
{
|
||||||
if (event.getEntity() instanceof Player)
|
if (event.getEntity() instanceof Player)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user