From 9ac0494d86bc8a65b5075e749153e0cc6fa54ad2 Mon Sep 17 00:00:00 2001 From: Brandon Date: Thu, 7 Sep 2023 08:46:26 -0300 Subject: Fix minion pickup not removing the nametag (#443) Fix minion pickup not removing the nametag #443 --- .../hannibal2/skyhanni/features/minion/MinionFeatures.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt index c06235daf..d876f2bb3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt @@ -38,7 +38,6 @@ class MinionFeatures { private var minionInventoryOpen = false private var lastInventoryClosed = 0L - private var lastMinionPickedUp = 0L private var coinsPerDay = "" private val minionUpgradePattern = "§aYou have upgraded your Minion to Tier (?.*)".toPattern() @@ -123,7 +122,7 @@ class MinionFeatures { @SubscribeEvent fun onInventoryClose(event: InventoryCloseEvent) { if (!minionInventoryOpen) return - var minions = minions ?: return + val minions = minions ?: return minionInventoryOpen = false lastMinionOpened = System.currentTimeMillis() @@ -135,10 +134,6 @@ class MinionFeatures { if (location !in minions) { minions[location]!!.lastClicked = 0 } - - if (System.currentTimeMillis() - lastMinionPickedUp < 2_000) { - MinionFeatures.minions = minions.editCopy { remove(location) } - } } @SubscribeEvent @@ -210,7 +205,12 @@ class MinionFeatures { } if (message.startsWith("§aYou picked up a minion!")) { - lastMinionPickedUp = System.currentTimeMillis() + if (lastMinion != null) { + minions = minions?.editCopy { remove(lastMinion) } + lastClickedEntity = null + lastMinion = null + lastMinionOpened = 0L + } } minionUpgradePattern.matchMatcher(message) { -- cgit