aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-06-30 12:35:34 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-06-30 12:35:34 +0200
commite51dd4e7c0f94a47a74a8ec4fb6a1ef6d50099dd (patch)
tree1a95ee49b3f509c9bc0053ea6c8cfce2c6e2d386
parent8bcdd9b6de9f7fc53cfed31ab84187092ea4dc6e (diff)
downloadskyhanni-e51dd4e7c0f94a47a74a8ec4fb6a1ef6d50099dd.tar.gz
skyhanni-e51dd4e7c0f94a47a74a8ec4fb6a1ef6d50099dd.tar.bz2
skyhanni-e51dd4e7c0f94a47a74a8ec4fb6a1ef6d50099dd.zip
code cleanup
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt4
2 files changed, 7 insertions, 6 deletions
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*"
}