Additionally, checking if player is active and afk protection is enabled before setting player as afk.

This commit is contained in:
2022-05-24 02:19:35 +01:00
parent 1a10094c9f
commit ceff99c81c

View File

@ -13,7 +13,8 @@ public class OnPlayerTickEventHandler {
if (protectedPlayer == null) {
return;
}
if (event.player.tickCount - protectedPlayer.getLastInputTick() >= Config.Server.AFK_TIME_THRESHOLD.get() * 20) {
if (protectedPlayer.getState().equals(ProtectedPlayer.State.ACTIVE) && Config.Server.AFK_PROTECTION_ENABLED.get() &&
event.player.tickCount - protectedPlayer.getLastInputTick() >= Config.Server.AFK_TIME_THRESHOLD.get() * 20) {
ProtectedPlayerManager.updateState(protectedPlayer.getPlayerUUID());
}
}