aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorErymanthus[#5074] | (u/)RayDeeUx <51521765+RayDeeUx@users.noreply.github.com>2023-09-28 03:07:33 -0400
committerGitHub <noreply@github.com>2023-09-28 09:07:33 +0200
commit6a187104e5f88f61069c2c034fa8a1d2375e336e (patch)
treec6973e7d8134006f63908c968be8eb5003a3336d /src/main
parent993fe26c68aeaf39e4a7187df44231ebe48214da (diff)
downloadskyhanni-6a187104e5f88f61069c2c034fa8a1d2375e336e.tar.gz
skyhanni-6a187104e5f88f61069c2c034fa8a1d2375e336e.tar.bz2
skyhanni-6a187104e5f88f61069c2c034fa8a1d2375e336e.zip
Bugfix: Revise isSack() to rely on internal name instead (#510)
Fixed Bazaar Item category "Ink Sack" gets wrongly detected as an item sack. #510
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt4
4 files changed, 7 insertions, 7 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 203bfe9c9..49f1d4bfa 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt
@@ -337,7 +337,7 @@ class HideNotClickableItems {
val name = stack.cleanName()
reverseColor = true
- if (ItemUtils.isSack(name)) return false
+ if (ItemUtils.isSack(stack)) return false
hideReason = "This item is not a sack!"
@@ -370,7 +370,7 @@ class HideNotClickableItems {
val name = stack.cleanName()
- if (ItemUtils.isSack(name)) {
+ if (ItemUtils.isSack(stack)) {
hideReason = "Sacks cannot be traded!"
return true
}
@@ -497,7 +497,7 @@ class HideNotClickableItems {
val name = stack.cleanName()
- if (ItemUtils.isSack(name)) {
+ if (ItemUtils.isSack(stack)) {
hideReason = "Sacks cannot be auctioned!"
return true
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt
index 37a44f6ed..44e5cf46f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt
@@ -90,7 +90,7 @@ class ItemDisplayOverlayFeatures {
}
if (SkyHanniMod.feature.inventory.displaySackName) {
- if (ItemUtils.isSack(itemName)) {
+ if (ItemUtils.isSack(item)) {
val sackName = grabSackName(itemName)
return (if (itemName.contains("Enchanted")) "ยง5" else "") + sackName.substring(0, 2)
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt
index 58b7924b1..7e34aa009 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt
@@ -35,7 +35,7 @@ class PocketSackInASackDisplay {
val itemStack = event.itemStack
val applied = itemStack.getAppliedPocketSackInASack() ?: return
- if (!ItemUtils.isSack(itemStack.displayName)) return
+ if (!ItemUtils.isSack(itemStack)) return
val iterator = event.toolTip.listIterator()
var next = false
for (line in iterator) {
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
index 4fd35a330..ee753e17d 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
@@ -21,8 +21,8 @@ object ItemUtils {
fun ItemStack.cleanName() = this.displayName.removeColor()
- fun isSack(name: String): Boolean =
- name.endsWith(" Sack")//TODO use item id or api or something? or dont, its working fine now
+ fun isSack(stack: ItemStack): Boolean =
+ stack?.getInternalName()?.endsWith("_SACK") ?: false
fun ItemStack.getLore(): List<String> {
val tagCompound = this.tagCompound ?: return emptyList()