diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-27 13:23:25 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-27 13:23:25 +0200 |
commit | f34defd6c42f762ce8eaf753998139e8b2714b0e (patch) | |
tree | 54e7dd77b043b98a7b996ee4fc4cbdf7fe90fc8d | |
parent | fe21cf0a129ed824de22d8ef426422fce9d90c12 (diff) | |
download | skyhanni-f34defd6c42f762ce8eaf753998139e8b2714b0e.tar.gz skyhanni-f34defd6c42f762ce8eaf753998139e8b2714b0e.tar.bz2 skyhanni-f34defd6c42f762ce8eaf753998139e8b2714b0e.zip |
code cleanup
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt | 8 |
1 files changed, 5 insertions, 3 deletions
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 |