From f34defd6c42f762ce8eaf753998139e8b2714b0e Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Wed, 27 Sep 2023 13:23:25 +0200 Subject: code cleanup --- .../features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 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 492da55c7..b56661cd0 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 @@ -293,9 +293,9 @@ class ItemAbilityCooldown { val stack = event.stack val guiOpen = Minecraft.getMinecraft().currentScreen != null - val uuid = stack.getItemUuid() ?: stack.getItemId() ?: return - val list = items.filter { (it.key.getItemUuid() ?: it.key.getItemId()) == uuid } - .firstNotNullOfOrNull { it.value } ?: return + val uuid = stack.getIdentifier() ?: return + val list = items.filter { (it.key.getIdentifier()) == uuid } + .firstNotNullOfOrNull { it.value } ?: return for (itemText in list) { if (guiOpen && !itemText.onCooldown) continue @@ -318,6 +318,8 @@ class ItemAbilityCooldown { } } + private fun ItemStack.getIdentifier() = getItemUuid() ?: getItemId() + @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { if (!isEnabled()) return -- cgit