diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-12-17 18:30:31 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-12-17 18:30:31 +0100 |
commit | 3b98ddabeda1e78f63442fb5709b68ce7a1223e7 (patch) | |
tree | b1e977c46ac8890fab8fc8b2d5f3d7572958c5db /src/main/java/at/hannibal2/skyhanni/features | |
parent | d577665018ab1a8a908f81fa0b3ef93c17bf5afa (diff) | |
download | skyhanni-3b98ddabeda1e78f63442fb5709b68ce7a1223e7.tar.gz skyhanni-3b98ddabeda1e78f63442fb5709b68ce7a1223e7.tar.bz2 skyhanni-3b98ddabeda1e78f63442fb5709b68ce7a1223e7.zip |
Added Copy Underbid Price
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/items/AuctionHouseCopyUnderbidPrice.kt | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/AuctionHouseCopyUnderbidPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/AuctionHouseCopyUnderbidPrice.kt new file mode 100644 index 000000000..0f2a45659 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/AuctionHouseCopyUnderbidPrice.kt @@ -0,0 +1,33 @@ +package at.hannibal2.skyhanni.features.misc.items + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.InventoryUpdatedEvent +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.NEUInternalName +import at.hannibal2.skyhanni.utils.NEUItems.getPrice +import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators +import at.hannibal2.skyhanni.utils.OSUtils +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class AuctionHouseCopyUnderbidPrice { + private val config get() = SkyHanniMod.feature.inventory + + @SubscribeEvent + fun onInventoryUpdated(event: InventoryUpdatedEvent) { + if (!isEnabled()) return + if (!event.fullyOpenedOnce) return + if (event.inventoryName != "Create BIN Auction") return + val item = event.inventoryItems[13] ?: return + + val internalName = item.getInternalName() + if (internalName == NEUInternalName.NONE) return + + val price = internalName.getPrice().toLong() - 1 + if (price <= 0) return + OSUtils.copyToClipboard("$price") + LorenzUtils.chat("Set §e${price.addSeparators()} §eto clipboard. (Copy Underbid Price)") + } + + fun isEnabled() = LorenzUtils.inSkyBlock && config.copyUnderbidPrice +} |