From e51dd4e7c0f94a47a74a8ec4fb6a1ef6d50099dd Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 30 Jun 2024 12:35:34 +0200 Subject: code cleanup --- .../skyhanni/features/inventory/HideNotClickableItems.kt | 9 +++++---- src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt index 3fad28589..c2e8801ba 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt @@ -26,6 +26,7 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull import at.hannibal2.skyhanni.utils.ItemUtils.getItemCategoryOrNull import at.hannibal2.skyhanni.utils.ItemUtils.getLore +import at.hannibal2.skyhanni.utils.ItemUtils.isCoopSoulBound import at.hannibal2.skyhanni.utils.ItemUtils.isEnchanted import at.hannibal2.skyhanni.utils.ItemUtils.isVanilla import at.hannibal2.skyhanni.utils.KeyboardManager @@ -68,7 +69,7 @@ object HideNotClickableItems { private val seedsPattern by RepoPattern.pattern( "inventory.hidenotclickable.seeds", - "SEEDS|CARROT_ITEM|POTATO_ITEM|PUMPKIN_SEEDS|SUGAR_CANE|MELON_SEEDS|CACTUS|INK_SACK-3" + "SEEDS|CARROT_ITEM|POTATO_ITEM|PUMPKIN_SEEDS|SUGAR_CANE|MELON_SEEDS|CACTUS|INK_SACK-3", ) private val netherWart by lazy { "NETHER_STALK".asInternalName() } @@ -304,7 +305,7 @@ object HideNotClickableItems { "CLOAK", "BELT", "GLOVES", - "BRACELET" + "BRACELET", ) for (type in list) { if (stack.getLore().any { it.contains("§l") && it.contains(type) }) {// todo use item api @@ -445,7 +446,7 @@ object HideNotClickableItems { private fun hidePlayerTrade(chestName: String, stack: ItemStack): Boolean { if (!chestName.startsWith("You ")) return false - if (ItemUtils.isCoopSoulBound(stack)) { + if (stack.isCoopSoulBound()) { hideReason = "Soulbound items cannot be traded!" return true } @@ -582,7 +583,7 @@ object HideNotClickableItems { } private fun isNotAuctionable(stack: ItemStack): Boolean { - if (ItemUtils.isCoopSoulBound(stack)) { + if (stack.isCoopSoulBound()) { hideReason = "Soulbound items cannot be auctioned!" return true } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt index 54cdfa91e..1fb4c4554 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt @@ -44,8 +44,8 @@ object ItemUtils { } // TODO change else janni is sad - fun isCoopSoulBound(stack: ItemStack): Boolean = - stack.getLore().any { + fun ItemStack.isCoopSoulBound(): Boolean = + getLore().any { it == "§8§l* §8Co-op Soulbound §8§l*" || it == "§8§l* §8Soulbound §8§l*" } -- cgit