mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-25 02:27:33 +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)
|
@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);
|
{
|
||||||
event.setCancelled(true);
|
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)
|
@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