From fe21cf0a129ed824de22d8ef426422fce9d90c12 Mon Sep 17 00:00:00 2001 From: Brandon Date: Wed, 27 Sep 2023 08:22:42 -0300 Subject: Fix item cooldowns for items with no UUID (#508) Fixed ability cooldown not working for some items. #508 --- .../features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt index 96f9d729b..492da55c7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt @@ -22,6 +22,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.equalsOneOf import at.hannibal2.skyhanni.utils.LorenzUtils.round import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getAbilityScrolls +import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getItemId import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getItemUuid import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraft.client.Minecraft @@ -292,8 +293,8 @@ class ItemAbilityCooldown { val stack = event.stack val guiOpen = Minecraft.getMinecraft().currentScreen != null - val uuid = stack.getItemUuid() - val list = items.filter { it.key.getItemUuid() == uuid } + val uuid = stack.getItemUuid() ?: stack.getItemId() ?: return + val list = items.filter { (it.key.getItemUuid() ?: it.key.getItemId()) == uuid } .firstNotNullOfOrNull { it.value } ?: return for (itemText in list) { -- cgit