From 11760a688989ab9d597ac293985e189f57d7c7c3 Mon Sep 17 00:00:00 2001 From: ceikry Date: Wed, 14 Jul 2021 17:52:16 -0500 Subject: [PATCH] Added cooldown to ring --- .../kotlin/rs09/game/interaction/item/StarRingListener.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/StarRingListener.kt b/Server/src/main/kotlin/rs09/game/interaction/item/StarRingListener.kt index 4bf1e3d36..d59350e4f 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/StarRingListener.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/StarRingListener.kt @@ -11,6 +11,7 @@ import rs09.game.content.global.worldevents.WorldEvents import rs09.game.content.global.worldevents.shootingstar.ShootingStar import rs09.game.content.global.worldevents.shootingstar.ShootingStarEvent import rs09.game.interaction.InteractionListener +import java.util.concurrent.TimeUnit class StarRingListener : InteractionListener(){ @@ -22,6 +23,11 @@ class StarRingListener : InteractionListener(){ if(star == null) ContentAPI.sendDialogue(player, "There is currently no active star.").also { return@on true } + if(ContentAPI.getAttribute(player, "ring-next-tele", 0L) > System.currentTimeMillis()){ + ContentAPI.sendDialogue(player, "The ring is still recharging.") + return@on true + } + val condition: (Player) -> Boolean = when(star?.star!!.location.toLowerCase()){ "canifis bank" -> { p -> p.questRepository.isComplete("Priest in Peril")} "crafting guild" -> {p -> ContentAPI.hasLevelStat(p, Skills.CRAFTING, 40) } @@ -73,6 +79,7 @@ class StarRingListener : InteractionListener(){ fun teleport(player: Player, star: ShootingStar){ ContentAPI.teleport(player, star.crash_locations[star.location]!!.transform(0, -1, 0), TeleportManager.TeleportType.MINIGAME) + ContentAPI.setAttribute(player, "/save:ring-next-tele", System.currentTimeMillis() + TimeUnit.DAYS.toMillis(1)) } } } \ No newline at end of file