From ac5c31747fe8ec9a2eae7c8c4e66ae5b14b638a4 Mon Sep 17 00:00:00 2001 From: Zerken Date: Sun, 10 Sep 2023 14:43:56 +0000 Subject: [PATCH] The AntiMacro timer now properly pauses for Administrators Modified the ::revent command to unpause the AntiMacro timer for admins and display a chat message --- .../src/main/core/game/system/timer/impl/AntiMacro.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Server/src/main/core/game/system/timer/impl/AntiMacro.kt b/Server/src/main/core/game/system/timer/impl/AntiMacro.kt index f6cd3b280..4f9ba872a 100644 --- a/Server/src/main/core/game/system/timer/impl/AntiMacro.kt +++ b/Server/src/main/core/game/system/timer/impl/AntiMacro.kt @@ -12,6 +12,7 @@ import core.game.system.timer.PersistTimer import core.game.world.map.zone.ZoneRestriction import core.game.world.repository.Repository import core.tools.RandomFunction +import core.tools.colorize import org.json.simple.JSONObject class AntiMacro : PersistTimer(0, "antimacro", isAuto = true), Commands { @@ -40,9 +41,8 @@ class AntiMacro : PersistTimer(0, "antimacro", isAuto = true), Commands { override fun onRegister(entity: Entity) { if (entity !is Player || entity.isArtificial) entity.timers.removeTimer(this) - if (entity is Player && entity.rights == Rights.ADMINISTRATOR) { - pause(entity) - } + if (entity is Player && entity.rights == Rights.ADMINISTRATOR) + paused = true if (runInterval == 0) setNextExecution() @@ -106,6 +106,10 @@ class AntiMacro : PersistTimer(0, "antimacro", isAuto = true), Commands { val target = Repository.getPlayerByName(arg.targetPlayer) if (target == null) reject(player, "Unable to find user ${arg.targetPlayer}.") + if (target!!.rights == Rights.ADMINISTRATOR) { + unpause(target) + sendMessage(target, colorize("%RAntiMacro timer unpaused until next login.")) + } forceEvent(target!!, arg.targetEvent) }