Fixed mobs not ignoring player when config option is enabled.

This commit is contained in:
Michal Niczejewski
2023-04-21 21:03:54 +01:00
parent 46815587f5
commit 9bd396175e

View File

@ -3,7 +3,6 @@ package dev.micle.loginprotection.events.common;
import dev.micle.loginprotection.data.ProtectedPlayer;
import dev.micle.loginprotection.data.ProtectedPlayerManager;
import dev.micle.loginprotection.setup.Config;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.event.entity.living.LivingChangeTargetEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
@ -25,7 +24,7 @@ public class OnLivingSetAttackTargetEventHandler {
(player.getState().equals(ProtectedPlayer.State.AFK) && Config.Server.AFK_MOBS_IGNORE_PLAYER.get()) ||
(player.getState().equals(ProtectedPlayer.State.LOGIN_GRACE) && Config.Server.LOGIN_GRACE_MOBS_IGNORE_PLAYER.get()) ||
(player.getState().equals(ProtectedPlayer.State.AFK_GRACE) && Config.Server.AFK_GRACE_MOBS_IGNORE_PLAYER.get())) {
((Mob) event.getEntity()).setTarget(null);
event.setNewTarget(null);
}
}