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 c03ef11d22
commit 7f608a5374

View File

@ -13,7 +13,8 @@ public class OnPlayerTickEventHandler {
if (protectedPlayer == null) { if (protectedPlayer == null) {
return; 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()); ProtectedPlayerManager.updateState(protectedPlayer.getPlayerUUID());
} }
} }