diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-05-04 23:48:35 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-05-04 23:48:35 +0200 |
commit | d4601b3221833e964bffdd508ebf69109e3480df (patch) | |
tree | abbe76f96f08cda9571affaaba1236196c018214 /src/main/java/at/hannibal2/skyhanni/features/misc | |
parent | 28a3c9d9d2ff9291f3e35d13804fc715b0b688c5 (diff) | |
download | skyhanni-d4601b3221833e964bffdd508ebf69109e3480df.tar.gz skyhanni-d4601b3221833e964bffdd508ebf69109e3480df.tar.bz2 skyhanni-d4601b3221833e964bffdd508ebf69109e3480df.zip |
Fixed /shtrackcollection
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt index 6d8003f7c..69dd4ef87 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.api.CollectionAPI import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName +import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.RenderUtils.renderString @@ -21,7 +22,7 @@ class CollectionCounter { private var display = "" private var itemName = "" - private var itemApiName = "" + private var internalName = "" private var itemAmount = -1L private var lastAmountInInventory = -1 @@ -31,7 +32,7 @@ class CollectionCounter { fun command(args: Array<String>) { if (args.isEmpty()) { - if (itemName == "") { + if (internalName == "") { LorenzUtils.chat("§c/shtrackcollection <item name>") return } @@ -43,18 +44,17 @@ class CollectionCounter { val name = args.joinToString(" ") val pair = CollectionAPI.getCollectionCounter(name) if (pair == null) { - LorenzUtils.chat("§c[SkyHanni] Item $name is not in the collection data! (API disabled or open the collection inventory)") + LorenzUtils.chat("§c[SkyHanni] Item $name is not in the collection data! (Maybe the API is disabled or try to open the collection inventory)") return } - itemName = pair.first - itemApiName = if (itemName == "Mushroom" || itemName == "Gemstone") { + internalName = pair.first + if (internalName.contains("MUSHROOM") || internalName.endsWith("_GEM")) { LorenzUtils.chat("§7Mushroom and Gemstone items are not fully supported for the counter!") - "" - } else { - NEUItems.getInternalName(itemName) + internalName = "" + return } - + itemName = NEUItems.getItemStack(internalName).name!! itemAmount = pair.second lastAmountInInventory = countCurrentlyInInventory() @@ -64,8 +64,7 @@ class CollectionCounter { private fun resetData() { itemAmount = -1 - itemName = "" - itemApiName = "" + internalName = "" lastAmountInInventory = -1 display = "" @@ -85,7 +84,7 @@ class CollectionCounter { } private fun countCurrentlyInInventory() = - InventoryUtils.countItemsInLowerInventory { it.getInternalName() == itemApiName } + InventoryUtils.countItemsInLowerInventory { it.getInternalName() == internalName } } @SubscribeEvent |