diff options
author | J10a1n15 <45315647+j10a1n15@users.noreply.github.com> | 2024-05-16 11:02:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-16 11:02:39 +0200 |
commit | d4f7a7753d7ba772add76b43bcf2f692d10f25ad (patch) | |
tree | e08b5cd78bf34effeb4e5c407e655a26d7fe4740 /src/main/java/at/hannibal2/skyhanni/data | |
parent | 8c87a65a2f1674599bd33522c56339aa04df8440 (diff) | |
download | skyhanni-d4f7a7753d7ba772add76b43bcf2f692d10f25ad.tar.gz skyhanni-d4f7a7753d7ba772add76b43bcf2f692d10f25ad.tar.bz2 skyhanni-d4f7a7753d7ba772add76b43bcf2f692d10f25ad.zip |
Improvement: Arrow count in Custom Scoreboard when wearing Skeleton Masters Chestplate (#1795)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/QuiverAPI.kt | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/QuiverAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/QuiverAPI.kt index af921f22b..b13538c9b 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/QuiverAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/QuiverAPI.kt @@ -52,7 +52,8 @@ object QuiverAPI { private var arrows: List<ArrowType> = listOf() - private var wearingSkeletonMasterChestplate = false + var wearingSkeletonMasterChestplate = false + private set private var hasBow = false const val MAX_ARROW_AMOUNT = 2880 @@ -107,7 +108,7 @@ object QuiverAPI { "Unknown arrow type: $type", "message" to message, ) - QuiverUpdateEvent(currentArrow, currentAmount, shouldHideAmount()).postAndCatch() + postUpdateEvent() return } @@ -120,7 +121,7 @@ object QuiverAPI { "message" to message, ) arrowAmount[ranOutType.internalName] = 0 - QuiverUpdateEvent(ranOutType, currentAmount, shouldHideAmount()).postAndCatch() + postUpdateEvent(ranOutType) } fillUpJaxPattern.matchMatcher(message) { @@ -135,7 +136,7 @@ object QuiverAPI { arrowAmount.addOrPut(filledUpType.internalName, amount) if (filledUpType == currentArrow) { - QuiverUpdateEvent(filledUpType, currentAmount, shouldHideAmount()).postAndCatch() + postUpdateEvent() } return @@ -147,7 +148,7 @@ object QuiverAPI { FLINT_ARROW_TYPE?.let { arrowAmount.addOrPut(it.internalName, flintAmount) } if (currentArrow == FLINT_ARROW_TYPE) { - QuiverUpdateEvent(currentArrow, currentAmount, shouldHideAmount()).postAndCatch() + postUpdateEvent() } return } @@ -165,7 +166,7 @@ object QuiverAPI { arrowAmount.addOrPut(filledUpType.internalName, amount) if (filledUpType == currentArrow) { - QuiverUpdateEvent(currentArrow, currentAmount, shouldHideAmount()).postAndCatch() + postUpdateEvent() } return } @@ -174,7 +175,7 @@ object QuiverAPI { currentAmount = 0 arrowAmount.clear() - QuiverUpdateEvent(currentArrow, currentAmount, shouldHideAmount()).postAndCatch() + postUpdateEvent() return } @@ -182,7 +183,7 @@ object QuiverAPI { currentArrow = NONE_ARROW_TYPE currentAmount = 0 - QuiverUpdateEvent(currentArrow, currentAmount, shouldHideAmount()).postAndCatch() + postUpdateEvent() return } } @@ -224,7 +225,7 @@ object QuiverAPI { if (currentArrowType != currentArrow || amount != currentAmount) { currentArrow = currentArrowType currentAmount = amount - QuiverUpdateEvent(currentArrowType, amount, shouldHideAmount()).postAndCatch() + postUpdateEvent() } } } @@ -253,8 +254,6 @@ object QuiverAPI { fun isEnabled() = LorenzUtils.inSkyBlock && storage != null - private fun shouldHideAmount() = wearingSkeletonMasterChestplate - private fun checkBowInventory() { hasBow = InventoryUtils.getItemsInOwnInventory().any { it.item is ItemBow && !fakeBowsPattern.matches(it.getInternalName().asString()) @@ -266,10 +265,14 @@ object QuiverAPI { wearingSkeletonMasterChestplate = InventoryUtils.getChestplate()?.getInternalName() == SKELETON_MASTER_CHESTPLATE if (wasWearing != wearingSkeletonMasterChestplate) { - QuiverUpdateEvent(currentArrow, currentAmount, shouldHideAmount()).postAndCatch() + postUpdateEvent() } } + private fun postUpdateEvent(arrowType: ArrowType? = currentArrow) { + QuiverUpdateEvent(arrowType, currentAmount, wearingSkeletonMasterChestplate).postAndCatch() + } + @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!isEnabled()) return |