From 08dfadd7f9ba4c4597655795a2f835367d649f20 Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Tue, 10 Dec 2024 13:35:44 +1100 Subject: [PATCH 01/21] Backend: Migrate more stuff to work on 1.12 (#2962) --- .../data/jsonobjects/repo/neu/NeuReforgeJson.kt | 5 ++--- .../java/at/hannibal2/skyhanni/data/mob/Mob.kt | 4 ++-- .../skyhanni/events/GuiContainerEvent.kt | 6 ++---- .../skyhanni/features/bingo/MinionCraftHelper.kt | 16 +++++++--------- .../skyhanni/features/inventory/HarpFeatures.kt | 16 ++-------------- .../skyhanni/features/inventory/SnakeGame.kt | 9 ++------- .../chocolatefactory/ChocolateFactoryKeybinds.kt | 10 ++-------- .../features/misc/discordrpc/DiscordStatus.kt | 15 ++++----------- .../skyhanni/test/command/TestChatCommand.kt | 2 +- .../at/hannibal2/skyhanni/utils/BlockUtils.kt | 2 +- .../hannibal2/skyhanni/utils/InventoryUtils.kt | 13 ++++++++++--- .../at/hannibal2/skyhanni/utils/LocationUtils.kt | 4 ++-- .../at/hannibal2/skyhanni/utils/LorenzUtils.kt | 8 +------- 13 files changed, 38 insertions(+), 72 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/neu/NeuReforgeJson.kt b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/neu/NeuReforgeJson.kt index b327d9a29a35..c56098d553a6 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/neu/NeuReforgeJson.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/neu/NeuReforgeJson.kt @@ -44,8 +44,7 @@ data class NeuReforgeJson( val itemType: Pair> get() = if (this::itemTypeField.isInitialized) itemTypeField else run { - val any = this.rawItemTypes - return when (any) { + return when (val any = this.rawItemTypes) { is String -> { any.replace("/", "_AND_").uppercase() to emptyList() } @@ -55,7 +54,7 @@ data class NeuReforgeJson( val map = any as? Map> ?: return type to emptyList() val internalNames = map["internalName"]?.map { it.toInternalName() }.orEmpty() val itemType = map["itemid"]?.map { - NEUItems.getInternalNamesForItemId(Item.getByNameOrId(it)) + NEUItems.getInternalNamesForItemId(Item.getByNameOrId(it) ?: return@map emptyList()) }?.flatten().orEmpty() type to (internalNames + itemType) } diff --git a/src/main/java/at/hannibal2/skyhanni/data/mob/Mob.kt b/src/main/java/at/hannibal2/skyhanni/data/mob/Mob.kt index 8f25d0521a65..ffd67e06767e 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/mob/Mob.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/mob/Mob.kt @@ -12,7 +12,7 @@ import at.hannibal2.skyhanni.utils.EntityUtils.cleanName import at.hannibal2.skyhanni.utils.EntityUtils.isCorrupted import at.hannibal2.skyhanni.utils.EntityUtils.isRunic import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer -import at.hannibal2.skyhanni.utils.LocationUtils.getCenter +import at.hannibal2.skyhanni.utils.LocationUtils.getBoxCenter import at.hannibal2.skyhanni.utils.LocationUtils.union import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth import at.hannibal2.skyhanni.utils.MobUtils @@ -233,7 +233,7 @@ class Mob( internalHighlight() } - val centerCords get() = boundingBox.getCenter() + val centerCords get() = boundingBox.getBoxCenter() override fun hashCode() = id.hashCode() diff --git a/src/main/java/at/hannibal2/skyhanni/events/GuiContainerEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/GuiContainerEvent.kt index 34bc2a2a5d13..14d90a6e9c67 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/GuiContainerEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/GuiContainerEvent.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.events import at.hannibal2.skyhanni.utils.GuiRenderUtils -import net.minecraft.client.Minecraft +import at.hannibal2.skyhanni.utils.InventoryUtils import net.minecraft.client.gui.inventory.GuiContainer import net.minecraft.inventory.Container import net.minecraft.inventory.Slot @@ -85,9 +85,7 @@ abstract class GuiContainerEvent(open val gui: GuiContainer, open val container: fun makePickblock() { if (this.clickedButton == 2 && this.clickTypeEnum == ClickType.MIDDLE) return slot?.slotNumber?.let { slotNumber -> - Minecraft.getMinecraft().playerController.windowClick( - container.windowId, slotNumber, 2, 3, Minecraft.getMinecraft().thePlayer, - ) + InventoryUtils.clickSlot(slotNumber, container.windowId, 2, 3) isCanceled = true } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt index 784c48ac8c61..ae7d98e5569b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt @@ -8,6 +8,7 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut +import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.hasEnchantments import at.hannibal2.skyhanni.utils.ItemUtils.itemName @@ -26,7 +27,6 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import com.google.gson.JsonArray import com.google.gson.JsonObject -import net.minecraft.client.Minecraft import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds @@ -59,13 +59,13 @@ object MinionCraftHelper { if (!LorenzUtils.isBingoProfile) return if (!config.minionCraftHelperEnabled) return + val mainInventory = InventoryUtils.getItemsInOwnInventory() + if (event.isMod(10)) { - val mainInventory = Minecraft.getMinecraft()?.thePlayer?.inventory?.mainInventory ?: return - hasMinionInInventory = mainInventory.mapNotNull { it?.name }.any { isMinionName(it) } + hasMinionInInventory = mainInventory.map { it.name }.any { isMinionName(it) } } if (event.repeatSeconds(2)) { - val mainInventory = Minecraft.getMinecraft()?.thePlayer?.inventory?.mainInventory ?: return hasItemsForMinion = loadFromInventory(mainInventory).first.isNotEmpty() } @@ -76,8 +76,6 @@ object MinionCraftHelper { if (!event.isMod(3)) return - val mainInventory = Minecraft.getMinecraft()?.thePlayer?.inventory?.mainInventory ?: return - val (minions, otherItems) = loadFromInventory(mainInventory) display = drawDisplay(minions, otherItems) @@ -98,7 +96,7 @@ object MinionCraftHelper { return newDisplay } - private fun loadFromInventory(mainInventory: Array): + private fun loadFromInventory(mainInventory: List): Pair, MutableMap> { init() @@ -106,7 +104,7 @@ object MinionCraftHelper { val otherItems = mutableMapOf() for (item in mainInventory) { - val name = item?.name?.removeColor() ?: continue + val name = item.name.removeColor() val rawId = item.getInternalName() if (isMinionName(name)) { minions[name] = rawId @@ -116,7 +114,7 @@ object MinionCraftHelper { val allMinions = tierOneMinions.toMutableList() minions.values.mapTo(allMinions) { it.addOneToId() } - for (item in mainInventory.filterNotNull()) { + for (item in mainInventory) { val name = item.name.removeColor() val rawId = item.getInternalName() diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt index 532267f11528..f47a08bde047 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt @@ -76,13 +76,7 @@ object HarpFeatures { event.cancel() - Minecraft.getMinecraft().playerController.windowClick( - chest.inventorySlots.windowId, - 37 + index, - 2, - 3, - Minecraft.getMinecraft().thePlayer, - ) // middle clicks > left clicks + InventoryUtils.clickSlot(37 + index, chest.inventorySlots.windowId, 2, 3) lastClick = SimpleTimeMark.now() break } @@ -179,13 +173,7 @@ object HarpFeatures { songSelectedPattern.anyMatches(it.getLore()) }.takeIf { it != -1 }?.let { event.cancel() - Minecraft.getMinecraft().playerController.windowClick( - event.container.windowId, - it, - event.clickedButton, - event.clickType, - Minecraft.getMinecraft().thePlayer, - ) + InventoryUtils.clickSlot(it, event.container.windowId, event.clickedButton, event.clickType) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/SnakeGame.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/SnakeGame.kt index 31a9d8a52388..7a708d67d9de 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/SnakeGame.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/SnakeGame.kt @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.events.GuiKeyPressEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryOpenEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule +import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RegexUtils.matches @@ -48,13 +49,7 @@ object SnakeGame { if (key?.isKeyHeld() == false) continue event.cancel() - Minecraft.getMinecraft().playerController.windowClick( - chest.inventorySlots.windowId, - slot, - 2, - 3, - Minecraft.getMinecraft().thePlayer, - ) + InventoryUtils.clickSlot(slot, chest.inventorySlots.windowId, 2, 3) lastClick = SimpleTimeMark.now() break diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryKeybinds.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryKeybinds.kt index 330d941f03ee..50d548763ec1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryKeybinds.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryKeybinds.kt @@ -4,10 +4,10 @@ import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.GuiKeyPressEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule +import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyClicked import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.SimpleTimeMark -import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.milliseconds @@ -33,13 +33,7 @@ object ChocolateFactoryKeybinds { event.cancel() - Minecraft.getMinecraft().playerController.windowClick( - chest.inventorySlots.windowId, - 28 + index, - 2, - 3, - Minecraft.getMinecraft().thePlayer - ) + InventoryUtils.clickSlot(28 + index, chest.inventorySlots.windowId, 2, 3) break } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt index c0a261d82e83..fc9a0a4ab3bf 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt @@ -17,6 +17,7 @@ import at.hannibal2.skyhanni.features.garden.GardenAPI.getCropType import at.hannibal2.skyhanni.features.misc.compacttablist.AdvancedPlayerList import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.utils.InventoryUtils +import at.hannibal2.skyhanni.utils.ItemUtils.extraAttributes import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.colorCodeToRarity import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators @@ -28,8 +29,6 @@ import at.hannibal2.skyhanni.utils.TabListData import at.hannibal2.skyhanni.utils.TimeUtils.format import at.hannibal2.skyhanni.utils.TimeUtils.formatted import io.github.moulberry.notenoughupdates.miscfeatures.PetInfoOverlay.getCurrentPet -import net.minecraft.item.ItemStack -import net.minecraft.nbt.NBTTagCompound import java.util.regex.Pattern import kotlin.time.Duration.Companion.minutes @@ -259,19 +258,11 @@ enum class DiscordStatus(private val displayMessageSupplier: (() -> String?)) { // Dynamic-only STACKING({ - // Logic for getting the currently held stacking enchant is from Skytils, except for getExtraAttributes() which they got from BiscuitDevelopment - - fun getExtraAttributes(item: ItemStack?): NBTTagCompound? { - return if (item == null || !item.hasTagCompound()) { - null - } else item.getSubCompound("ExtraAttributes", false) - } + // Logic for getting the currently held stacking enchant is from Skytils val itemInHand = InventoryUtils.getItemInHand() val itemName = itemInHand?.displayName?.removeColor().orEmpty() - val extraAttributes = getExtraAttributes(itemInHand) - fun getProgressPercent(amount: Int, levels: List): String { var percent = "MAXED" for (level in levels.indices) { @@ -288,6 +279,8 @@ enum class DiscordStatus(private val displayMessageSupplier: (() -> String?)) { return percent } + val extraAttributes = itemInHand?.extraAttributes + var stackingReturn = AutoStatus.STACKING.placeholderText if (extraAttributes != null) { val enchantments = extraAttributes.getCompoundTag("enchantments") diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/TestChatCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/TestChatCommand.kt index f8e7739ded3a..8c37ff1d7bfa 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/TestChatCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/TestChatCommand.kt @@ -47,7 +47,7 @@ object TestChatCommand { private fun extracted(isComplex: Boolean, text: String, isSilent: Boolean, isSilentAll: Boolean) { val component = if (isComplex) try { - IChatComponent.Serializer.jsonToComponent(text) + IChatComponent.Serializer.jsonToComponent(text) ?: ChatComponentText("") } catch (ex: Exception) { ChatUtils.userError("Please provide a valid JSON chat component (either in the command or via -clipboard)") return diff --git a/src/main/java/at/hannibal2/skyhanni/utils/BlockUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/BlockUtils.kt index f0598863ce95..966008374dc8 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/BlockUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/BlockUtils.kt @@ -15,7 +15,7 @@ object BlockUtils { fun LorenzVec.getBlockStateAt(): IBlockState = world.getBlockState(toBlockPos()) - fun LorenzVec.isInLoadedChunk(): Boolean = world.chunkProvider.provideChunk(toBlockPos()).isLoaded + fun LorenzVec.isInLoadedChunk(): Boolean = world.isBlockLoaded(toBlockPos(), false) fun getTextureFromSkull(position: LorenzVec?): String? { val entity = world.getTileEntity(position?.toBlockPos()) as? TileEntitySkull ?: return null diff --git a/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt index e766be699c29..698555c0aab8 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt @@ -16,6 +16,9 @@ import net.minecraft.inventory.IInventory import net.minecraft.inventory.Slot import net.minecraft.item.ItemStack import kotlin.time.Duration.Companion.seconds +//#if MC > 1.12 +//$$ import net.minecraft.inventory.ClickType +//#endif object InventoryUtils { @@ -134,10 +137,14 @@ object InventoryUtils { fun NEUInternalName.getAmountInInventory(): Int = countItemsInLowerInventory { it.getInternalNameOrNull() == this } - fun clickSlot(slot: Int) { - val windowId = getWindowId() ?: return + fun clickSlot(slot: Int, windowId: Int? = getWindowId(), mouseButton: Int = 0, mode: Int = 0) { + windowId ?: return val controller = Minecraft.getMinecraft().playerController - controller.windowClick(windowId, slot, 0, 0, Minecraft.getMinecraft().thePlayer) + //#if MC < 1.12 + controller.windowClick(windowId, slot, mouseButton, mode, Minecraft.getMinecraft().thePlayer) + //#else + //$$ controller.windowClick(windowId, slot, mouseButton, ClickType.entries[mode], Minecraft.getMinecraft().player) + //#endif } fun Slot.isTopInventory() = inventory.isTopInventory() diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt index 36c24e3415d8..53f97628ddae 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt @@ -97,9 +97,9 @@ object LocationUtils { fun AxisAlignedBB.getEdgeLengths() = maxBox() - minBox() - fun AxisAlignedBB.getCenter() = getEdgeLengths() * 0.5 + minBox() + fun AxisAlignedBB.getBoxCenter() = getEdgeLengths() * 0.5 + minBox() - fun AxisAlignedBB.getTopCenter() = getCenter().up((maxY - minY) / 2) + fun AxisAlignedBB.getTopCenter() = getBoxCenter().up((maxY - minY) / 2) fun AxisAlignedBB.clampTo(other: AxisAlignedBB): AxisAlignedBB { val minX = max(this.minX, other.minX) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index 8de1e8336fa5..b76f5dc8a35f 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -277,13 +277,7 @@ object LorenzUtils { fun GuiContainerEvent.SlotClickEvent.makeShiftClick() { if (this.clickedButton == 1 && slot?.stack?.getItemCategoryOrNull() == ItemCategory.SACK) return slot?.slotNumber?.let { slotNumber -> - Minecraft.getMinecraft().playerController.windowClick( - container.windowId, - slotNumber, - 0, - 1, - Minecraft.getMinecraft().thePlayer, - ) + InventoryUtils.clickSlot(slotNumber, container.windowId, 0, 1) this.cancel() } } From da530dafe8a3eea6547c004682953c13c2e646ec Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Wed, 11 Dec 2024 10:11:11 +1100 Subject: [PATCH 02/21] Backend: A few more things for making 1.12 work in skyhanni (#3043) --- .../java/at/hannibal2/skyhanni/data/ItemClickData.kt | 3 ++- .../features/inventory/wardrobe/CustomWardrobe.kt | 7 +++++-- .../java/at/hannibal2/skyhanni/test/PacketTest.kt | 3 ++- .../hannibal2/skyhanni/utils/HolographicEntities.kt | 3 ++- .../hannibal2/skyhanni/utils/compat/EntityCompat.kt | 12 ++++++++++-- .../hannibal2/skyhanni/utils/compat/PacketCompat.kt | 9 +++++++++ .../utils/json/ItemStackTypeAdapterFactory.kt | 4 ++++ versions/mapping-1.12.2-1.8.9.txt | 1 + versions/mapping-1.16.5-forge-1.12.2.txt | 1 + 9 files changed, 36 insertions(+), 7 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt index b6c6a38c0d29..1aa39836ced2 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt @@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.events.entity.EntityClickEvent import at.hannibal2.skyhanni.events.minecraft.packet.PacketSentEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.InventoryUtils +import at.hannibal2.skyhanni.utils.compat.getUsedItem import at.hannibal2.skyhanni.utils.toLorenzVec import net.minecraft.client.Minecraft import net.minecraft.network.play.client.C02PacketUseEntity @@ -24,7 +25,7 @@ object ItemClickData { packet is C08PacketPlayerBlockPlacement -> { if (packet.placedBlockDirection != 255) { val position = packet.position.toLorenzVec() - BlockClickEvent(ClickType.RIGHT_CLICK, position, packet.stack).post() + BlockClickEvent(ClickType.RIGHT_CLICK, position, packet.getUsedItem()).post() } else { ItemClickEvent(InventoryUtils.getItemInHand(), ClickType.RIGHT_CLICK).post() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/CustomWardrobe.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/CustomWardrobe.kt index eeaadc295214..3e90b17f35d0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/CustomWardrobe.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/CustomWardrobe.kt @@ -270,8 +270,11 @@ object CustomWardrobe { val fakePlayer = FakePlayer() var scale = playerWidth - fakePlayer.inventory.armorInventory = - slot.armor.map { it?.copy()?.removeEnchants() }.reversed().toTypedArray() + //#if MC < 1.12 + fakePlayer.inventory.armorInventory = slot.armor.map { it?.copy()?.removeEnchants() }.reversed().toTypedArray() + //#else + //$$ fakePlayer.inventory.armorInventory.addAll(slot.armor.map { it?.copy()?.removeEnchants() }.reversed()) + //#endif val playerColor = if (!slot.isInCurrentPage()) { scale *= 0.9 diff --git a/src/main/java/at/hannibal2/skyhanni/test/PacketTest.kt b/src/main/java/at/hannibal2/skyhanni/test/PacketTest.kt index a0ab34edee3a..3edd28a8bfed 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/PacketTest.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/PacketTest.kt @@ -11,6 +11,7 @@ import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.NumberUtil.isInt import at.hannibal2.skyhanni.utils.NumberUtil.roundTo import at.hannibal2.skyhanni.utils.ReflectionUtils.makeAccessible +import at.hannibal2.skyhanni.utils.compat.getLocation import at.hannibal2.skyhanni.utils.getLorenzVec import at.hannibal2.skyhanni.utils.toLorenzVec import net.minecraft.client.Minecraft @@ -201,7 +202,7 @@ object PacketTest { return LorenzVec(packet.x, packet.y, packet.z) } if (packet is C03PacketPlayer) { - return LorenzVec(packet.positionX, packet.positionY, packet.positionZ) + return packet.getLocation() } if (packet is S0FPacketSpawnMob) { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/HolographicEntities.kt b/src/main/java/at/hannibal2/skyhanni/utils/HolographicEntities.kt index 602ea0c4d451..a58bbcd3137e 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/HolographicEntities.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/HolographicEntities.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.utils import at.hannibal2.skyhanni.mixins.transformers.AccessorRendererLivingEntity import at.hannibal2.skyhanni.utils.RenderUtils.getViewerPos import at.hannibal2.skyhanni.utils.TimeUtils.inWholeTicks +import at.hannibal2.skyhanni.utils.compat.createWitherSkeleton import net.minecraft.client.Minecraft import net.minecraft.client.renderer.GlStateManager import net.minecraft.client.renderer.entity.RendererLivingEntity @@ -131,7 +132,7 @@ object HolographicEntities { val wither = HolographicBase(EntityWither(null)) val enderman = HolographicBase(EntityEnderman(null)) val mooshroom = HolographicBase(EntityMooshroom(null)) - val witherSkeleton = HolographicBase(EntitySkeleton(null).also { it.skeletonType = 1 }) + val witherSkeleton = HolographicBase(createWitherSkeleton(null)) val cow = HolographicBase(EntityCow(null)) val pig = HolographicBase(EntityPig(null)) val giant = HolographicBase(EntityGiantZombie(null)) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/compat/EntityCompat.kt b/src/main/java/at/hannibal2/skyhanni/utils/compat/EntityCompat.kt index 18df16c18aab..9f1bded7dff9 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/compat/EntityCompat.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/compat/EntityCompat.kt @@ -4,10 +4,11 @@ import net.minecraft.entity.Entity import net.minecraft.entity.EntityLiving import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.item.EntityArmorStand +import net.minecraft.entity.monster.EntitySkeleton import net.minecraft.item.ItemStack import net.minecraft.world.World - -//#if MC >= 1.12 +//#if MC > 1.12 +//$$ import net.minecraft.entity.monster.EntityWitherSkeleton //$$ import net.minecraft.inventory.EntityEquipmentSlot //#endif @@ -58,3 +59,10 @@ fun Entity.getEntityLevel(): World = //#else //$$ this.level //#endif + +fun createWitherSkeleton(world: World?): EntityLivingBase = +//#if MC < 1.12 + EntitySkeleton(world).also { it.skeletonType = 1 } +//#else +//$$ EntityWitherSkeleton(world) +//#endif diff --git a/src/main/java/at/hannibal2/skyhanni/utils/compat/PacketCompat.kt b/src/main/java/at/hannibal2/skyhanni/utils/compat/PacketCompat.kt index b97f4dfd5a10..5e06736a0142 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/compat/PacketCompat.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/compat/PacketCompat.kt @@ -1,6 +1,8 @@ package at.hannibal2.skyhanni.utils.compat +import at.hannibal2.skyhanni.utils.LorenzVec import net.minecraft.item.ItemStack +import net.minecraft.network.play.client.C03PacketPlayer import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement import net.minecraft.util.EnumFacing //#if MC > 1.12 @@ -20,3 +22,10 @@ fun C08PacketPlayerBlockPlacement.getUsedItem(): ItemStack? = //#else //$$ Minecraft.getMinecraft().player?.getHeldItem(hand) //#endif + +fun C03PacketPlayer.getLocation(): LorenzVec = + //#if MC < 1.12 + LorenzVec(positionX, positionY, positionZ) +//#else +//$$ LorenzVec(getX(0.0), getY(0.0), getZ(0.0)) +//#endif diff --git a/src/main/java/at/hannibal2/skyhanni/utils/json/ItemStackTypeAdapterFactory.kt b/src/main/java/at/hannibal2/skyhanni/utils/json/ItemStackTypeAdapterFactory.kt index 1940b03c0ef7..f6f3ac066079 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/json/ItemStackTypeAdapterFactory.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/json/ItemStackTypeAdapterFactory.kt @@ -20,7 +20,11 @@ object ItemStackTypeAdapterFactory : TypeAdapterFactory { } override fun read(reader: JsonReader): ItemStack { + //#if MC < 1.12 return ItemStack.loadItemStackFromNBT(nbtCompoundTypeAdapter.read(reader)) + //#else + //$$ return ItemStack(nbtCompoundTypeAdapter.read(reader)) + //#endif } } as TypeAdapter } diff --git a/versions/mapping-1.12.2-1.8.9.txt b/versions/mapping-1.12.2-1.8.9.txt index 86a8561c1cfc..a3737f33ec3e 100644 --- a/versions/mapping-1.12.2-1.8.9.txt +++ b/versions/mapping-1.12.2-1.8.9.txt @@ -30,6 +30,7 @@ net.minecraft.network.play.server.SPacketBlockChange net.minecraft.network.play. net.minecraft.network.play.server.SPacketChat net.minecraft.network.play.server.S02PacketChat net.minecraft.network.play.server.SPacketCloseWindow net.minecraft.network.play.server.S2EPacketCloseWindow net.minecraft.network.play.server.SPacketCollectItem net.minecraft.network.play.server.S0DPacketCollectItem +net.minecraft.network.play.server.SPacketConfirmTransaction net.minecraft.network.play.server.S32PacketConfirmTransaction net.minecraft.network.play.server.SPacketDestroyEntities net.minecraft.network.play.server.S13PacketDestroyEntities net.minecraft.network.play.server.SPacketEffect net.minecraft.network.play.server.S28PacketEffect net.minecraft.network.play.server.SPacketEntity net.minecraft.network.play.server.S14PacketEntity diff --git a/versions/mapping-1.16.5-forge-1.12.2.txt b/versions/mapping-1.16.5-forge-1.12.2.txt index dc467f91d863..5b1e8c009100 100644 --- a/versions/mapping-1.16.5-forge-1.12.2.txt +++ b/versions/mapping-1.16.5-forge-1.12.2.txt @@ -82,6 +82,7 @@ net.minecraft.network.protocol.game.ClientboundAddMobPacket net.minecraft.networ net.minecraft.network.protocol.game.ClientboundAddPlayerPacket net.minecraft.network.play.server.SPacketSpawnPlayer net.minecraft.network.protocol.game.ClientboundAnimatePacket net.minecraft.network.play.server.SPacketAnimation net.minecraft.network.protocol.game.ClientboundBlockUpdatePacket net.minecraft.network.play.server.SPacketBlockChange +net.minecraft.network.protocol.game.ClientboundContainerAckPacket net.minecraft.network.play.server.SPacketConfirmTransaction net.minecraft.network.protocol.game.ClientboundContainerClosePacket net.minecraft.network.play.server.SPacketCloseWindow net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket net.minecraft.network.play.server.SPacketSetSlot net.minecraft.network.protocol.game.ClientboundEntityEventPacket net.minecraft.network.play.server.SPacketEntityStatus From c9f8b8c3c7eee2b876892671931f5555afe36ce5 Mon Sep 17 00:00:00 2001 From: NopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com> Date: Thu, 12 Dec 2024 23:46:17 +1100 Subject: [PATCH 03/21] Fix: total collected regex (#3049) --- src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt index 22d11710eef8..80cfba4002bf 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt @@ -36,10 +36,11 @@ object CollectionAPI { /** * REGEX-TEST: §7Total collected: §e261,390 + * REGEX-TEST: §7Total Collected: §e2,012,418 */ private val singleCounterPattern by patternGroup.pattern( "singlecounter", - "§7Total collected: §e(?.*)", + "§7Total [c|C]ollected: §e(?.*)", ) /** From 70eaeb81996d77ae8a5c76b8cce52ebbd56542b2 Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Fri, 13 Dec 2024 12:04:21 +1100 Subject: [PATCH 04/21] Fix: NeuRenderEvent (#3053) --- src/main/java/at/hannibal2/skyhanni/events/NEURenderEvent.kt | 2 +- .../hannibal2/skyhanni/mixins/transformers/MixinNEUOverlay.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/events/NEURenderEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/NEURenderEvent.kt index c92944c31fc0..af85871783d4 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/NEURenderEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/NEURenderEvent.kt @@ -2,4 +2,4 @@ package at.hannibal2.skyhanni.events import at.hannibal2.skyhanni.api.event.CancellableSkyHanniEvent -object NEURenderEvent : CancellableSkyHanniEvent() +class NEURenderEvent : CancellableSkyHanniEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinNEUOverlay.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinNEUOverlay.java index 9940f01c1469..8a75627025ea 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinNEUOverlay.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinNEUOverlay.java @@ -14,7 +14,7 @@ public class MixinNEUOverlay { @Inject(method = "render", at = @At("HEAD"), cancellable = true, remap = false) private void render(boolean hoverInv, CallbackInfo ci) { - if (NEURenderEvent.INSTANCE.post()) { + if (new NEURenderEvent().post()) { ci.cancel(); } } From 6b55c585677ab4eaf2def83a054dc4d2feb6f4b2 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Fri, 13 Dec 2024 09:46:09 +0100 Subject: [PATCH 05/21] Improvement: No Pests Widget reminder (#3022) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../features/garden/pests/PestFinder.kt | 32 +++++++++++++++---- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt index cdba3155f7b7..3d61325c27fc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.garden.pests import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.features.garden.pests.PestFinderConfig.VisibilityType +import at.hannibal2.skyhanni.data.model.TabWidget import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.IslandChangeEvent import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -81,10 +82,11 @@ object PestFinder { } if (PestAPI.getInfestedPlots().isEmpty() && PestAPI.scoreboardPests != 0) { + remindInChat() add(Renderable.string("§e${PestAPI.scoreboardPests} §6Bugged pests!")) add( Renderable.clickAndHover( - "§cTry opening your plots menu.", + "§cTry opening your plots menu", listOf( "Runs /desk.", ), @@ -93,6 +95,26 @@ object PestFinder { }, ), ) + add( + Renderable.clickAndHover( + "§cor enable Pests Widget in §e/widget.", + listOf( + "Runs /widget.", + ), + onClick = { + HypixelCommands.widget() + }, + ), + ) + } + } + + private fun remindInChat() { + if (!TabWidget.PESTS.isActive) { + ChatUtils.userError( + "Pest detection requires the tab list widget to be enabled. Enable the 'Pests Widget' via /widget!", + replaceSameMessage = true, + ) } } @@ -155,12 +177,8 @@ object PestFinder { val isInaccurate = plot.isPestCountInaccurate val location = playerLocation.copy(x = middle.x, z = middle.z) event.drawWaypointFilled(location, LorenzColor.RED.toColor()) - val text = "§e" + ( - if (isInaccurate) "?" else pests - ) + " §c$pestsName §7in §b$plotName" - event.drawDynamicText( - location, text, 1.5, - ) + val number = if (isInaccurate) "?" else pests + event.drawDynamicText(location, "§e$number §c$pestsName §7in §b$plotName", 1.5) } private var lastKeyPress = SimpleTimeMark.farPast() From 9e397b97aadd2fef42290717d792470fa6316126 Mon Sep 17 00:00:00 2001 From: Obsidian <108832807+Obsidianninja11@users.noreply.github.com> Date: Thu, 12 Dec 2024 23:47:58 -0900 Subject: [PATCH 06/21] Improvement: Option to hide seconds in Real time GUI (#2979) Co-authored-by: Cal Co-authored-by: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../skyhanni/config/features/gui/GUIConfig.java | 5 +++++ .../skyhanni/features/misc/TimeFeatures.kt | 14 ++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/gui/GUIConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/gui/GUIConfig.java index 37f3d3c42037..d594b4a6807b 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/gui/GUIConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/gui/GUIConfig.java @@ -122,6 +122,11 @@ public class GUIConfig { @ConfigEditorBoolean public boolean realTimeFormatToggle = false; + @Expose + @ConfigOption(name = "Real Time Show Seconds", desc = "Include the current seconds in the Real Time display.") + @ConfigEditorBoolean + public boolean realTimeShowSeconds = true; + @Expose @ConfigLink(owner = GUIConfig.class, field = "realTime") public Position realTimePosition = new Position(10, 10, false, true); diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt index a4440295d8e1..bf28ff0f85e9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt @@ -25,9 +25,6 @@ object TimeFeatures { private val config get() = SkyHanniMod.feature.gui private val winterConfig get() = SkyHanniMod.feature.event.winter - private val timeFormat24h = SimpleDateFormat("HH:mm:ss") - private val timeFormat12h = SimpleDateFormat("hh:mm:ss a") - private val startOfNextYear by RecalculatingValue(1.seconds) { SkyBlockTime(year = SkyBlockTime.now().year + 1).asTimeMark() } @@ -35,10 +32,15 @@ object TimeFeatures { @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { if (!LorenzUtils.inSkyBlock && !OutsideSbFeature.REAL_TIME.isSelected()) return - if (config.realTime) { - val currentTime = - (if (config.realTimeFormatToggle) timeFormat12h else timeFormat24h).format(System.currentTimeMillis()) + val timeFormat = if (config.realTimeFormatToggle) { + // 12 h format + SimpleDateFormat("hh:mm${if (config.realTimeShowSeconds) ":ss" else ""} a") + } else { + // 24 h format + SimpleDateFormat("HH:mm${if (config.realTimeShowSeconds) ":ss" else ""}") + } + val currentTime = timeFormat.format(System.currentTimeMillis()) config.realTimePosition.renderString(currentTime, posLabel = "Real Time") } From e67c258080fa8571b208b88a8f153240a319e8b8 Mon Sep 17 00:00:00 2001 From: BearySuperior <76191014+BearySuperior@users.noreply.github.com> Date: Fri, 13 Dec 2024 01:07:44 -0800 Subject: [PATCH 07/21] Improvement: Adds a chat filter to being hit by a venom shot (#3032) Co-authored-by: Cal Co-authored-by: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../features/chat/ArachneChatMessageHider.kt | 38 +++++++++++++++---- versions/1.8.9/detekt/baseline.xml | 4 +- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ArachneChatMessageHider.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ArachneChatMessageHider.kt index f4903e926aa4..04e5bb51edcb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/ArachneChatMessageHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ArachneChatMessageHider.kt @@ -23,36 +23,58 @@ object ArachneChatMessageHider { */ val arachneCallingPattern by patternGroup.pattern( "calling", - "§4☄ §r.* §r§eplaced an §r§9Arachne's Calling§r§e!.*" + "§4☄ §r.* §r§eplaced an §r§9Arachne's Calling§r§e!.*", ) + + /** + * REGEX-TEST: §4☄ §r§7SultanHakeem §r§eplaced an Arachne Crystal! Something is awakening! + */ val arachneCrystalPattern by patternGroup.pattern( "crystal", - "§4☄ §r.* §r§eplaced an Arachne Crystal! Something is awakening!" + "§4☄ §r.* §r§eplaced an Arachne Crystal! Something is awakening!", ) + + /** + * REGEX-TEST: §c[BOSS] Arachne§r§f: The Era of Spiders begins now. + */ private val arachneSpawnPattern by patternGroup.pattern( "spawn", - "§c\\[BOSS] Arachne§r§f: (?:The Era of Spiders begins now\\.|Ahhhh\\.\\.\\.A Calling\\.\\.\\.)" + "§c\\[BOSS] Arachne§r§f: (?:The Era of Spiders begins now\\.|Ahhhh\\.\\.\\.A Calling\\.\\.\\.)", + ) + + /** + * REGEX-TEST: §dArachne's Keeper used §r§2Venom Shot §r§don you hitting you for §r§c87.7 damage §r§dand infecting you with venom. + * REGEX-TEST: §dArachne used §r§2Venom Shot §r§don you hitting you for §r§c58 damage §r§dand infecting you with venom. + * REGEX-TEST: §dArachne's Brood used §r§2Venom Shot §r§don you hitting you for §r§c19.8 damage §r§dand infecting you with venom. + */ + @Suppress("MaxLineLength") + private val venomShotPattern by patternGroup.pattern( + "venom", + "§dArachne(?:'s (?:Keeper|Brood))? used §r§2Venom Shot §r§don you hitting you for §r§c[\\d.,]+ damage §r§dand infecting you with venom\\.", ) @SubscribeEvent fun onChat(event: LorenzChatEvent) { if (!isEnabled()) return - if (LorenzUtils.skyBlockArea == "Arachne's Sanctuary") return + if (!shouldHide(event.message)) return - if (shouldHide(event.message)) { - event.blockedReason = "arachne" - } + event.blockedReason = "arachne" } private fun shouldHide(message: String): Boolean { + venomShotPattern.matchMatcher(message) { + return true + } + + if (LorenzUtils.skyBlockArea == "Arachne's Sanctuary") return false + arachneCallingPattern.matchMatcher(message) { return true } arachneCrystalPattern.matchMatcher(message) { return true } - arachneSpawnPattern.matchMatcher(message) { return true } diff --git a/versions/1.8.9/detekt/baseline.xml b/versions/1.8.9/detekt/baseline.xml index 0584a2711af6..c9ef245f4622 100644 --- a/versions/1.8.9/detekt/baseline.xml +++ b/versions/1.8.9/detekt/baseline.xml @@ -79,8 +79,6 @@ NoNameShadowing:Shimmy.kt$Shimmy.Companion$source NoNameShadowing:SkyHanniBucketedItemTracker.kt$SkyHanniBucketedItemTracker${ ItemPriceSource.entries[it.ordinal] } RepoPatternRegexTest:AdvancedPlayerList.kt$AdvancedPlayerList$by RepoPattern.pattern( "misc.compacttablist.advanced.level", ".*\\[(?<level>.*)] §r(?<name>.*)", ) - RepoPatternRegexTest:ArachneChatMessageHider.kt$ArachneChatMessageHider$by patternGroup.pattern( "crystal", "§4☄ §r.* §r§eplaced an Arachne Crystal! Something is awakening!" ) - RepoPatternRegexTest:ArachneChatMessageHider.kt$ArachneChatMessageHider$by patternGroup.pattern( "spawn", "§c\\[BOSS] Arachne§r§f: (?:The Era of Spiders begins now\\.|Ahhhh\\.\\.\\.A Calling\\.\\.\\.)" ) RepoPatternRegexTest:AshfangFreezeCooldown.kt$AshfangFreezeCooldown$by RepoPattern.pattern( "ashfang.freeze.cryogenic", "§cAshfang Follower's Cryogenic Blast hit you for .* damage!", ) RepoPatternRegexTest:AuctionHouseCopyUnderbidPrice.kt$AuctionHouseCopyUnderbidPrice$by patternGroup.pattern( "allowedinventories", "Auctions Browser|Manage Auctions|Auctions: \".*\"?", ) RepoPatternRegexTest:AuctionHouseCopyUnderbidPrice.kt$AuctionHouseCopyUnderbidPrice$by patternGroup.pattern( "price", "§7(?:Buy it now|Starting bid|Top bid): §6(?<coins>[0-9,]+) coins", ) @@ -122,7 +120,6 @@ RepoPatternRegexTest:CompactBingoChat.kt$CompactBingoChat$by patternGroup.pattern( "border", "§[e3]§l▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬" ) RepoPatternRegexTest:CompactBingoChat.kt$CompactBingoChat$by patternGroup.pattern( "health", " {3}§r§7§8\\+§a.* §c❤ Health" ) RepoPatternRegexTest:CompactBingoChat.kt$CompactBingoChat$by patternGroup.pattern( "strength", " {3}§r§7§8\\+§a. §c❁ Strength" ) - RepoPatternRegexTest:CrimsonIsleReputationHelper.kt$CrimsonIsleReputationHelper$by RepoPattern.pattern( "crimson.reputation.tablist", " §r§[cdea].*", ) RepoPatternRegexTest:CroesusChestTracker.kt$CroesusChestTracker$by patternGroup.pattern("chest.floor", "§7Tier: §eFloor (?<floor>[IV]+)") RepoPatternRegexTest:CroesusChestTracker.kt$CroesusChestTracker$by patternGroup.pattern("chest.master", ".*Master.*") RepoPatternRegexTest:CroesusChestTracker.kt$CroesusChestTracker$by patternGroup.pattern("chest.state.opened", "§8Opened Chest:.*") @@ -282,6 +279,7 @@ RepoPatternRegexTest:UtilsPatterns.kt$UtilsPatterns$by patternGroup.pattern( "time.amount", "(?:(?<y>\\d+) ?y(?:\\w* ?)?)?(?:(?<d>\\d+) ?d(?:\\w* ?)?)?(?:(?<h>\\d+) ?h(?:\\w* ?)?)?(?:(?<m>\\d+) ?m(?:\\w* ?)?)?(?:(?<s>\\d+) ?s(?:\\w* ?)?)?", ) RepoPatternRegexTest:VisitorListener.kt$VisitorListener$by RepoPattern.pattern( "garden.visitor.offersaccepted", "§7Offers Accepted: §a(?<offersAccepted>\\d+)", ) ReturnCount:AnitaMedalProfit.kt$AnitaMedalProfit$private fun readItem(slot: Int, item: ItemStack, table: MutableList<DisplayTableEntry>) + ReturnCount:ArachneChatMessageHider.kt$ArachneChatMessageHider$private fun shouldHide(message: String): Boolean ReturnCount:BingoNextStepHelper.kt$BingoNextStepHelper$private fun readDescription(description: String): NextStep? ReturnCount:BroodmotherFeatures.kt$BroodmotherFeatures$private fun onStageUpdate() ReturnCount:ChatPeek.kt$ChatPeek$@JvmStatic fun peek(): Boolean From c67724ab7d289e181cdc02d361b0cb4c54d673b0 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Fri, 13 Dec 2024 10:10:11 +0100 Subject: [PATCH 08/21] Fix: Composter message spam (#3037) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Co-authored-by: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> --- .../skyhanni/features/garden/composter/ComposterOverlay.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt index 3760c892ce5b..ab7674806828 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt @@ -505,6 +505,7 @@ object ComposterOverlay { "Sacks could not be loaded. Click here and open your §9$sackType Sack §eto update the data!", onClick = { HypixelCommands.sacks() }, "§eClick to run /sax!", + replaceSameMessage = true ) return } From ad2ef786a111c8f73a023fe873e388fde003a0ed Mon Sep 17 00:00:00 2001 From: Chissl <78828070+Chissl@users.noreply.github.com> Date: Fri, 13 Dec 2024 03:45:37 -0600 Subject: [PATCH 09/21] Fix: Custom Scoreboard Player Count Including Offline Players (#3026) Co-authored-by: Chiss5618 <78828070+Chiss5618@users.noreply.github.com> Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Co-authored-by: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> --- .../at/hannibal2/skyhanni/data/HypixelData.kt | 37 +++++++++++-------- .../skyhanni/data/model/TabWidget.kt | 4 ++ 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt index 4f41a6ae47a5..1cfb6b9e6436 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt @@ -24,6 +24,8 @@ import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.HypixelCommands import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.inAnyIsland +import at.hannibal2.skyhanni.utils.RegexUtils.allMatches import at.hannibal2.skyhanni.utils.RegexUtils.firstMatcher import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.RegexUtils.matches @@ -89,11 +91,11 @@ object HypixelData { ) /** - * REGEX-TEST: §r§b§lCoop §r§f(4) + * REGEX-TEST: §8[§r§a§r§8] §r§bBpoth §r§6§l℻ */ - private val playerAmountCoopPattern by patternGroup.pattern( - "playeramount.coop", - "^\\s*(?:§.)*Coop (?:§.)*\\((?\\d+)\\)\\s*$", + private val playerAmountOnIslandPattern by patternGroup.pattern( + "playeramount.onisland", + "^§.\\[[§\\w]{6,11}] §r.*", ) /** @@ -112,14 +114,6 @@ object HypixelData { "^\\s*(?:§.)+Party (?:§.)+\\((?\\d+)\\)\\s*$", ) - /** - * REGEX-TEST: §r§b§lIsland - */ - private val soloProfileAmountPattern by patternGroup.pattern( - "solo.profile.amount", - "^\\s*(?:§.)*Island\\s*$", - ) - /** * REGEX-TEST: §a✌ §7(§a11§7/20) */ @@ -178,6 +172,8 @@ object HypixelData { var skyBlockArea: String? = null var skyBlockAreaWithSymbol: String? = null + var playerAmountOnIsland = 0 + // Data from locraw var locrawData: JsonObject? = null private val locraw: MutableMap = listOf( @@ -263,7 +259,6 @@ object HypixelData { var amount = 0 val playerPatternList = mutableListOf( playerAmountPattern, - playerAmountCoopPattern, playerAmountGuestingPattern, ) if (DungeonAPI.inDungeon()) { @@ -278,14 +273,17 @@ object HypixelData { } } } - amount += TabListData.getTabList().count { soloProfileAmountPattern.matches(it) } - return amount + if (!inAnyIsland(IslandType.GARDEN, IslandType.GARDEN_GUEST, IslandType.PRIVATE_ISLAND, IslandType.PRIVATE_ISLAND_GUEST)) { + playerAmountOnIsland = 0 + } + + return amount + playerAmountOnIsland } fun getMaxPlayersForCurrentServer(): Int { scoreboardVisitingAmountPattern.firstMatcher(ScoreboardData.sidebarLinesFormatted) { - return group("maxamount").toInt() + return group("maxamount").toInt() + playerAmountOnIsland } return when (skyBlockIsland) { @@ -449,6 +447,8 @@ object HypixelData { when (event.widget) { TabWidget.AREA -> checkIsland(event) TabWidget.PROFILE -> checkProfile() + TabWidget.COOP -> countPlayersOnIsland(event) + TabWidget.ISLAND -> countPlayersOnIsland(event) else -> Unit } } @@ -570,4 +570,9 @@ object HypixelData { val scoreboardTitle = displayName.removeColor() return scoreboardTitlePattern.matches(scoreboardTitle) } + + private fun countPlayersOnIsland(event: WidgetUpdateEvent) { + if (event.isClear()) return + playerAmountOnIsland = playerAmountOnIslandPattern.allMatches(event.lines).size + } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/model/TabWidget.kt b/src/main/java/at/hannibal2/skyhanni/data/model/TabWidget.kt index 40973b5898d5..43e9b699224f 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/model/TabWidget.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/model/TabWidget.kt @@ -119,6 +119,10 @@ enum class TabWidget( // language=RegExp "(?:§.)*Coop (?:§.)*.*", ), + ISLAND( + // language=RegExp + "(?:§.)*Island", + ), MINION( // language=RegExp "(?:§.)*Minions: (?:§.)*(?\\d+)(?:§.)*/(?:§.)*(?\\d+)", From 6bf0f91d9d1996aaeafe1bc10ea3e018917d5ddd Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Fri, 13 Dec 2024 11:12:15 +0100 Subject: [PATCH 10/21] Fix: Non Transparent Backgrounds in Notification (#3050) --- .../inventory/experimentationtable/GuardianReminder.kt | 4 ++-- .../inventory/experimentationtable/UltraRareBookAlert.kt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/GuardianReminder.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/GuardianReminder.kt index 0d683072cea8..12cbcf659e28 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/GuardianReminder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/GuardianReminder.kt @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.ColorUtils import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.HypixelCommands import at.hannibal2.skyhanni.utils.InventoryUtils @@ -19,7 +20,6 @@ import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiContainer import net.minecraft.client.renderer.GlStateManager import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import java.awt.Color import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds @@ -71,7 +71,7 @@ object GuardianReminder { GlStateManager.translate(0f, -150f, 500f) Renderable.drawInsideRoundedRect( Renderable.string("§cWrong Pet equipped!", 1.5), - Color.DARK_GRAY, + ColorUtils.TRANSPARENT_COLOR, horizontalAlign = RenderUtils.HorizontalAlignment.CENTER, verticalAlign = RenderUtils.VerticalAlignment.CENTER, ).renderXYAligned(0, 125, width, height) diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/UltraRareBookAlert.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/UltraRareBookAlert.kt index 727e891b6d3d..5845b33536ec 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/UltraRareBookAlert.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/UltraRareBookAlert.kt @@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.features.inventory.experimentationtable.Experimenta import at.hannibal2.skyhanni.features.inventory.experimentationtable.ExperimentationTableAPI.ultraRarePattern import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.ColorUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher @@ -23,7 +24,6 @@ import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiContainer import net.minecraft.client.renderer.GlStateManager import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import java.awt.Color import kotlin.time.Duration.Companion.seconds @SkyHanniModule @@ -53,7 +53,7 @@ object UltraRareBookAlert { Renderable.drawInsideRoundedRect( Renderable.string("§d§kXX§5 ULTRA-RARE BOOK! §d§kXX", 1.5), - Color.DARK_GRAY, + ColorUtils.TRANSPARENT_COLOR, horizontalAlign = RenderUtils.HorizontalAlignment.CENTER, verticalAlign = RenderUtils.VerticalAlignment.CENTER, ).renderXYAligned(0, 125, gui.width, gui.height) From 50d877df81e28a98d38409a316b74b385552463f Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Fri, 13 Dec 2024 11:14:57 +0100 Subject: [PATCH 11/21] Fix: New Rift CS Lines (#3046) --- .../gui/customscoreboard/ScoreboardPattern.kt | 13 +++++++++++++ .../gui/customscoreboard/UnknownLinesHandler.kt | 2 ++ .../customscoreboard/events/ScoreboardEventRift.kt | 2 ++ 3 files changed, 17 insertions(+) diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardPattern.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardPattern.kt index 36b80722b576..edd7bc05bcdf 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardPattern.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardPattern.kt @@ -823,6 +823,19 @@ object ScoreboardPattern { "Protestors handled: §b\\d+\\/\\d+", ) + val timeSlicedPattern by riftSb.pattern( + "timesliced", + "§c§lTIME SLICED!", + ) + + /** + * REGEX-TEST: Big damage in: §d2m 59s + */ + val bigDamagePattern by riftSb.pattern( + "bigdamage", + "\\s*Big damage in: §d[\\w\\s]+", + ) + private val carnivalSb = scoreboardGroup.group("carnival") /** diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt index 6d9768985057..b114b398ae13 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt @@ -142,6 +142,8 @@ object UnknownLinesHandler { SbPattern.cluesPattern, SbPattern.barryProtestorsQuestlinePattern, SbPattern.barryProtestorsHandledPattern, + SbPattern.timeSlicedPattern, + SbPattern.bigDamagePattern, SbPattern.carnivalPattern, SbPattern.carnivalTasksPattern, SbPattern.carnivalTokensPattern, diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/events/ScoreboardEventRift.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/events/ScoreboardEventRift.kt index 3f47ee92ba19..f02ec9c8668b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/events/ScoreboardEventRift.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/events/ScoreboardEventRift.kt @@ -20,6 +20,8 @@ object ScoreboardEventRift : ScoreboardEvent() { ScoreboardPattern.cluesPattern, ScoreboardPattern.barryProtestorsQuestlinePattern, ScoreboardPattern.barryProtestorsHandledPattern, + ScoreboardPattern.timeSlicedPattern, + ScoreboardPattern.bigDamagePattern, ) override fun getDisplay() = patterns.allMatches(getSbLines()) From df944a8b357e4f9978319ecce7b0ec6c771e26bc Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Fri, 13 Dec 2024 11:23:08 +0100 Subject: [PATCH 12/21] Improvement + Backend: Mining event sending check (#3055) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../config/features/mining/MiningEventConfig.java | 5 +++++ .../mining/eventtracker/MiningEventTracker.kt | 5 ++++- .../java/at/hannibal2/skyhanni/utils/ChatUtils.kt | 14 ++++++++++++-- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/mining/MiningEventConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/mining/MiningEventConfig.java index 1616c6107284..021dbd82ff28 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/mining/MiningEventConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/mining/MiningEventConfig.java @@ -66,4 +66,9 @@ public String toString() { @Expose @ConfigLink(owner = MiningEventConfig.class, field = "enabled") public Position position = new Position(200, 60, false, true); + + @Expose + @ConfigOption(name = "Sharing Event Data", desc = "Sending Mining Event data to a server. This allows everyone to see more precise mining event timings. Thanks for your help!") + @ConfigEditorBoolean + public boolean allowDataSharing = true; } diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt index 760a4f357b69..54865161f225 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt @@ -124,6 +124,9 @@ object MiningEventTracker { } private fun sendData(eventName: String, time: String?) { + // Option to opt out of data sending + if (!config.allowDataSharing) return + // we now ignore mineshaft events. if (IslandType.MINESHAFT.isInIsland()) return // TODO fix this via regex @@ -228,7 +231,7 @@ object MiningEventTracker { ChatUtils.chat( "§cFailed loading Mining Event data!\n" + "§cPlease wait until the server-problem fixes itself! There is nothing else to do at the moment.", - replaceSameMessage = true, + onlySendOnce = true ) } else { ErrorManager.logErrorWithData( diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt index 166501e70b70..0ae7b717a412 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt @@ -82,20 +82,30 @@ object ChatUtils { prefix: Boolean = true, prefixColor: String = "§e", replaceSameMessage: Boolean = false, + onlySendOnce: Boolean = false, ) { if (prefix) { - internalChat(prefixColor + CHAT_PREFIX + message, replaceSameMessage) + internalChat(prefixColor + CHAT_PREFIX + message, replaceSameMessage, onlySendOnce) } else { - internalChat(message, replaceSameMessage) + internalChat(message, replaceSameMessage, onlySendOnce) } } + private val messagesThatAreOnlySentOnce = mutableListOf() + private fun internalChat( message: String, replaceSameMessage: Boolean, + onlySendOnce: Boolean = false, ): Boolean { val text = ChatComponentText(message) + if (onlySendOnce) { + if (message in messagesThatAreOnlySentOnce) { + return false + } + messagesThatAreOnlySentOnce.add(message) + } return if (replaceSameMessage) { text.send(getUniqueMessageIdForString(message)) From 9ebc336b3038f677c4735d23c2754ecf024e9cf0 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Fri, 13 Dec 2024 11:25:42 +0100 Subject: [PATCH 13/21] Backend: Sulphur Skitter performance updates (#3038) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Co-authored-by: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> --- .../features/nether/SulphurSkitterBox.kt | 70 +++++++++++-------- 1 file changed, 40 insertions(+), 30 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/SulphurSkitterBox.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/SulphurSkitterBox.kt index 9f73c381c88b..eb7fb814523e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/SulphurSkitterBox.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/SulphurSkitterBox.kt @@ -13,6 +13,7 @@ import at.hannibal2.skyhanni.utils.BlockUtils.getBlockAt import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland +import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils import at.hannibal2.skyhanni.utils.RenderUtils.expandBlock import at.hannibal2.skyhanni.utils.SpecialColor.toSpecialColor @@ -26,54 +27,63 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object SulphurSkitterBox { private val config get() = SkyHanniMod.feature.fishing.trophyFishing.sulphurSkitterBox - private var spongeBlocks = listOf() - private var closestBlock: BlockPos? = null + private var spongeLocations = listOf() + private var closestSponge: LorenzVec? = null + private var renderBox: AxisAlignedBB? = null private const val RADIUS = 4 @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!isEnabled()) return + if (event.repeatSeconds(1)) { + calculateSpongeLocations() + } if (event.isMod(5)) { - closestBlock = getClosestBlockToPlayer() + calculateClosestSponge() } - if (event.repeatSeconds(1)) { - val location = LocationUtils.playerLocation() - val from = location.add(-20, -20, -20).toBlockPos() - val to = location.add(20, 20, 20).toBlockPos() + } - spongeBlocks = BlockPos.getAllInBox(from, to).filter { - val loc = it.toLorenzVec() - loc.getBlockAt() == Blocks.sponge && loc.distanceToPlayer() <= 15 - }.filter { - val pos1 = it.add(-RADIUS, -RADIUS, -RADIUS) - val pos2 = it.add(RADIUS, RADIUS, RADIUS) - BlockPos.getAllInBox(pos1, pos2).any { pos -> - pos.toLorenzVec().getBlockAt() in FishingAPI.lavaBlocks - } - } + private fun calculateClosestSponge() { + val location = spongeLocations.minByOrNull { it.distanceToPlayer() } + if (location == closestSponge) return + closestSponge = location + renderBox = location?.let { + val pos1 = it.add(-RADIUS, -RADIUS, -RADIUS) + val pos2 = it.add(RADIUS + 1, RADIUS + 1, RADIUS + 1) + pos1.axisAlignedTo(pos2).expandBlock() } } + private fun calculateSpongeLocations() { + val location = LocationUtils.playerLocation() + val from = location.add(-15, -15, -15).toBlockPos() + val to = location.add(15, 15, 15).toBlockPos() + + spongeLocations = BlockPos.getAllInBox(from, to).filter { + val loc = it.toLorenzVec() + loc.getBlockAt() == Blocks.sponge && loc.distanceToPlayer() <= 15 + }.filter { + val pos1 = it.add(-RADIUS, -RADIUS, -RADIUS) + val pos2 = it.add(RADIUS, RADIUS, RADIUS) + BlockPos.getAllInBox(pos1, pos2).any { pos -> + pos.toLorenzVec().getBlockAt() in FishingAPI.lavaBlocks + } + }.map { it.toLorenzVec() } + } + @SubscribeEvent fun onWorldChange(event: LorenzWorldChangeEvent) { - spongeBlocks = emptyList() + spongeLocations = emptyList() + closestSponge = null + renderBox = null } @SubscribeEvent fun onRenderWorld(event: LorenzRenderWorldEvent) { if (!isEnabled()) return - closestBlock?.let { - if (it.toLorenzVec().distanceToPlayer() >= 50) return - val pos1 = it.add(-RADIUS, -RADIUS, -RADIUS) - val pos2 = it.add(RADIUS + 1, RADIUS + 1, RADIUS + 1) - val axis = AxisAlignedBB(pos1, pos2).expandBlock() - - drawBox(axis, event.partialTicks) - } - } - - private fun getClosestBlockToPlayer(): BlockPos? { - return spongeBlocks.minByOrNull { it.toLorenzVec().distanceToPlayer() } + val location = closestSponge ?: return + if (location.distanceToPlayer() >= 50) return + renderBox?.let { drawBox(it, event.partialTicks) } } private fun drawBox(axis: AxisAlignedBB, partialTicks: Float) { From 64425658ba203ab5b70774903ce7e5bcf54af0d3 Mon Sep 17 00:00:00 2001 From: David Cole <40234707+DavidArthurCole@users.noreply.github.com> Date: Fri, 13 Dec 2024 05:47:27 -0500 Subject: [PATCH 14/21] Feature: Hitman Statistics (#2991) Co-authored-by: Cal --- .../storage/ProfileSpecificStorage.java | 6 +- .../features/event/hoppity/HoppityAPI.kt | 13 +- .../features/event/hoppity/HoppityEggType.kt | 7 +- .../ChocolateFactoryDataLoader.kt | 12 + .../chocolatefactory/ChocolateFactoryStats.kt | 75 ++++-- .../chocolatefactory/hitman/HitmanAPI.kt | 215 ++++++++++++++++++ .../HitmanSlots.kt} | 5 +- .../hannibal2/skyhanni/utils/SkyBlockTime.kt | 12 +- .../skyhanni/utils/SkyblockSeason.kt | 26 +++ 9 files changed, 341 insertions(+), 30 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/hitman/HitmanAPI.kt rename src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/{ChocolateFactoryHitmanSlots.kt => hitman/HitmanSlots.kt} (98%) diff --git a/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java b/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java index 3514b9e8991c..2221cc9c2532 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java +++ b/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java @@ -222,7 +222,7 @@ public HotspotRabbitStorage(@Nullable Integer year) { public static class HitmanStatsStorage { @Expose @Nullable - public Integer availableEggs; + public Integer availableEggs = null; @Expose @Nullable @@ -231,6 +231,10 @@ public static class HitmanStatsStorage { @Expose @Nullable public SimpleTimeMark allSlotsCooldown = null; + + @Expose + @Nullable + public Integer purchasedSlots = null; } @Expose diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityAPI.kt index 302ca6d0861b..f1e6b9e519a7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityAPI.kt @@ -162,10 +162,15 @@ object HoppityAPI { // If there is a time since lastHoppityCallAccept, we can assume this is an abiphone call private fun getBoughtType(): HoppityEggType = if (lastHoppityCallAccept != null) BOUGHT_ABIPHONE else BOUGHT - fun isHoppityEvent() = (SkyblockSeason.currentSeason == SkyblockSeason.SPRING || SkyHanniMod.feature.dev.debug.alwaysHoppitys) - fun getEventEndMark(): SimpleTimeMark? = if (isHoppityEvent()) { - SkyBlockTime.fromSbYearAndMonth(SkyBlockTime.now().year, 3).asTimeMark() - } else null + fun isHoppityEvent() = (SkyblockSeason.SPRING.isSeason() || SkyHanniMod.feature.dev.debug.alwaysHoppitys) + + fun getEventEndMark(): SimpleTimeMark? = if (isHoppityEvent()) getEventEndMark(SkyBlockTime.now().year) else null + + fun getEventEndMark(year: Int) = + SkyBlockTime.fromSeason(year, SkyblockSeason.SUMMER, SkyblockSeason.SkyblockSeasonModifier.EARLY).asTimeMark() + + fun getEventStartMark(year: Int) = + SkyBlockTime.fromSeason(year, SkyblockSeason.SPRING, SkyblockSeason.SkyblockSeasonModifier.EARLY).asTimeMark() fun rarityByRabbit(rabbit: String): LorenzRarity? = hoppityRarities.firstOrNull { it.chatColorCode == rabbit.substring(0, 2) diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggType.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggType.kt index 9a187a6feb25..6d498633a009 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggType.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggType.kt @@ -20,7 +20,7 @@ enum class HoppityEggType( val resetsAt: Int, var lastResetDay: Int = -1, private var claimed: Boolean = false, - private val altDay: Boolean = false + val altDay: Boolean = false ) { BREAKFAST("Breakfast", "§6", 7), LUNCH("Lunch", "§9", 14), @@ -51,6 +51,10 @@ enum class HoppityEggType( return now.copy(day = now.day + daysToAdd, hour = resetsAt, minute = 0, second = 0).asTimeMark().timeUntil() } + fun nextTime(): SimpleTimeMark { + return SimpleTimeMark.now() + timeUntil() + } + fun markClaimed(mark: SimpleTimeMark? = null) { mealLastFound[this] = mark ?: SimpleTimeMark.now() claimed = true @@ -93,6 +97,7 @@ enum class HoppityEggType( } val resettingEntries = entries.filter { it.resetsAt != -1 } + val sortedResettingEntries = resettingEntries.sortedBy { it.resetsAt } fun allFound() = resettingEntries.forEach { it.markClaimed() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryDataLoader.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryDataLoader.kt index c1b5b497b3cc..6e71e1ec1505 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryDataLoader.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryDataLoader.kt @@ -208,6 +208,15 @@ object ChocolateFactoryDataLoader { "§7Available eggs: §a(?\\d+)", ) + /** + * REGEX-TEST: §7Purchased slots: §a28§7/§a28 + * REGEX-TEST: §7Purchased slots: §e0§7/§a22 + */ + private val hitmanPurchasedSlotsPattern by ChocolateFactoryAPI.patternGroup.pattern( + "hitman.purchasedslots", + "§7Purchased slots: §.(?\\d+)§7\\/§a\\d+", + ) + /** * REGEX-TEST: §7Slot cooldown: §a8m 6s */ @@ -451,6 +460,9 @@ object ChocolateFactoryDataLoader { val nextAllSlots = (SimpleTimeMark.now() + timeUntilAllSlots) profileStorage.hitmanStats.allSlotsCooldown = nextAllSlots } + hitmanPurchasedSlotsPattern.matchMatcher(line) { + profileStorage.hitmanStats.purchasedSlots = group("amount").formatInt() + } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStats.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStats.kt index c1b5951ae202..02d6b50915a4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStats.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStats.kt @@ -3,7 +3,11 @@ package at.hannibal2.skyhanni.features.inventory.chocolatefactory import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.SecondPassedEvent +import at.hannibal2.skyhanni.features.event.hoppity.HoppityAPI import at.hannibal2.skyhanni.features.event.hoppity.HoppityEventSummary +import at.hannibal2.skyhanni.features.inventory.chocolatefactory.hitman.HitmanAPI.getHitmanTimeToAll +import at.hannibal2.skyhanni.features.inventory.chocolatefactory.hitman.HitmanAPI.getHitmanTimeToFull +import at.hannibal2.skyhanni.features.inventory.chocolatefactory.hitman.HitmanAPI.getOpenSlots import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.ClipboardUtils import at.hannibal2.skyhanni.utils.LorenzUtils @@ -16,6 +20,7 @@ import at.hannibal2.skyhanni.utils.renderables.Renderable import com.google.gson.JsonElement import com.google.gson.JsonPrimitive import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.time.Duration @SkyHanniModule object ChocolateFactoryStats { @@ -40,6 +45,7 @@ object ChocolateFactoryStats { config.position.renderRenderables(display, posLabel = "Chocolate Factory Stats") } + @Suppress("LongMethod", "CyclomaticComplexMethod") fun updateDisplay() { val profileStorage = profileStorage ?: return @@ -76,7 +82,23 @@ object ChocolateFactoryStats { val upgradeAvailableAt = ChocolateAmount.CURRENT.formattedTimeUntilGoal(profileStorage.bestUpgradeCost) - val map = buildMap { + val hitmanStats = profileStorage.hitmanStats + val availableHitmanEggs = hitmanStats.availableEggs?.takeIf { it > 0 }?.toString() ?: "§7None" + val hitmanSingleSlotCd = hitmanStats.slotCooldown?.takeIf { it.isInFuture() }?.timeUntil()?.format() ?: "§aAll Ready" + val hitmanAllSlotsCd = hitmanStats.allSlotsCooldown?.takeIf { it.isInFuture() }?.timeUntil()?.format() ?: "§aAll Ready" + val openSlotsNow = hitmanStats.getOpenSlots() + val purchasedSlots = hitmanStats.purchasedSlots ?: 0 + + val (hitmanAllSlotsTime, allSlotsEventInhibited) = hitmanStats.getHitmanTimeToAll() + val hitmanAllClaimString = hitmanAllSlotsTime.takeIf { it > Duration.ZERO }?.format() ?: "§aAll Ready" + val hitmanAllClaimReady = "${if (allSlotsEventInhibited) "§c" else "§b"}$hitmanAllClaimString" + + val (hitmanFullTime, hitmanFullEventInhibited) = hitmanStats.getHitmanTimeToFull() + val hitmanFullString = if (openSlotsNow == 0) "§7Cooldown..." + else hitmanFullTime.takeIf { it > Duration.ZERO }?.format() ?: "§cFull Now" + val hitmanSlotsFull = "${if (hitmanFullEventInhibited) "§c" else "§b"}$hitmanFullString" + + val map = buildMap { put(ChocolateFactoryStat.HEADER, "§6§lChocolate Factory ${ChocolateFactoryAPI.currentPrestige.toRoman()}") val maxSuffix = if (ChocolateFactoryAPI.isMax()) { @@ -118,25 +140,36 @@ object ChocolateFactoryStats { "§eRaw Per Second: §6${profileStorage.rawChocPerSecond.addSeparators()}", ) - if (ChocolateFactoryAPI.isMaxPrestige()) { - val allTime = ChocolateAmount.ALL_TIME.chocolate() - val nextChocolateMilestone = ChocolateFactoryAPI.getNextMilestoneChocolate(allTime) - val amountUntilNextMilestone = nextChocolateMilestone - allTime - val maxMilestoneEstimate = ChocolateAmount.ALL_TIME.formattedTimeUntilGoal(nextChocolateMilestone) - - if (amountUntilNextMilestone >= 0) { - put(ChocolateFactoryStat.TIME_TO_PRESTIGE, "§eTime To Next Milestone: $maxMilestoneEstimate") - put( - ChocolateFactoryStat.CHOCOLATE_UNTIL_PRESTIGE, - "§eChocolate To Next Milestone: §6${amountUntilNextMilestone.addSeparators()}", - ) - } - } else { - put(ChocolateFactoryStat.TIME_TO_PRESTIGE, "§eTime To Prestige: $prestigeEstimate") - put(ChocolateFactoryStat.CHOCOLATE_UNTIL_PRESTIGE, "§eChocolate To Prestige: §6$chocolateUntilPrestige") + val allTime = ChocolateAmount.ALL_TIME.chocolate() + val nextChocolateMilestone = ChocolateFactoryAPI.getNextMilestoneChocolate(allTime) + val amountUntilNextMilestone = nextChocolateMilestone - allTime + val amountFormat = amountUntilNextMilestone.addSeparators() + val maxMilestoneEstimate = ChocolateAmount.ALL_TIME.formattedTimeUntilGoal(nextChocolateMilestone) + val prestigeData = when { + !ChocolateFactoryAPI.isMaxPrestige() -> mapOf( + ChocolateFactoryStat.TIME_TO_PRESTIGE to "§eTime To Prestige: $prestigeEstimate", + ChocolateFactoryStat.CHOCOLATE_UNTIL_PRESTIGE to "§eChocolate To Prestige: §6$chocolateUntilPrestige" + ) + amountUntilNextMilestone >= 0 -> mapOf( + ChocolateFactoryStat.TIME_TO_PRESTIGE to "§eTime To Next Milestone: $maxMilestoneEstimate", + ChocolateFactoryStat.CHOCOLATE_UNTIL_PRESTIGE to "§eChocolate To Next Milestone: §6$amountFormat" + ) + else -> emptyMap() } + putAll(prestigeData) put(ChocolateFactoryStat.TIME_TO_BEST_UPGRADE, "§eBest Upgrade: $upgradeAvailableAt") + + put(ChocolateFactoryStat.HITMAN_HEADER, "§c§lRabbit Hitman") + put(ChocolateFactoryStat.AVAILABLE_HITMAN_EGGS, "§eAvailable Hitman Eggs: §6$availableHitmanEggs") + put(ChocolateFactoryStat.OPEN_HITMAN_SLOTS, "§eOpen Hitman Slots: §6$openSlotsNow") + put(ChocolateFactoryStat.HITMAN_SLOT_COOLDOWN, "§eHitman Slot Cooldown: §b$hitmanSingleSlotCd") + put(ChocolateFactoryStat.HITMAN_ALL_SLOTS, "§eAll Hitman Slots Cooldown: §b$hitmanAllSlotsCd") + + if (HoppityAPI.isHoppityEvent()) { + put(ChocolateFactoryStat.HITMAN_FULL_SLOTS, "§eFull Hitman Slots: §b$hitmanSlotsFull") + put(ChocolateFactoryStat.HITMAN_28_SLOTS, "§e$purchasedSlots Hitman Claims: $hitmanAllClaimReady") + } } val text = config.statsDisplayList.filter { it.shouldDisplay() }.flatMap { map[it]?.split("\n").orEmpty() } @@ -199,9 +232,13 @@ object ChocolateFactoryStats { "§eBest Upgrade: §b 59m 4s", { ChocolateFactoryAPI.profileStorage?.bestUpgradeCost != 0L }, ), - AVAILABLE_HITMAN_EGGS("§eAvailable Hitman Eggs: §b3"), - HITMAN_SLOT_COOLDOWN("§Hitman Slot Cooldown: §b8m 6s"), + HITMAN_HEADER("§c§lRabbit Hitman"), + AVAILABLE_HITMAN_EGGS("§eAvailable Hitman Eggs: §63"), + OPEN_HITMAN_SLOTS("§eOpen Hitman Slots: §63"), + HITMAN_SLOT_COOLDOWN("§eHitman Slot Cooldown: §b8m 6s"), HITMAN_ALL_SLOTS("§eAll Hitman Slots Cooldown: §b8h 8m 6s"), + HITMAN_FULL_SLOTS("§eFull Hitman Slots: §b2h 10m"), + HITMAN_28_SLOTS("§e28 Hitman Claims: §b3h 20m"), ; override fun toString(): String { diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/hitman/HitmanAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/hitman/HitmanAPI.kt new file mode 100644 index 000000000000..df957b6f4fb0 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/hitman/HitmanAPI.kt @@ -0,0 +1,215 @@ +package at.hannibal2.skyhanni.features.inventory.chocolatefactory.hitman + +import at.hannibal2.skyhanni.config.storage.ProfileSpecificStorage.ChocolateFactoryStorage.HitmanStatsStorage +import at.hannibal2.skyhanni.features.event.hoppity.HoppityAPI +import at.hannibal2.skyhanni.features.event.hoppity.HoppityAPI.isAlternateDay +import at.hannibal2.skyhanni.features.event.hoppity.HoppityEggType +import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule +import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.SimpleTimeMark +import at.hannibal2.skyhanni.utils.SkyBlockTime +import at.hannibal2.skyhanni.utils.inPartialMinutes +import kotlin.math.ceil +import kotlin.time.Duration +import kotlin.time.Duration.Companion.milliseconds +import kotlin.time.Duration.Companion.minutes + +@SkyHanniModule +object HitmanAPI { + + private const val MINUTES_PER_DAY = 20 // Real minutes per SkyBlock day + private const val SB_HR_PER_DAY = 24 // SkyBlock hours per day + private val sortedEntries get() = HoppityEggType.sortedResettingEntries + private val orderOrdinalMap: Map by lazy { + sortedEntries.mapIndexed { index, hoppityEggType -> + hoppityEggType to sortedEntries[(index + 1) % sortedEntries.size] + }.toMap() + } + + /** + * Determine if the given meal will 'still' be claimed before the given duration + */ + private fun HoppityEggType.willBeClaimableAfter(duration: Duration): Boolean = this.timeUntil() < duration + private fun HoppityEggType.passesNotClaimed(tilSpawnDuration: Duration, initialAvailable: MutableList) = + (initialAvailable.contains(this) || this.willBeClaimableAfter(tilSpawnDuration)) + + /** + * Get the time until the given number of slots are available. + */ + private fun HitmanStatsStorage.getTimeToNumSlots(numSlots: Int): Duration { + val currentSlots = this.getOpenSlots() + if (currentSlots >= numSlots) return Duration.ZERO + val slotCooldown = this.slotCooldown ?: return Duration.ZERO + val minutesUntilSlot = slotCooldown.timeUntil().inPartialMinutes + val minutesUntilSlots = minutesUntilSlot + ((numSlots - currentSlots - 1) * MINUTES_PER_DAY) + return minutesUntilSlots.minutes + } + + /** + * Return the number of extra slots that will be available after the given duration. + */ + private fun HitmanStatsStorage.extraSlotsInDuration(duration: Duration, setSlotNumber: Int? = null): Int { + val currentSlots = (setSlotNumber ?: this.getOpenSlots()).takeIf { it < ((this.purchasedSlots ?: 0)) } ?: return 0 + val slotCooldown = this.slotCooldown ?: return 0 + val minutesUntilSlot = slotCooldown.timeUntil().inPartialMinutes + if (minutesUntilSlot >= duration.inPartialMinutes) return 0 + for (i in 1..(this.purchasedSlots ?: 0)) { + // If the next slot would put us at the max slot count, return the number of slots + if (currentSlots + i == ((this.purchasedSlots ?: 0))) return i + val minutesUntilSlots = minutesUntilSlot + ((i - 1) * MINUTES_PER_DAY) + if (minutesUntilSlots >= duration.inPartialMinutes) return i + } + return 0 // Should never reach here + } + + /** + * Determine the first meal that would be hunted by Hitman if given an infinite amount of time. + */ + private fun getFirstHuntedMeal(): HoppityEggType = + sortedEntries.filter { !it.isClaimed() }.minByOrNull { it.timeUntil() } + ?: sortedEntries.minByOrNull { it.timeUntil() } + ?: ErrorManager.skyHanniError("Could not find initial meal to hunt") + + /** + * Determine the next meal that would be hunted by Hitman if given an infinite amount of time. + */ + private fun getNextHuntedMeal( + previousMeal: HoppityEggType, + duration: Duration, + initialAvailable: MutableList + ): HoppityEggType = sortedEntries + .filter { it.passesNotClaimed(duration, initialAvailable) } + .let { passingEggs -> + passingEggs.firstOrNull { it.resetsAt > previousMeal.resetsAt && it.altDay == previousMeal.altDay } + ?: passingEggs.firstOrNull { it.altDay != previousMeal.altDay } + ?: orderOrdinalMap[previousMeal] + ?: ErrorManager.skyHanniError("Could not find next meal to hunt after $previousMeal") + } + + /** + * Return the time until the given number of rabbits can be hunted. + */ + private fun HitmanStatsStorage.getTimeToHuntCount(targetHuntCount: Int): Duration { + // Store the initial meal to hunt + var nextHuntMeal = getFirstHuntedMeal() + // Store a list of all the meals that will be available to hunt at their next spawn + val initialAvailable = sortedEntries.filter { !it.isClaimed() && it != nextHuntMeal }.toMutableList() + + // Will store the total time until the given number of meals can be hunted + var tilSpawnDuration = + if (nextHuntMeal.isClaimed()) nextHuntMeal.timeUntil() + (MINUTES_PER_DAY * 2).minutes // -next- cycle after spawn + else nextHuntMeal.timeUntil() // Otherwise, just the time until the next spawn + + // Determine how many hunts we need to perform - 1 is added to account for the initial meal calculation above + val huntsToPerform = targetHuntCount - (1 + (this.availableEggs ?: 0)) + // Loop through the meals until the given number of meals can be hunted + repeat(huntsToPerform) { + // Determine the next meal to hunt + val candidate = getNextHuntedMeal(nextHuntMeal, tilSpawnDuration, initialAvailable) + + // If the meal was initially available, we don't need to wait for it to spawn + if (initialAvailable.contains(candidate)) initialAvailable.remove(candidate) + // Otherwise we add the time until the next spawn + else tilSpawnDuration += candidate.timeFromAnother(nextHuntMeal) + + // Cycle through + nextHuntMeal = candidate + } + + return tilSpawnDuration + } + + /** + * Return the duration between two HoppityEggTypes' spawn times. + */ + private fun HoppityEggType.timeFromAnother(another: HoppityEggType): Duration { + val diffInSbHours = when { + this == another -> (SB_HR_PER_DAY * 2) + this.altDay != another.altDay -> SB_HR_PER_DAY - another.resetsAt + this.resetsAt + this.resetsAt > another.resetsAt -> this.resetsAt - another.resetsAt + else -> (SB_HR_PER_DAY * 2) - (this.resetsAt - another.resetsAt) + } + return (diffInSbHours * SkyBlockTime.SKYBLOCK_HOUR_MILLIS).milliseconds + } + + /** + * Return the number of slots that are currently open. + * This has to be calculated based on the cooldown of all slots, + * as Hypixel doesn't directly expose this information in the `/cf` + * menu, and only gives cooldown timers... + */ + fun HitmanStatsStorage.getOpenSlots(): Int { + val allSlotsCooldown = this.allSlotsCooldown ?: return this.purchasedSlots ?: 0 + if (allSlotsCooldown.isInPast()) return this.purchasedSlots ?: 0 + + val minutesUntilAll = allSlotsCooldown.timeUntil().inPartialMinutes + val slotsOnCooldown = ceil(minutesUntilAll / MINUTES_PER_DAY).toInt() + return (this.purchasedSlots ?: 0) - slotsOnCooldown - (this.availableEggs ?: 0) + } + + /** + * Get the time until slots are full (or the event ends). + */ + fun HitmanStatsStorage.getHitmanTimeToFull(): Pair { + val slotsOpenNow = this.getOpenSlots() + val eventEndMark = HoppityAPI.getEventEndMark() ?: return Pair(Duration.ZERO, false) + + var slotsToFill = slotsOpenNow + for (i in (0..20)) { // Runaway protection + // Calculate time needed to fill this many slots + val timeToSlots = this.getTimeToHuntCount(slotsToFill) + + // If now plus the time to fill the slots is after the event end, we're done + if (SimpleTimeMark.now() + timeToSlots > eventEndMark) return Pair(eventEndMark.timeUntil(), true) + + // How many additional slots did we gain in that time? + val extraSlotsInTime = this.extraSlotsInDuration(timeToSlots, slotsToFill) + + // If we didn't get any extra slots, we're done + if (extraSlotsInTime == 0) return Pair(timeToSlots, false) + + slotsToFill += extraSlotsInTime + } + // Should never reach here + return Pair(Duration.ZERO, false) + } + + /** + * Get the time until ALL purchased slots are full (or the event ends). + * This is distinct from getHitmanTimeToFull() in that it forces the + * calculation to use the purchased slot count, not letting itself be + * inhibited by the cooldown "catching up" to spawn timers. + */ + fun HitmanStatsStorage.getHitmanTimeToAll(): Pair { + val eventEndMark = HoppityAPI.getEventEndMark() ?: return Pair(Duration.ZERO, false) + + val timeToSlots = this.getTimeToNumSlots(this.purchasedSlots ?: 0) + val timeToHunt = this.getTimeToHuntCount(this.purchasedSlots ?: 0) + + // Figure out which timer is the inhibitor + val longerTime = if (timeToSlots > timeToHunt) timeToSlots else timeToHunt + + // If the inhibitor is longer than the event end, return the time until the event ends + if ((SimpleTimeMark.now() + longerTime) > eventEndMark) return Pair(eventEndMark.timeUntil(), true) + + // If the spawns are the inhibitor, return the time until the spawns + if (timeToHunt > timeToSlots) return Pair(timeToHunt, false) + + // Otherwise if slots are the inhibitor, we need to find the next spawn time after the slots are full + val timeMarkAllSlots = SimpleTimeMark.now() + timeToSlots + val sbTimeAllSlots = timeMarkAllSlots.toSkyBlockTime() + val isAllSlotDayAlt = sbTimeAllSlots.isAlternateDay() + + // Find the first HoppityEggType that spawns after the slots are full + val nextMealAfterAllSlots = HoppityEggType.sortedResettingEntries.firstOrNull { + it.resetsAt > sbTimeAllSlots.hour && it.altDay == isAllSlotDayAlt + } ?: HoppityEggType.sortedResettingEntries.filter { + it.altDay != isAllSlotDayAlt + }.minByOrNull { it.resetsAt } ?: ErrorManager.skyHanniError("Could not find next meal after all slots") + + // Return the adjusted time until the next meal + val sbDayDiff = if (nextMealAfterAllSlots.altDay != isAllSlotDayAlt) 1 else 0 + val sbHourDiff = nextMealAfterAllSlots.resetsAt - sbTimeAllSlots.hour + sbDayDiff * SB_HR_PER_DAY + return Pair(timeToSlots + (sbHourDiff * SkyBlockTime.SKYBLOCK_HOUR_MILLIS).milliseconds, false) + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryHitmanSlots.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/hitman/HitmanSlots.kt similarity index 98% rename from src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryHitmanSlots.kt rename to src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/hitman/HitmanSlots.kt index ec3a88f636f6..825d513b51a0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryHitmanSlots.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/hitman/HitmanSlots.kt @@ -1,4 +1,4 @@ -package at.hannibal2.skyhanni.features.inventory.chocolatefactory +package at.hannibal2.skyhanni.features.inventory.chocolatefactory.hitman import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.GuiRenderEvent @@ -10,6 +10,7 @@ import at.hannibal2.skyhanni.events.hoppity.RabbitFoundEvent import at.hannibal2.skyhanni.events.render.gui.ReplaceItemEvent import at.hannibal2.skyhanni.features.event.hoppity.HoppityAPI.hitmanInventoryPattern import at.hannibal2.skyhanni.features.event.hoppity.HoppityEggType +import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryAPI import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryStrayTracker.formLoreToSingleLine import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.InventoryUtils.isTopInventory @@ -24,7 +25,7 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule -object ChocolateFactoryHitmanSlots { +object HitmanSlots { // /** diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockTime.kt b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockTime.kt index 1c9f4316a653..4f49a64b829a 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockTime.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockTime.kt @@ -41,14 +41,15 @@ data class SkyBlockTime( fun fromSbYear(year: Int): SkyBlockTime = fromInstant(Instant.ofEpochMilli(SKYBLOCK_EPOCH_START_MILLIS + (SKYBLOCK_YEAR_MILLIS * year))) - fun fromSbYearAndMonth(year: Int, month: Int): SkyBlockTime = - fromInstant( + fun fromSeason(year: Int, season: SkyblockSeason, modifier: SkyblockSeason.SkyblockSeasonModifier? = null): SkyBlockTime { + return fromInstant( Instant.ofEpochMilli( SKYBLOCK_EPOCH_START_MILLIS + (SKYBLOCK_YEAR_MILLIS * year) + - (SKYBLOCK_MONTH_MILLIS * (month - 1)) + (SKYBLOCK_MONTH_MILLIS * (season.getMonth(modifier))) ) ) + } fun now(): SkyBlockTime = fromInstant(Instant.now()) @@ -117,6 +118,11 @@ data class SkyBlockTime( else -> "th" } } + + operator fun SkyBlockTime.plus(duration: kotlin.time.Duration): SkyBlockTime { + val millis = toMillis() + duration.inWholeMilliseconds + return fromInstant(Instant.ofEpochMilli(millis)) + } } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SkyblockSeason.kt b/src/main/java/at/hannibal2/skyhanni/utils/SkyblockSeason.kt index d74b80959bcb..8aac5b34dc6b 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/SkyblockSeason.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/SkyblockSeason.kt @@ -16,8 +16,34 @@ enum class SkyblockSeason( WINTER("§9Winter", "§a5%+§cC", "§7Visitors give §a5% §7more §cCopper."), ; + enum class SkyblockSeasonModifier( + val str: String, + ) { + EARLY("Early"), + NONE(""), + LATE("Late"), + ; + + override fun toString(): String = str + } + + fun isSeason(): Boolean = currentSeason == this fun getPerk(abbreviate: Boolean): String = if (abbreviate) abbreviatedPerk else perk fun getSeason(abbreviate: Boolean): String = if (abbreviate) season.take(4) else season + fun getDisplayMonth(modifier: SkyblockSeasonModifier? = null): Int = getMonth(modifier) + 1 + fun getMonth(modifier: SkyblockSeasonModifier? = null): Int = + when (this) { + SPRING -> 1 + SUMMER -> 4 + AUTUMN -> 7 + WINTER -> 10 + }.minus( + when (modifier) { + SkyblockSeasonModifier.EARLY -> 1 + SkyblockSeasonModifier.LATE -> -1 + else -> 0 + } + ) companion object { From 090e3074358c5f0a3b4971dace815967d8371b1b Mon Sep 17 00:00:00 2001 From: Empa <42304516+ItsEmpa@users.noreply.github.com> Date: Fri, 13 Dec 2024 15:22:39 +0100 Subject: [PATCH 15/21] Backend: TimeLimitedCache (#2729) Co-authored-by: Empa Co-authored-by: Cal Co-authored-by: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> --- .../hannibal2/skyhanni/data/GuiEditManager.kt | 2 +- .../hannibal2/skyhanni/events/LorenzEvent.kt | 9 ++- .../dungeon/DungeonHighlightClickedBlocks.kt | 2 +- .../features/fishing/ChumBucketHider.kt | 4 +- .../skyhanni/features/fishing/FishingTimer.kt | 2 +- .../fishing/trophy/TrophyFishDisplay.kt | 4 +- .../skyhanni/features/slayer/HideMobNames.kt | 2 +- .../features/summonings/SummoningSoulsName.kt | 4 +- .../skyhanni/utils/TimeLimitedCache.kt | 66 ++++++++++++------- .../skyhanni/utils/TimeLimitedSet.kt | 61 +++++++++++++---- 10 files changed, 103 insertions(+), 53 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt index 0826813f1da8..dbcd84af3ff1 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt @@ -94,7 +94,7 @@ object GuiEditManager { @JvmStatic fun openGuiPositionEditor(hotkeyReminder: Boolean) { SkyHanniMod.screenToOpen = GuiPositionEditor( - currentPositions.values().toList(), + currentPositions.values.toList(), 2, Minecraft.getMinecraft().currentScreen as? GuiContainer, ) diff --git a/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt index b567d9ae6d06..afde87dd7e5a 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt @@ -26,7 +26,7 @@ abstract class LorenzEvent : Event() { this::class.simpleName!! } - @Deprecated("Use SkyHanniEvent instead", ReplaceWith("")) + @Deprecated("Use SkyHanniEvent instead") fun postAndCatch() = postAndCatchAndBlock {} companion object { @@ -39,7 +39,7 @@ abstract class LorenzEvent : Event() { val isInGuardedEventHandler get() = eventHandlerDepth > 0 || PlatformUtils.isDevEnvironment } - @Deprecated("Use SkyHanniEvent instead", ReplaceWith("")) + @Deprecated("Use SkyHanniEvent instead") fun postAndCatchAndBlock( printError: Boolean = true, stopOnFirstError: Boolean = false, @@ -75,7 +75,7 @@ abstract class LorenzEvent : Event() { ), ) } - return if (isCancelable) isCanceled else false + return isCancelable && isCanceled } private fun getListeners(): Array { @@ -83,10 +83,9 @@ abstract class LorenzEvent : Event() { return listenerList.getListeners(accessorEventBus.busId) } - @Deprecated("Use SkyHanniEvent instead", ReplaceWith("")) + @Deprecated("Use SkyHanniEvent instead") fun postWithoutCatch() = MinecraftForge.EVENT_BUS.post(this) - @Deprecated("Use SkyHanniEvent instead", ReplaceWith("")) fun cancel() { isCanceled = true } diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt index 0b2c3ae7177b..5eb13abb4ad3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt @@ -63,7 +63,7 @@ object DungeonHighlightClickedBlocks { } if (lockedPattern.matches(event.message)) { - blocks.lastOrNull { it.value.displayText.contains("Chest") }?.value?.color = config.lockedChestColor.toSpecialColor() + blocks.values.lastOrNull { it.displayText.contains("Chest") }?.color = config.lockedChestColor.toSpecialColor() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt index 86d2e46890a6..8afd4899866e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt @@ -54,7 +54,7 @@ object ChumBucketHider { // Second text line if (name.contains("/10 §aChums")) { val entityLocation = entity.getLorenzVec() - for (title in titleEntity.toSet()) { + for (title in titleEntity) { if (entityLocation.equalsIgnoreY(title.getLorenzVec())) { hiddenEntities.add(entity) event.cancel() @@ -70,7 +70,7 @@ object ChumBucketHider { } ) { val entityLocation = entity.getLorenzVec() - for (title in titleEntity.toSet()) { + for (title in titleEntity) { if (entityLocation.equalsIgnoreY(title.getLorenzVec())) { hiddenEntities.add(entity) event.cancel() diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt index 0b7058db1572..7ffb623a8571 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt @@ -130,7 +130,7 @@ object FishingTimer { private fun handle() { if (lastSeaCreatureFished.passedSince() > 2.seconds) return val name = lastNameFished ?: return - val mobs = recentMobs.toSet().filter { it.name == name && it !in mobDespawnTime } + val mobs = recentMobs.filter { it.name == name && it !in mobDespawnTime } .sortedBy { it.baseEntity.distanceToPlayer() } .take(mobsToFind) if (mobs.isEmpty()) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishDisplay.kt index 66bd29a013a8..7d25c35b8ec4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishDisplay.kt @@ -143,7 +143,7 @@ object TrophyFishDisplay { val internalName = getInternalName(rawName) row[TextPart.ICON] = Renderable.itemStack(internalName.getItemStack()) - val recentlyDroppedRarity = recentlyDroppedTrophies.getOrNull(internalName).takeIf { config.highlightNew.get() } + val recentlyDroppedRarity = recentlyDroppedTrophies[internalName]?.takeIf { config.highlightNew.get() } for (rarity in TrophyRarity.entries) { val amount = data[rarity] ?: 0 @@ -177,7 +177,7 @@ object TrophyFishDisplay { HideCaught.DIAMOND -> TrophyRarity.DIAMOND } - private fun getOrder(trophyFishes: MutableMap>) = sort(trophyFishes).let { + private fun getOrder(trophyFishes: Map>) = sort(trophyFishes).let { if (config.reverseOrder.get()) it.reversed() else it } diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/HideMobNames.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/HideMobNames.kt index 23ee38751c77..4eeb39e3d96c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/HideMobNames.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/HideMobNames.kt @@ -61,7 +61,7 @@ object HideMobNames { val name = entity.name val id = entity.entityId - if (lastMobName.getOrNull(id) == name) { + if (lastMobName[id] == name) { if (id in mobNamesHidden) { event.cancel() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt index 23020022692c..74542e1a2764 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt @@ -39,7 +39,7 @@ object SummoningSoulsName { private fun check() { for (entity in EntityUtils.getEntities()) { - if (souls.contains(entity)) continue + if (entity in souls) continue if (entity.hasSkullTexture(SUMMONING_SOUL_TEXTURE)) { val soulLocation = entity.getLorenzVec() @@ -52,7 +52,7 @@ object SummoningSoulsName { val nearestMob = map.sorted().firstNotNullOfOrNull { it.key } if (nearestMob != null) { - souls[entity] = mobsName.getOrNull(nearestMob)!! + souls[entity] = mobsName[nearestMob] ?: continue } } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedCache.kt b/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedCache.kt index 3f176c5ebd47..282f7057a8e2 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedCache.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedCache.kt @@ -6,35 +6,61 @@ import java.util.concurrent.ConcurrentMap import java.util.concurrent.TimeUnit import kotlin.time.Duration -@Suppress("UnstableApiUsage") +@Suppress("UnstableApiUsage", "IgnoredReturnValue") class TimeLimitedCache( expireAfterWrite: Duration, - private val removalListener: (K?, V?, RemovalCause) -> Unit = { _, _, _ -> }, -) : Iterable> { + private val removalListener: ((K?, V?, RemovalCause) -> Unit)? = null, +) : MutableMap { private val cache = CacheBuilder.newBuilder() .expireAfterWrite(expireAfterWrite.inWholeMilliseconds, TimeUnit.MILLISECONDS) - .removalListener { removalListener(it.key, it.value, it.cause) } + .apply { + removalListener?.let { listener -> + removalListener { + listener(it.key, it.value, it.cause) + } + } + } .build() - // TODO IntelliJ cant replace this, find another way? -// @Deprecated("outdated", ReplaceWith("[key] = value")) - @Deprecated("outdated", ReplaceWith("set(key, value)")) - fun put(key: K, value: V) = set(key, value) + override val size: Int get() = cache.size().toInt() - fun getOrNull(key: K): V? = cache.getIfPresent(key) + override fun isEmpty(): Boolean = cache.size() == 0L - fun getOrPut(key: K, defaultValue: () -> V) = getOrNull(key) ?: defaultValue().also { set(key, it) } + override fun containsKey(key: K): Boolean = cache.getIfPresent(key) != null - fun clear() = cache.invalidateAll() + override fun containsValue(value: V): Boolean = value in values - fun remove(key: K) = cache.invalidate(key) + override fun get(key: K): V? = cache.getIfPresent(key) - fun entries(): Set> = getMap().entries + operator fun set(key: K, value: V) = cache.put(key, value) - fun values(): Collection = getMap().values + override fun put(key: K, value: V): V? { + val previous = get(key) + set(key, value) + return previous + } + + override fun remove(key: K): V? { + val value = get(key) ?: return null + cache.invalidate(key) + return value + } + + override fun putAll(from: Map) { + from.forEach { (key, value) -> put(key, value) } + } + + override fun clear() = cache.invalidateAll() + + override val keys: MutableSet = getMap().keys - fun keys(): Set = getMap().keys + override val values: MutableCollection get() = getMap().values + + override val entries: MutableSet> = getMap().entries + + @Deprecated("", ReplaceWith("get(key)")) + fun getOrNull(key: K): V? = get(key) /** * Modifications to the returned map are not supported and may lead to unexpected behavior. @@ -42,7 +68,7 @@ class TimeLimitedCache( * * This returning map and any view into that map via [Map.keys], [Map.values] or [Map.entries], * may return [Collection.size] values larger than the elements actually present during iteration. - * This can lead to problems with kotlins [Iterable.toSet], [Iterable.toList] (etc.) small collection + * This can lead to problems with kotlin's [Iterable.toSet], [Iterable.toList] (etc.) small collection * optimizations. Those methods (and similar ones) have optimizations for single element collections. * Since the [Collection.size] is checked first those methods will then not make any additional * checks when accessing the elements of the collection. This can lead to rare [NoSuchElementException]. @@ -52,12 +78,4 @@ class TimeLimitedCache( * @return A read-only view of the cache's underlying map. */ private fun getMap(): ConcurrentMap = cache.asMap() - - fun containsKey(key: K): Boolean = cache.getIfPresent(key) != null - - override fun iterator(): Iterator> = entries().iterator() - - operator fun set(key: K, value: V) { - cache.put(key, value) - } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedSet.kt b/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedSet.kt index 175a976546fd..b69436a64032 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedSet.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedSet.kt @@ -3,36 +3,69 @@ package at.hannibal2.skyhanni.utils import com.google.common.cache.RemovalCause import kotlin.time.Duration +@Suppress("UnstableApiUsage") class TimeLimitedSet( expireAfterWrite: Duration, - private val removalListener: (T, RemovalCause) -> Unit = { _, _ -> }, -) : Iterable { + private val removalListener: ((T?, RemovalCause) -> Unit)? = null, +) : MutableSet { private val cache = TimeLimitedCache(expireAfterWrite) { key, _, cause -> - key?.let { - removalListener(it, cause) + removalListener?.let { + it(key, cause) } } - fun add(element: T) { - cache[element] = Unit + override val size: Int get() = cache.size + + override fun isEmpty(): Boolean = cache.isEmpty() + + override operator fun contains(element: T): Boolean = cache.containsKey(element) + + override fun add(element: T): Boolean { + return (element in cache).also { cache[element] = Unit } } - operator fun plusAssign(element: T) = add(element) + override fun remove(element: T): Boolean { + if (element !in cache) return false + cache.remove(element) + return true + } fun addIfAbsent(element: T) { if (!contains(element)) add(element) } - fun remove(element: T) = cache.remove(element) - - operator fun minusAssign(element: T) = remove(element) + override fun addAll(elements: Collection): Boolean { + var value = false + for (element in elements) { + if (add(element)) value = true + } + return value + } - operator fun contains(element: T): Boolean = cache.containsKey(element) + override fun clear() = cache.clear() - fun clear() = cache.clear() + override fun containsAll(elements: Collection): Boolean { + return elements.all { it in cache } + } - fun toSet(): Set = HashSet(cache.keys()) + override fun iterator(): MutableIterator = cache.keys.iterator() + override fun retainAll(elements: Collection): Boolean { + var value = false + for (key in cache.keys) { + if (key !in elements) { + remove(key) + value = true + } + } + return value + } - override fun iterator(): Iterator = toSet().iterator() + override fun removeAll(elements: Collection): Boolean { + var value = false + for (element in elements) { + if (remove(element)) value = true + } + return value + } } From bdba2cea57034e68557b53f2ef7f476ae1ff5f29 Mon Sep 17 00:00:00 2001 From: David Cole <40234707+DavidArthurCole@users.noreply.github.com> Date: Fri, 13 Dec 2024 09:24:41 -0500 Subject: [PATCH 16/21] Improvement: `/shtps` wording (#3045) --- .../java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt index 1905e43af324..66973e288032 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt @@ -39,6 +39,8 @@ object TpsCounter { private var display: String? = null private val timeSinceWorldSwitch get() = LorenzUtils.lastWorldSwitch.passedSince() + private val tilCalculated: String get() = + "§fCalculating... §7(${(10.seconds - timeSinceWorldSwitch).inWholeSeconds}s)" @SubscribeEvent fun onSecondPassed(event: SecondPassedEvent) { @@ -73,8 +75,8 @@ object TpsCounter { } private fun tpsCommand() { - val tps = tps ?: return ChatUtils.chat("§eTPS: §fCalculating...") - ChatUtils.chat("§eTPS: ${getColor(tps)}$tps") + val tpsMessage = tps?.let { "${getColor(it)}$it" } ?: tilCalculated + ChatUtils.chat("§eTPS: $tpsMessage") } @SubscribeEvent From 92462e9de28ef9017a4bb4d3952612ae9f1512eb Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 13 Dec 2024 16:44:22 +0100 Subject: [PATCH 17/21] Import and Namespace Usage Guidelines To maintain clarity and consistency in the codebase, follow these rules regarding imports and namespaces. Why This Rule? Improves code readability by making the origin of functions or properties explicit. Reduces ambiguity when functions or properties have similar names in different modules. Aligns with encapsulation and modular design principles. --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6ffad70fa971..8b7405ffd552 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -153,6 +153,7 @@ for more information and usages. the main thread. - When updating a config option variable, use the `ConfigUpdaterMigrator.ConfigFixEvent` with event.move() when moving a value, and event.transform() when updating a value. [For Example](https://github.com/hannibal002/SkyHanni/blob/e88f416c48f9659f89b7047d7629cd9a1d1535bc/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt#L276). - Use American English spelling conventions (e.g., "color" not "colour"). +- Avoid direct function imports. Always access functions or members through their respective namespaces or parent classes to improve readability and maintain encapsulation. ## Additional Useful Development Tools From bd58e6d051e9038f425a0afd0b0114d4774c71e3 Mon Sep 17 00:00:00 2001 From: David Cole <40234707+DavidArthurCole@users.noreply.github.com> Date: Fri, 13 Dec 2024 10:46:55 -0500 Subject: [PATCH 18/21] Fix: Stray Screen Flash V3 (#3052) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../ChocolateFactoryConfig.java | 6 +- ...olateFactoryStrayRabbitWarningConfig.java} | 12 +- ...hocolateFactoryUpgradeWarningsConfig.java} | 2 +- .../features/event/hoppity/HoppityAPI.kt | 19 ++- .../chocolatefactory/ChocolateFactoryAPI.kt | 14 +- .../ChocolateFactoryDataLoader.kt | 51 +----- .../ChocolateFactoryInventory.kt | 3 - .../ChocolateFactoryScreenFlash.kt | 86 ----------- .../ChocolateFactoryStrayTracker.kt | 9 +- .../ChocolateFactoryStrayWarning.kt | 145 ++++++++++++++++++ .../chocolatefactory/hitman/HitmanSlots.kt | 22 +-- .../at/hannibal2/skyhanni/utils/ItemUtils.kt | 1 + .../at/hannibal2/skyhanni/utils/TimeUtils.kt | 5 +- 13 files changed, 200 insertions(+), 175 deletions(-) rename src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/{ChocolateFactoryRabbitWarningConfig.java => ChocolateFactoryStrayRabbitWarningConfig.java} (85%) rename src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/{ChocolateUpgradeWarningsConfig.java => ChocolateFactoryUpgradeWarningsConfig.java} (96%) delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryScreenFlash.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayWarning.kt diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryConfig.java index b999f95c5ff7..48683cccc480 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryConfig.java @@ -56,14 +56,14 @@ public class ChocolateFactoryConfig { )); @Expose - @ConfigOption(name = "Rabbit Warning", desc = "") + @ConfigOption(name = "Stray Rabbit Warning", desc = "") @Accordion - public ChocolateFactoryRabbitWarningConfig rabbitWarning = new ChocolateFactoryRabbitWarningConfig(); + public ChocolateFactoryStrayRabbitWarningConfig rabbitWarning = new ChocolateFactoryStrayRabbitWarningConfig(); @Expose @ConfigOption(name = "Upgrade Warnings", desc = "") @Accordion - public ChocolateUpgradeWarningsConfig chocolateUpgradeWarnings = new ChocolateUpgradeWarningsConfig(); + public ChocolateFactoryUpgradeWarningsConfig chocolateUpgradeWarnings = new ChocolateFactoryUpgradeWarningsConfig(); @Expose @ConfigOption(name = "Chocolate Shop Price", desc = "") diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryRabbitWarningConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryStrayRabbitWarningConfig.java similarity index 85% rename from src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryRabbitWarningConfig.java rename to src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryStrayRabbitWarningConfig.java index fcbd88cf3095..2198383abe3c 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryRabbitWarningConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryStrayRabbitWarningConfig.java @@ -1,8 +1,8 @@ package at.hannibal2.skyhanni.config.features.inventory.chocolatefactory; +import at.hannibal2.skyhanni.utils.LorenzColor; import at.hannibal2.skyhanni.utils.OSUtils; import com.google.gson.annotations.Expose; -import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean; import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorButton; import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorColour; import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorDropdown; @@ -10,15 +10,19 @@ import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorText; import io.github.notenoughupdates.moulconfig.annotations.ConfigOption; import io.github.notenoughupdates.moulconfig.observer.Property; -import org.jetbrains.annotations.NotNull; -public class ChocolateFactoryRabbitWarningConfig { +public class ChocolateFactoryStrayRabbitWarningConfig { @Expose - @ConfigOption(name = "Rabbit Warning", desc = "Warn when stray rabbits of a certain tier appear.") + @ConfigOption(name = "Warning Level", desc = "Warn when stray rabbits of a certain tier appear.") @ConfigEditorDropdown public StrayTypeEntry rabbitWarningLevel = StrayTypeEntry.ALL; + @Expose + @ConfigOption(name = "Highlight Color", desc = "Choose the color that stray rabbits should be highlighted as.") + @ConfigEditorColour + public String inventoryHighlightColor = LorenzColor.RED.toConfigColor(); + @Expose @ConfigOption(name = "Warning Sound", desc = "The sound that plays for a special rabbit.\n" + "§eYou can use custom sounds, put it in the §bskyhanni/sounds §efolder in your resource pack.\n" + diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateUpgradeWarningsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryUpgradeWarningsConfig.java similarity index 96% rename from src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateUpgradeWarningsConfig.java rename to src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryUpgradeWarningsConfig.java index 6b39f7f49107..8c938b16ad0b 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateUpgradeWarningsConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryUpgradeWarningsConfig.java @@ -7,7 +7,7 @@ import io.github.notenoughupdates.moulconfig.annotations.ConfigOption; import io.github.notenoughupdates.moulconfig.observer.Property; -public class ChocolateUpgradeWarningsConfig { +public class ChocolateFactoryUpgradeWarningsConfig { @Expose @ConfigOption(name = "Upgrade Warning", desc = "Chat notification when you have a chocolate factory upgrade available to purchase.") @ConfigEditorBoolean diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityAPI.kt index f1e6b9e519a7..fa544dca4d83 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityAPI.kt @@ -25,11 +25,11 @@ import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactor import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryStrayTracker import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryStrayTracker.duplicateDoradoStrayPattern import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryStrayTracker.duplicatePseudoStrayPattern -import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryStrayTracker.formLoreToSingleLine import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore +import at.hannibal2.skyhanni.utils.ItemUtils.getSingleLineLore import at.hannibal2.skyhanni.utils.LorenzRarity import at.hannibal2.skyhanni.utils.LorenzRarity.DIVINE import at.hannibal2.skyhanni.utils.LorenzRarity.LEGENDARY @@ -188,15 +188,18 @@ object HoppityAPI { return (month % 2 == 1) == (day % 2 == 0) } - private fun Map.filterStrayProcessable() = filter { (slotNumber, stack) -> + fun filterMayBeStray(items: Map) = items.filter { (slotIndex, stack) -> // Strays can only appear in the first 3 rows of the inventory, excluding the middle slot of the middle row. - slotNumber != 13 && slotNumber in 0..26 && - // Don't process the same slot twice. - !processedStraySlots.contains(slotNumber) && + slotIndex != 13 && slotIndex in 0..26 && // Stack must not be null, and must be a skull. stack.item != null && stack.item == Items.skull && - // All strays are skulls with a display name, and lore. - stack.hasDisplayName() && stack.getLore().isNotEmpty() + // All strays have a display name, all the time. + stack.hasDisplayName() && stack.displayName.isNotEmpty() + } + + private fun Map.filterStrayProcessable() = filterMayBeStray(this).filter { + !processedStraySlots.contains(it.key) && // Don't process the same slot twice. + it.value.getLore().isNotEmpty() // All processable strays have lore. } @@ -262,7 +265,7 @@ object HoppityAPI { else -> return@matchMatcher } } - ChocolateFactoryStrayTracker.strayDoradoPattern.matchMatcher(formLoreToSingleLine(itemStack.getLore())) { + ChocolateFactoryStrayTracker.strayDoradoPattern.matchMatcher(itemStack.getSingleLineLore()) { // If the lore contains the escape pattern, we don't want to fire the event. // There are also 3 separate messages that can match, which is why we need to check the time since the last fire. if (ChocolateFactoryStrayTracker.doradoEscapeStrayPattern.anyMatches(itemStack.getLore())) return@matchMatcher diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryAPI.kt index 17851bfde080..e256250cbaea 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryAPI.kt @@ -37,9 +37,9 @@ object ChocolateFactoryAPI { val config: ChocolateFactoryConfig get() = SkyHanniMod.feature.inventory.chocolateFactory val profileStorage: ChocolateFactoryStorage? get() = ProfileStorageData.profileSpecific?.chocolateFactory - val patternGroup = RepoPattern.group("misc.chocolatefactory") + // /** * REGEX-TEST: 46,559,892,200 Chocolate */ @@ -76,6 +76,16 @@ object ChocolateFactoryAPI { "(?(?:§.+)+Rabbit .*)§8 - §7\\[\\d*§7] .*", ) + /** + * REGEX-TEST: §7You caught a stray §6§lGolden Rabbit§7! §7You caught a glimpse of §6El Dorado§7, ... + * REGEX-TEST: §7You caught a stray §9Fish the Rabbit§7 + */ + val caughtRabbitPattern by patternGroup.pattern( + "rabbit.caught", + ".*§7You caught.*" + ) + // + var rabbitSlots = mapOf() var otherUpgradeSlots = setOf() var noPickblockSlots = setOf() @@ -106,8 +116,6 @@ object ChocolateFactoryAPI { var leaderboardPercentile: Double? = null var chocolateForPrestige = 150_000_000L - var clickRabbitSlot: Int? = null - var factoryUpgrades = listOf() var bestAffordableSlot = -1 var bestPossibleSlot = -1 diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryDataLoader.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryDataLoader.kt index 6e71e1ec1505..bf759fceac39 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryDataLoader.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryDataLoader.kt @@ -1,23 +1,17 @@ package at.hannibal2.skyhanni.features.inventory.chocolatefactory import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator -import at.hannibal2.skyhanni.config.features.inventory.chocolatefactory.ChocolateFactoryRabbitWarningConfig.StrayTypeEntry import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryUpdatedEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent -import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryAPI.specialRabbitTextures -import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryScreenFlash.isRarityOrHigher -import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryScreenFlash.isSpecial import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ConditionalUtils import at.hannibal2.skyhanni.utils.HypixelCommands import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore -import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture import at.hannibal2.skyhanni.utils.ItemUtils.name -import at.hannibal2.skyhanni.utils.LorenzRarity import at.hannibal2.skyhanni.utils.NumberUtil.formatDouble import at.hannibal2.skyhanni.utils.NumberUtil.formatInt import at.hannibal2.skyhanni.utils.NumberUtil.formatLong @@ -140,7 +134,7 @@ object ChocolateFactoryDataLoader { /** * REGEX-TEST: §7Status: §a§lACTIVE §f59m58s - * REGEX-TEST: + * REGEX-TEST: §7Status: §c§lINACTIVE */ private val timeTowerStatusPattern by ChocolateFactoryAPI.patternGroup.pattern( "timetower.status", @@ -422,21 +416,14 @@ object ChocolateFactoryDataLoader { timeTowerStatusPattern.matchMatcher(line) { val activeTime = group("acitveTime") if (activeTime.isNotEmpty()) { - // todo in future fix this issue with TimeUtils.getDuration - val formattedGroup = activeTime.replace("h", "h ").replace("m", "m ") - - val activeDuration = TimeUtils.getDuration(formattedGroup) - val activeUntil = SimpleTimeMark.now() + activeDuration + val activeUntil = SimpleTimeMark.now() + TimeUtils.getDuration(activeTime) profileStorage.currentTimeTowerEnds = activeUntil } else { profileStorage.currentTimeTowerEnds = SimpleTimeMark.farPast() } } timeTowerRechargePattern.matchMatcher(line) { - // todo in future fix this issue with TimeUtils.getDuration - val formattedGroup = group("duration").replace("h", "h ").replace("m", "m ") - - val timeUntilTower = TimeUtils.getDuration(formattedGroup) + val timeUntilTower = TimeUtils.getDuration(group("duration")) val nextTimeTower = SimpleTimeMark.now() + timeUntilTower profileStorage.nextTimeTower = nextTimeTower } @@ -467,8 +454,6 @@ object ChocolateFactoryDataLoader { } private fun processInventory(list: MutableList, inventory: Map) { - ChocolateFactoryAPI.clickRabbitSlot = null - for ((slotIndex, item) in inventory) { processItem(list, item, slotIndex) } @@ -477,8 +462,6 @@ object ChocolateFactoryDataLoader { private fun processItem(list: MutableList, item: ItemStack, slotIndex: Int) { if (slotIndex == ChocolateFactoryAPI.prestigeIndex) return - handleRabbitWarnings(item, slotIndex) - if (slotIndex !in ChocolateFactoryAPI.otherUpgradeSlots && slotIndex !in ChocolateFactoryAPI.rabbitSlots) return val itemName = item.name.removeColor() @@ -571,34 +554,6 @@ object ChocolateFactoryDataLoader { list.add(upgrade) } - private fun handleRabbitWarnings(item: ItemStack, slotIndex: Int) { - val isGoldenRabbit = clickMeGoldenRabbitPattern.matches(item.name) - val warningConfig = config.rabbitWarning - - if (!clickMeRabbitPattern.matches(item.name) && !isGoldenRabbit) return - if (shouldWarnAboutStray(item)) { - if (isGoldenRabbit || item.getSkullTexture() in specialRabbitTextures) { - SoundUtils.repeatSound(100, warningConfig.repeatSound, ChocolateFactoryAPI.warningSound) - } else SoundUtils.playBeepSound() - } - - ChocolateFactoryAPI.clickRabbitSlot = slotIndex - } - - private fun shouldWarnAboutStray(item: ItemStack) = when (config.rabbitWarning.rabbitWarningLevel) { - StrayTypeEntry.SPECIAL -> isSpecial(item) - - StrayTypeEntry.LEGENDARY_P -> isRarityOrHigher(item, LorenzRarity.LEGENDARY) - StrayTypeEntry.EPIC_P -> isRarityOrHigher(item, LorenzRarity.EPIC) - StrayTypeEntry.RARE_P -> isRarityOrHigher(item, LorenzRarity.RARE) - StrayTypeEntry.UNCOMMON_P -> isRarityOrHigher(item, LorenzRarity.UNCOMMON) - - StrayTypeEntry.ALL -> clickMeRabbitPattern.matches(item.name) || isSpecial(item) - - StrayTypeEntry.NONE -> false - else -> false - } - private fun findBestUpgrades(list: List) { val profileStorage = profileStorage ?: return diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryInventory.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryInventory.kt index 7ee90d1ea283..46deb6987ffd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryInventory.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryInventory.kt @@ -65,9 +65,6 @@ object ChocolateFactoryInventory { if (slotIndex == ChocolateFactoryAPI.barnIndex && ChocolateFactoryBarnManager.barnFull) { slot highlight LorenzColor.RED } - if (slotIndex == ChocolateFactoryAPI.clickRabbitSlot) { - slot highlight LorenzColor.RED - } if (slotIndex == ChocolateFactoryAPI.milestoneIndex) { unclaimedRewardsPattern.firstMatcher(slot.stack?.getLore().orEmpty()) { slot highlight LorenzColor.RED diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryScreenFlash.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryScreenFlash.kt deleted file mode 100644 index cf5e6c5d350e..000000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryScreenFlash.kt +++ /dev/null @@ -1,86 +0,0 @@ -package at.hannibal2.skyhanni.features.inventory.chocolatefactory - -import at.hannibal2.skyhanni.api.event.HandleEvent -import at.hannibal2.skyhanni.config.features.inventory.chocolatefactory.ChocolateFactoryRabbitWarningConfig.StrayTypeEntry -import at.hannibal2.skyhanni.events.GuiRenderEvent -import at.hannibal2.skyhanni.events.SecondPassedEvent -import at.hannibal2.skyhanni.events.hoppity.RabbitFoundEvent -import at.hannibal2.skyhanni.features.event.hoppity.HoppityEggType -import at.hannibal2.skyhanni.features.event.hoppity.HoppityTextureHandler -import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryAPI.specialRabbitTextures -import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryDataLoader.clickMeGoldenRabbitPattern -import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryDataLoader.clickMeRabbitPattern -import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule -import at.hannibal2.skyhanni.utils.InventoryUtils -import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture -import at.hannibal2.skyhanni.utils.ItemUtils.name -import at.hannibal2.skyhanni.utils.LorenzRarity -import at.hannibal2.skyhanni.utils.RegexUtils.matches -import at.hannibal2.skyhanni.utils.SpecialColor.toSpecialColorInt -import net.minecraft.client.Minecraft -import net.minecraft.client.gui.Gui -import net.minecraft.client.renderer.GlStateManager -import net.minecraft.inventory.Slot -import net.minecraft.item.ItemStack -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import kotlin.math.sin - -@SkyHanniModule -object ChocolateFactoryScreenFlash { - - private val config get() = ChocolateFactoryAPI.config - private var flashScreen = false - - @SubscribeEvent - fun onTick(event: SecondPassedEvent) { - if (!ChocolateFactoryAPI.inChocolateFactory) return - flashScreen = InventoryUtils.getItemsInOpenChest().any { - when (config.rabbitWarning.flashScreenLevel) { - StrayTypeEntry.SPECIAL -> isSpecial(it) - - StrayTypeEntry.LEGENDARY_P -> isRarityOrHigher(it, LorenzRarity.LEGENDARY) - StrayTypeEntry.EPIC_P -> isRarityOrHigher(it, LorenzRarity.EPIC) - StrayTypeEntry.RARE_P -> isRarityOrHigher(it, LorenzRarity.RARE) - StrayTypeEntry.UNCOMMON_P -> isRarityOrHigher(it, LorenzRarity.UNCOMMON) - - StrayTypeEntry.ALL -> { - clickMeRabbitPattern.matches(it.stack.name) || isSpecial(it) - } - - StrayTypeEntry.NONE -> false - } - } - } - - @HandleEvent - fun onRabbitFound(event: RabbitFoundEvent) { - if (event.eggType != HoppityEggType.STRAY) return - flashScreen = false - } - - fun isRarityOrHigher(stack: ItemStack, rarity: LorenzRarity) = - stack.getSkullTexture()?.let { skullTexture -> - HoppityTextureHandler.getRarityBySkullId(skullTexture)?.let { skullRarity -> - skullRarity.ordinal >= rarity.ordinal - } ?: false - } ?: false - - private fun isRarityOrHigher(slot: Slot, rarity: LorenzRarity) = - slot.stack?.let { isRarityOrHigher(it, rarity) } ?: false - - fun isSpecial(stack: ItemStack) = - clickMeGoldenRabbitPattern.matches(stack.name) || stack.getSkullTexture() in specialRabbitTextures - private fun isSpecial(slot: Slot) = - slot.stack?.let { isSpecial(it) } ?: false - - @SubscribeEvent - fun onRender(event: GuiRenderEvent.ChestGuiOverlayRenderEvent) { - if (!ChocolateFactoryAPI.inChocolateFactory) return - if (!flashScreen) return - val minecraft = Minecraft.getMinecraft() - val alpha = ((2 + sin(System.currentTimeMillis().toDouble() / 1000)) * 255 / 4).toInt().coerceIn(0..255) - val color = (alpha shl 24) or (config.rabbitWarning.flashColor.toSpecialColorInt() and 0xFFFFFF) - Gui.drawRect(0, 0, minecraft.displayWidth, minecraft.displayHeight, color) - GlStateManager.color(1F, 1F, 1F, 1F) - } -} diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayTracker.kt index 8166b5e0fc6a..22e2013f397d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayTracker.kt @@ -14,7 +14,7 @@ import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut import at.hannibal2.skyhanni.utils.CollectionUtils.sortedDesc import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.InventoryUtils -import at.hannibal2.skyhanni.utils.ItemUtils.getLore +import at.hannibal2.skyhanni.utils.ItemUtils.getSingleLineLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzRarity import at.hannibal2.skyhanni.utils.LorenzRarity.LEGENDARY @@ -156,11 +156,6 @@ object ChocolateFactoryStrayTracker { var goldenTypesCaught: MutableMap = mutableMapOf() } - fun formLoreToSingleLine(lore: List): String { - val notEmptyLines = lore.filter { it.isNotEmpty() } - return notEmptyLines.joinToString(" ") - } - private fun incrementRarity(rarity: LorenzRarity, chocAmount: Long = 0) { tracker.modify { it.straysCaught.addOrPut(rarity, 1) } val extraTime = ChocolateFactoryAPI.timeUntilNeed(chocAmount + 1) @@ -228,7 +223,7 @@ object ChocolateFactoryStrayTracker { if (!isEnabled() || claimedStraysSlots.contains(slotNumber)) return false claimedStraysSlots.add(slotNumber) - val loreLine = formLoreToSingleLine(itemStack.getLore()) + val loreLine = itemStack.getSingleLineLore() // "Base" strays - Common -> Epic, raw choc only reward. strayLorePattern.matchMatcher(loreLine) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayWarning.kt new file mode 100644 index 000000000000..08ae10160f08 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayWarning.kt @@ -0,0 +1,145 @@ +package at.hannibal2.skyhanni.features.inventory.chocolatefactory + +import at.hannibal2.skyhanni.api.event.HandleEvent +import at.hannibal2.skyhanni.config.features.inventory.chocolatefactory.ChocolateFactoryStrayRabbitWarningConfig.StrayTypeEntry +import at.hannibal2.skyhanni.events.GuiContainerEvent +import at.hannibal2.skyhanni.events.GuiRenderEvent +import at.hannibal2.skyhanni.events.InventoryCloseEvent +import at.hannibal2.skyhanni.events.InventoryUpdatedEvent +import at.hannibal2.skyhanni.events.hoppity.RabbitFoundEvent +import at.hannibal2.skyhanni.features.event.hoppity.HoppityAPI +import at.hannibal2.skyhanni.features.event.hoppity.HoppityEggType +import at.hannibal2.skyhanni.features.event.hoppity.HoppityTextureHandler +import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryAPI.caughtRabbitPattern +import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryAPI.specialRabbitTextures +import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryDataLoader.clickMeGoldenRabbitPattern +import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryDataLoader.clickMeRabbitPattern +import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule +import at.hannibal2.skyhanni.utils.InventoryUtils +import at.hannibal2.skyhanni.utils.ItemUtils.getSingleLineLore +import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture +import at.hannibal2.skyhanni.utils.ItemUtils.name +import at.hannibal2.skyhanni.utils.LorenzRarity +import at.hannibal2.skyhanni.utils.RegexUtils.matches +import at.hannibal2.skyhanni.utils.RenderUtils.highlight +import at.hannibal2.skyhanni.utils.SoundUtils +import at.hannibal2.skyhanni.utils.SpecialColor.toSpecialColor +import at.hannibal2.skyhanni.utils.SpecialColor.toSpecialColorInt +import net.minecraft.client.Minecraft +import net.minecraft.client.gui.Gui +import net.minecraft.client.renderer.GlStateManager +import net.minecraft.item.ItemStack +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.math.sin + +@SkyHanniModule +object ChocolateFactoryStrayWarning { + + private val config get() = ChocolateFactoryAPI.config + private val warningConfig get() = config.rabbitWarning + + private var flashScreen = false + private var activeStraySlots: Set = setOf() + + private fun reset() { + flashScreen = false + activeStraySlots = setOf() + } + + private fun isRarityOrHigher(stack: ItemStack, rarity: LorenzRarity) = + stack.getSkullTexture()?.let { skullTexture -> + HoppityTextureHandler.getRarityBySkullId(skullTexture)?.let { skullRarity -> + skullRarity.ordinal >= rarity.ordinal + } ?: false + } ?: false + + private fun isSpecial(stack: ItemStack) = + clickMeGoldenRabbitPattern.matches(stack.name) || stack.getSkullTexture() in specialRabbitTextures + + private fun shouldWarnAboutStray(item: ItemStack) = when (config.rabbitWarning.rabbitWarningLevel) { + StrayTypeEntry.SPECIAL -> isSpecial(item) + + StrayTypeEntry.LEGENDARY_P -> isRarityOrHigher(item, LorenzRarity.LEGENDARY) + StrayTypeEntry.EPIC_P -> isRarityOrHigher(item, LorenzRarity.EPIC) + StrayTypeEntry.RARE_P -> isRarityOrHigher(item, LorenzRarity.RARE) + StrayTypeEntry.UNCOMMON_P -> isRarityOrHigher(item, LorenzRarity.UNCOMMON) + + StrayTypeEntry.ALL -> clickMeRabbitPattern.matches(item.name) || isSpecial(item) + + StrayTypeEntry.NONE -> false + else -> false + } + + private fun handleRabbitWarnings(item: ItemStack) { + if (caughtRabbitPattern.matches(item.getSingleLineLore())) return + + val clickMeMatches = clickMeRabbitPattern.matches(item.name) + val goldenClickMeMatches = clickMeGoldenRabbitPattern.matches(item.name) + if (!clickMeMatches && !goldenClickMeMatches || !shouldWarnAboutStray(item)) return + + val isSpecial = goldenClickMeMatches || item.getSkullTexture() in specialRabbitTextures + + if (isSpecial) SoundUtils.repeatSound(100, warningConfig.repeatSound, ChocolateFactoryAPI.warningSound) + else SoundUtils.playBeepSound() + } + + @SubscribeEvent + fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) { + InventoryUtils.getItemsInOpenChest().filter { + it.slotNumber in activeStraySlots + }.forEach { + it highlight warningConfig.inventoryHighlightColor.toSpecialColor() + } + } + + @SubscribeEvent + fun onInventoryUpdate(event: InventoryUpdatedEvent) { + if (!ChocolateFactoryAPI.inChocolateFactory) { + flashScreen = false + return + } + val strayStacks = HoppityAPI.filterMayBeStray(event.inventoryItems) + strayStacks.forEach { handleRabbitWarnings(it.value) } + activeStraySlots = strayStacks.filterValues { !caughtRabbitPattern.matches(it.getSingleLineLore()) }.keys + flashScreen = strayStacks.any { + val stack = it.value + when (config.rabbitWarning.flashScreenLevel) { + StrayTypeEntry.SPECIAL -> isSpecial(stack) + + StrayTypeEntry.LEGENDARY_P -> isRarityOrHigher(stack, LorenzRarity.LEGENDARY) + StrayTypeEntry.EPIC_P -> isRarityOrHigher(stack, LorenzRarity.EPIC) + StrayTypeEntry.RARE_P -> isRarityOrHigher(stack, LorenzRarity.RARE) + StrayTypeEntry.UNCOMMON_P -> isRarityOrHigher(stack, LorenzRarity.UNCOMMON) + + StrayTypeEntry.ALL -> { + clickMeRabbitPattern.matches(it.value.name) || isSpecial(stack) + } + + StrayTypeEntry.NONE -> false + else -> false + } + } + } + + @SubscribeEvent + fun onInventoryClose(event: InventoryCloseEvent) { + reset() + } + + @HandleEvent + fun onRabbitFound(event: RabbitFoundEvent) { + if (event.eggType != HoppityEggType.STRAY) return + flashScreen = false + } + + @SubscribeEvent + fun onRender(event: GuiRenderEvent.ChestGuiOverlayRenderEvent) { + if (!ChocolateFactoryAPI.inChocolateFactory) return + if (!flashScreen) return + val minecraft = Minecraft.getMinecraft() + val alpha = ((2 + sin(System.currentTimeMillis().toDouble() / 1000)) * 255 / 4).toInt().coerceIn(0..255) + val color = (alpha shl 24) or (config.rabbitWarning.flashColor.toSpecialColorInt() and 0xFFFFFF) + Gui.drawRect(0, 0, minecraft.displayWidth, minecraft.displayHeight, color) + GlStateManager.color(1F, 1F, 1F, 1F) + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/hitman/HitmanSlots.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/hitman/HitmanSlots.kt index 825d513b51a0..77e8fccb2bfe 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/hitman/HitmanSlots.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/hitman/HitmanSlots.kt @@ -11,10 +11,10 @@ import at.hannibal2.skyhanni.events.render.gui.ReplaceItemEvent import at.hannibal2.skyhanni.features.event.hoppity.HoppityAPI.hitmanInventoryPattern import at.hannibal2.skyhanni.features.event.hoppity.HoppityEggType import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryAPI -import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryStrayTracker.formLoreToSingleLine import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.InventoryUtils.isTopInventory import at.hannibal2.skyhanni.utils.ItemUtils.getLore +import at.hannibal2.skyhanni.utils.ItemUtils.getSingleLineLore import at.hannibal2.skyhanni.utils.ItemUtils.setLore import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.RegexUtils.matches @@ -33,7 +33,7 @@ object HitmanSlots { */ private val slotOnCooldownPattern by ChocolateFactoryAPI.patternGroup.pattern( "hitman.slotoncooldown", - "§cEgg Slot" + "§cEgg Slot", ) /** @@ -41,7 +41,7 @@ object HitmanSlots { */ private val slotCostPattern by ChocolateFactoryAPI.patternGroup.pattern( "hitman.slotcost", - ".*§7Cost §6(?[\\d,]+) Coins.*" + ".*§7Cost §6(?[\\d,]+) Coins.*", ) // @@ -58,7 +58,7 @@ object HitmanSlots { val rabbitName: String, val claimedAt: SimpleTimeMark, var expiresAt: SimpleTimeMark? = null, - var claimedBySlot: Boolean = false + var claimedBySlot: Boolean = false, ) @HandleEvent @@ -122,7 +122,7 @@ object HitmanSlots { if (!inInventory) return config.hitmanCostsPosition.renderRenderable( getSlotPriceRenderable(), - posLabel = "Hitman Slot Costs" + posLabel = "Hitman Slot Costs", ) } @@ -139,7 +139,7 @@ object HitmanSlots { if (!config.hitmanCosts) return val leftToPurchase = event.inventoryItems.filterNotBorderSlots().count { (_, item) -> item.hasDisplayName() && item.getLore().isNotEmpty() && - slotCostPattern.matches(formLoreToSingleLine(item.getLore())) + slotCostPattern.matches(item.getSingleLineLore()) } val ownedSlots = ChocolateFactoryAPI.hitmanCosts.size - leftToPurchase @@ -160,8 +160,8 @@ object HitmanSlots { add( Renderable.hoverTips( "§aPurchased Slots§7: §a${slotPricesPaid.size}", - listOf("§7Total Paid: §6${slotPricesPaid.sum().addSeparators()} Coins") - ) + listOf("§7Total Paid: §6${slotPricesPaid.sum().addSeparators()} Coins"), + ), ) } @@ -178,9 +178,9 @@ object HitmanSlots { add( Renderable.hoverTips( "§cRemaining Slots§7: §c${slotPricesLeft.size}", - remainingSlotsText - ) + remainingSlotsText, + ), ) - } + }, ) } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt index 0d90542d8c29..0b86be39b195 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt @@ -53,6 +53,7 @@ object ItemUtils { fun isSack(stack: ItemStack) = stack.getInternalName().endsWith("_SACK") && stack.cleanName().endsWith(" Sack") fun ItemStack.getLore(): List = this.tagCompound.getLore() + fun ItemStack.getSingleLineLore(): String = getLore().filter { it.isNotEmpty() }.joinToString(" ") fun NBTTagCompound?.getLore(): List { this ?: return emptyList() diff --git a/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt index ff82b43e28a5..e991ebbb7562 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt @@ -75,7 +75,10 @@ object TimeUtils { val Duration.inWholeTicks: Int get() = (inWholeMilliseconds / 50).toInt() - fun getDuration(string: String) = getMillis(string.replace("m", "m ").replace(" ", " ").trim()) + private fun String.preFixDurationString() = + replace(Regex("(\\d+)([yMWwdhms])(?!\\s)"), "$1$2 ") // Add a space only after common time units + .trim() + fun getDuration(string: String) = getMillis(string.preFixDurationString()) private fun getMillis(string: String) = UtilsPatterns.timeAmountPattern.matchMatcher(string.lowercase().trim()) { val years = group("y")?.toLong() ?: 0L From a39243d8ccb449e0c2f767a56412cb4ecc0e33bf Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 13 Dec 2024 22:45:14 +0100 Subject: [PATCH 19/21] Version 0.28 Beta 19 --- docs/CHANGELOG.md | 23 +++++++++++++++++++++++ docs/FEATURES.md | 2 ++ root.gradle.kts | 2 +- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 0df4c315a506..8b465ab55260 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -24,6 +24,8 @@ + Displays slots with an active cooldown. + Added an option to show the Hoppity Event Card only while on islands where eggs spawn. - Daveed (https://github.com/hannibal002/SkyHanni/pull/2940) + Added the ability to recolor chocolate gains from duplicate rabbits when the Time Tower is active. - Daveed (https://github.com/hannibal002/SkyHanni/pull/2805) ++ Added Hitman statistics to Chocolate Factory stats. - Daveed (https://github.com/hannibal002/SkyHanni/pull/2991) + + Allows to view remaining time for full and 28 claimable slots. #### Inventory Features @@ -112,12 +114,17 @@ + Added a setting to adjust the expiration warning time. + Improved Slayer Miniboss features. - Empa (https://github.com/hannibal002/SkyHanni/pull/2081) + Added the ability to remove people from the Carry Tracker. - Empa (https://github.com/hannibal002/SkyHanni/pull/2829) ++ Added Venom Shot attacks to the Arachne chat filter. - BearySuperior (https://github.com/hannibal002/SkyHanni/pull/3032) #### Mining Improvements + Made the "You need a stronger tool to mine ..." chat filter hide every such message, not just Crystal Hollows gemstones. - Luna (https://github.com/hannibal002/SkyHanni/pull/2724) + Added an option to draw a line to your golden or diamond goblin. - Thunderblade73 (https://github.com/hannibal002/SkyHanni/pull/2717) + Added the Mining Event Display to Outside Skyblock Features. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/2947) ++ Added an option to disable sharing mining event data. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/3055) + + Improved accuracy when more users share mining event data. + + Data shared includes current event type, start, and end times. ++ Limited the "Mining Event Data can't be loaded from the server" error message to once in chat. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/3055) #### Diana Improvements @@ -162,6 +169,7 @@ + The optimal speed for Rancher's Boots is now automatically set when clicking on the wrong speed message in chat, eliminating the need to enter it manually. - Luna (https://github.com/hannibal002/SkyHanni/pull/2963) + Added an option to send the optimal speed warning even when not wearing Rancher's Boots. - Obsidian (https://github.com/hannibal002/SkyHanni/pull/2859) + Added a Pest Traps tab widget to the Tab Widget Display. - Luna (https://github.com/hannibal002/SkyHanni/pull/2984) ++ Updated Pest chat and GUI to indicate Pests Widget is disabled when displaying pests. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/3022) #### Event Improvements @@ -183,6 +191,7 @@ + You can change this option using `/sh tracker search`. + Added the Minecraft version to the mod file name. - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/2941) + Added a warning for empty messages left behind by Stash Compact. - Daveed (https://github.com/hannibal002/SkyHanni/pull/3009) ++ Added option to hide seconds in the Real Time GUI. - Obsidian (https://github.com/hannibal002/SkyHanni/pull/2979) ### Fixes @@ -217,6 +226,7 @@ + Fixed an error in the Personal Compactor Overlay. - Empa (https://github.com/hannibal002/SkyHanni/pull/2888) + Fixed AH Price Website feature not URL encoding the search. - Obsidian (https://github.com/hannibal002/SkyHanni/pull/2952) + Fixed the Fisherman Attribute abbreviation being incorrect. - Empa (https://github.com/hannibal002/SkyHanni/pull/2950) ++ Fixed background colors for UltraRareBook & Guardian Reminder. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/3050) #### Combat Fixes @@ -239,6 +249,8 @@ + Fixed Mineshaft RoomId missing in the Custom Scoreboard. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/2946) + Potentially fixed Custom Scoreboard sometimes not showing Kuudra Lines. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/3006) + Fixed a Custom Scoreboard error while waiting for the Mineshaft Queue. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/3036) ++ Fixed Custom Scoreboard errors from the new Rift update. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/3046) ++ Fixed Custom Scoreboard's player count to exclude offline players in co-ops and guest islands. - Chissl (https://github.com/hannibal002/SkyHanni/pull/3026) #### Hoppity Fixes @@ -285,6 +297,7 @@ + Fixed Anita's medal display appearing in the Visitor inventory. - Daveed (https://github.com/hannibal002/SkyHanni/pull/3007) + Specified in visitor config that Maeve's dialogue is not hidden in the "Hide Chat" option. - Chissl (https://github.com/hannibal002/SkyHanni/pull/3002) + Fixed the next visitor timer not decreasing on pest kills. - Chissl (https://github.com/hannibal002/SkyHanni/pull/3027) ++ Fixed chat error spam from Garden Composter Overlay. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/3037) #### Crimson Isle Fixes @@ -377,6 +390,8 @@ + Fixed incorrect personal best gain calculations. - Chissl (https://github.com/hannibal002/SkyHanni/pull/2996) + Fixed the `/playtimedetailed` breakdown being sorted incorrectly. - martimavocado (https://github.com/hannibal002/SkyHanni/pull/3021) + Fixed an issue where item and material stashes together would break Stash Compact. - Daveed (https://github.com/hannibal002/SkyHanni/pull/3009) ++ Fixed intermittent NEU rendering issues. - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/3053) ++ Fixed collection tracker to recognize the current collection. - nopo (https://github.com/hannibal002/SkyHanni/pull/3049) ### Technical Details @@ -480,6 +495,14 @@ + Converted some `LorenzEvents` into `SkyHanniEvents`. - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/3025) + Converted some events to `GenericSkyHanniEvent`. - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/2753) + The auto updater now searches for JAR files that include the correct Minecraft version in their names. - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/2941) ++ Changed `TimeLimitedCache` to extend `MutableMap` instead of `Iterator`. - Empa (https://github.com/hannibal002/SkyHanni/pull/2729) ++ Optimized sulphur skitter performance by caching `AxisAlignedBB` calculations and using more `LorenzVec`. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/3038) ++ Added option to send a chat message only once. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/3055) ++ Introduced "Island" widget type. - Chissl (https://github.com/hannibal002/SkyHanni/pull/3026) ++ Added more preprocessing for version 1.12. - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/3043) ++ Enhanced `InventoryUtils.clickSlot` to support click type and mode. - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/2962) ++ Relocated some events to specific sub-packages. - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/3041) ++ Converted additional `LorenzEvents` to `SkyHanniEvents`. - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/3039) ## Version 0.27 diff --git a/docs/FEATURES.md b/docs/FEATURES.md index b953355470c3..e93b6a918d2b 100644 --- a/docs/FEATURES.md +++ b/docs/FEATURES.md @@ -1044,6 +1044,8 @@ Use `/sh` or `/skyhanni` to open the SkyHanni config in game. + Displays slots with an active cooldown. + Added an option to show the Hoppity Event Card only while on islands where eggs spawn. - Daveed (https://github.com/hannibal002/SkyHanni/pull/2940) + Added the ability to recolor chocolate gains from duplicate rabbits when the Time Tower is active. - Daveed (https://github.com/hannibal002/SkyHanni/pull/2805) ++ Added Hitman statistics to Chocolate Factory stats. - Daveed (https://github.com/hannibal002/SkyHanni/pull/2991) + + Allows to view remaining time for full and 28 claimable slots. ### The Carnival diff --git a/root.gradle.kts b/root.gradle.kts index 88724beb4ac3..09341504fa6c 100644 --- a/root.gradle.kts +++ b/root.gradle.kts @@ -14,7 +14,7 @@ plugins { allprojects { group = "at.hannibal2.skyhanni" - version = "0.28.Beta.18" + version = "0.28.Beta.19" repositories { mavenCentral() mavenLocal() From c9df51273aac96a27226194354705ce8fd010985 Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Sat, 14 Dec 2024 11:32:26 +1100 Subject: [PATCH 20/21] Backend: Migrate to skyhanni events #3 (#3058) --- .../java/at/hannibal2/skyhanni/api/SkillAPI.kt | 4 ++-- .../skyhanni/api/event/SkyHanniEvents.kt | 2 +- .../skyhanni/config/ConfigUpdaterMigrator.kt | 6 +++--- .../java/at/hannibal2/skyhanni/data/BitsAPI.kt | 2 +- .../at/hannibal2/skyhanni/data/ElectionAPI.kt | 9 +++++---- .../at/hannibal2/skyhanni/data/GuiEditManager.kt | 7 ++++--- .../java/at/hannibal2/skyhanni/data/HotmData.kt | 2 +- .../at/hannibal2/skyhanni/data/HypixelData.kt | 4 ++-- .../java/at/hannibal2/skyhanni/data/MiningAPI.kt | 4 ++-- .../skyhanni/data/NotificationManager.kt | 6 +++--- .../hannibal2/skyhanni/data/ProfileStorageData.kt | 8 ++++---- .../java/at/hannibal2/skyhanni/data/RenderData.kt | 3 ++- .../java/at/hannibal2/skyhanni/data/SlayerAPI.kt | 5 +++-- .../at/hannibal2/skyhanni/data/TrackerManager.kt | 3 ++- .../skyhanni/data/bazaar/HypixelBazaarFetcher.kt | 5 +++-- .../data/hypixel/chat/PlayerNameFormatter.kt | 3 +-- .../hannibal2/skyhanni/data/mob/MobDetection.kt | 4 ++-- .../hannibal2/skyhanni/data/model/SkyblockStat.kt | 2 +- .../hannibal2/skyhanni/events/ConfigLoadEvent.kt | 4 +++- .../skyhanni/events/DebugDataCollectEvent.kt | 3 ++- .../skyhanni/events/LorenzKeyPressEvent.kt | 3 --- .../skyhanni/events/minecraft/KeyPressEvent.kt | 5 +++++ .../hannibal2/skyhanni/features/bingo/BingoAPI.kt | 5 +++-- .../skyhanni/features/bingo/MinionCraftHelper.kt | 3 ++- .../features/bingo/card/BingoCardDisplay.kt | 4 ++-- .../skyhanni/features/chat/ChatFilter.kt | 3 ++- .../skyhanni/features/chat/WatchdogHider.kt | 3 ++- .../chat/playerchat/PlayerChatModifier.kt | 3 +-- .../features/chat/translation/Translator.kt | 7 ++++--- .../skyhanni/features/chroma/ChromaManager.kt | 4 ++-- .../skyhanni/features/combat/BestiaryData.kt | 3 ++- .../skyhanni/features/combat/HideDamageSplash.kt | 3 ++- .../damageindicator/DamageIndicatorManager.kt | 2 +- .../combat/endernodetracker/EnderNodeTracker.kt | 4 ++-- .../features/combat/ghosttracker/GhostTracker.kt | 4 ++-- .../skyhanni/features/commands/PartyCommands.kt | 2 +- .../skyhanni/features/commands/WikiManager.kt | 3 +-- .../commands/tabcomplete/PlayerTabComplete.kt | 3 ++- .../features/cosmetics/CosmeticFollowingLine.kt | 3 ++- .../skyhanni/features/dungeon/DungeonAPI.kt | 4 ++-- .../skyhanni/features/dungeon/DungeonCleanEnd.kt | 2 +- .../skyhanni/features/dungeon/DungeonCopilot.kt | 2 +- .../features/dungeon/DungeonFinderFeatures.kt | 2 +- .../skyhanni/features/dungeon/DungeonHideItems.kt | 2 +- .../dungeon/DungeonHighlightClickedBlocks.kt | 2 +- .../features/dungeon/DungeonMobManager.kt | 3 ++- .../features/dungeon/DungeonsRaceGuide.kt | 2 +- .../features/event/diana/BurrowWarpHelper.kt | 11 ++++++----- .../features/event/diana/GriffinBurrowHelper.kt | 6 +++--- .../event/diana/GriffinBurrowParticleFinder.kt | 4 ++-- .../event/diana/InquisitorWaypointShare.kt | 6 +++--- .../event/diana/MythologicalCreatureTracker.kt | 3 ++- .../features/event/hoppity/HoppityCallWarning.kt | 8 ++++---- .../event/hoppity/HoppityCollectionStats.kt | 2 +- .../features/event/hoppity/HoppityEggLocator.kt | 4 ++-- .../features/event/hoppity/HoppityEggsManager.kt | 2 +- .../features/event/hoppity/HoppityEventSummary.kt | 10 +++++----- .../jerry/frozentreasure/FrozenTreasureTracker.kt | 3 ++- .../lobby/waypoints/halloween/BasketWaypoints.kt | 4 ++-- .../features/event/spook/TheGreatSpook.kt | 4 ++-- .../skyhanni/features/fame/CityProjectFeatures.kt | 3 ++- .../skyhanni/features/fame/UpgradeReminder.kt | 3 ++- .../skyhanni/features/fishing/ChumBucketHider.kt | 2 +- .../skyhanni/features/fishing/FishingTimer.kt | 10 +++++----- .../skyhanni/features/fishing/LavaReplacement.kt | 5 ++--- .../features/fishing/SeaCreatureFeatures.kt | 2 +- .../features/fishing/ThunderSparksHighlight.kt | 3 ++- .../features/fishing/TotemOfCorruption.kt | 3 ++- .../fishing/tracker/SeaCreatureTracker.kt | 2 +- .../features/fishing/trophy/GoldenFishTimer.kt | 4 ++-- .../features/fishing/trophy/OdgerWaypoint.kt | 3 ++- .../features/fishing/trophy/TrophyFishDisplay.kt | 4 ++-- .../features/fishing/trophy/TrophyFishFillet.kt | 3 ++- .../features/fishing/trophy/TrophyFishMessages.kt | 3 ++- .../skyhanni/features/garden/AnitaMedalProfit.kt | 3 ++- .../features/garden/FarmingFortuneDisplay.kt | 2 +- .../skyhanni/features/garden/GardenAPI.kt | 2 +- .../features/garden/GardenLevelDisplay.kt | 4 ++-- .../features/garden/GardenNextJacobContest.kt | 8 ++++---- .../features/garden/GardenOptimalSpeed.kt | 4 ++-- .../skyhanni/features/garden/GardenPlotBorders.kt | 7 ++++--- .../features/garden/GardenWarpCommands.kt | 7 +++---- .../skyhanni/features/garden/GardenYawAndPitch.kt | 2 +- .../features/garden/SensitivityReducer.kt | 6 +++--- .../skyhanni/features/garden/ToolTooltipTweaks.kt | 3 ++- .../features/garden/composter/ComposterDisplay.kt | 2 +- .../garden/composter/ComposterInventoryNumbers.kt | 3 +-- .../features/garden/composter/ComposterOverlay.kt | 6 +++--- .../composter/GardenComposterInventoryFeatures.kt | 3 ++- .../garden/contest/FarmingPersonalBestGain.kt | 3 ++- .../contest/JacobFarmingContestsInventory.kt | 2 +- .../features/garden/farming/ArmorDropTracker.kt | 2 +- .../features/garden/farming/CropMoneyDisplay.kt | 2 +- .../garden/farming/DicerRngDropTracker.kt | 4 ++-- .../garden/farming/FarmingWeightDisplay.kt | 2 +- .../features/garden/farming/GardenBestCropTime.kt | 4 ++-- .../garden/farming/GardenCropMilestoneDisplay.kt | 4 ++-- .../features/garden/farming/GardenCropSpeed.kt | 2 +- .../garden/farming/GardenCustomKeybinds.kt | 5 +++-- .../garden/fortuneguide/CaptureFarmingGear.kt | 4 ++-- .../garden/inventory/AnitaExtraFarmingFortune.kt | 3 ++- .../inventory/GardenCropMilestoneInventory.kt | 2 +- .../garden/inventory/GardenInventoryNumbers.kt | 3 +-- .../garden/inventory/SkyMartCopperPrice.kt | 3 ++- .../skyhanni/features/garden/pests/PestAPI.kt | 4 ++-- .../skyhanni/features/garden/pests/PestFinder.kt | 6 +++--- .../skyhanni/features/garden/pests/PestSpawn.kt | 3 ++- .../features/garden/pests/StereoHarmonyDisplay.kt | 3 ++- .../garden/visitor/GardenVisitorDropStatistics.kt | 4 ++-- .../garden/visitor/GardenVisitorFeatures.kt | 6 +++--- .../features/garden/visitor/GardenVisitorTimer.kt | 2 +- .../gui/customscoreboard/CustomScoreboard.kt | 6 +++--- .../customscoreboard/CustomScoreboardConfigFix.kt | 4 ++-- .../skyhanni/features/gui/quiver/QuiverDisplay.kt | 2 +- .../skyhanni/features/gui/quiver/QuiverWarning.kt | 2 +- .../features/inventory/AuctionsHighlighter.kt | 3 ++- .../skyhanni/features/inventory/ChestValue.kt | 3 ++- .../skyhanni/features/inventory/HarpFeatures.kt | 2 +- .../features/inventory/HideNotClickableItems.kt | 3 ++- .../features/inventory/HighlightBonzoMasks.kt | 3 ++- .../inventory/ItemDisplayOverlayFeatures.kt | 3 +-- .../features/inventory/RngMeterInventory.kt | 2 +- .../skyhanni/features/inventory/SackDisplay.kt | 3 ++- .../skyhanni/features/inventory/StatsTuning.kt | 2 +- .../auctionhouse/AuctionHouseCopyUnderbidPrice.kt | 2 +- .../features/inventory/bazaar/BazaarApi.kt | 3 ++- .../features/inventory/caketracker/CakeTracker.kt | 2 +- .../chocolatefactory/ChocolateFactoryAPI.kt | 3 ++- .../ChocolateFactoryDataLoader.kt | 5 +++-- .../chocolatefactory/ChocolateFactoryStats.kt | 3 ++- .../ChocolateFactoryStrayTracker.kt | 2 +- .../experimentationtable/GuardianReminder.kt | 3 ++- .../experimentationtable/SuperpairsClicksAlert.kt | 3 ++- .../experimentationtable/UltraRareBookAlert.kt | 3 ++- .../features/inventory/tiarelay/TiaRelayHelper.kt | 2 +- .../features/inventory/wardrobe/CustomWardrobe.kt | 5 +++-- .../inventory/wardrobe/EstimatedWardrobePrice.kt | 3 ++- .../features/inventory/wardrobe/WardrobeAPI.kt | 5 +++-- .../features/itemabilities/ChickenHeadTimer.kt | 3 ++- .../itemabilities/FireVeilWandParticles.kt | 2 +- .../abilitycooldown/ItemAbilityCooldown.kt | 2 +- .../skyhanni/features/mining/DeepCavernsGuide.kt | 4 ++-- .../mining/HighlightMiningCommissionMobs.kt | 2 +- .../mining/MiningCommissionsBlocksColor.kt | 8 ++++---- .../features/mining/MiningNotifications.kt | 2 +- .../skyhanni/features/mining/TunnelsMaps.kt | 12 ++++++------ .../mining/eventtracker/MiningEventDisplay.kt | 3 ++- .../mining/eventtracker/MiningEventTracker.kt | 2 +- .../fossilexcavator/solver/FossilSolverDisplay.kt | 2 +- .../mining/glacitemineshaft/MineshaftWaypoints.kt | 6 +++--- .../mining/powdertracker/PowderTracker.kt | 4 ++-- .../skyhanni/features/minion/MinionFeatures.kt | 2 +- .../features/misc/AuctionHousePriceComparison.kt | 3 ++- .../skyhanni/features/misc/BetterSignEditing.kt | 3 ++- .../skyhanni/features/misc/BetterWikiFromMenus.kt | 3 ++- .../skyhanni/features/misc/ButtonOnPause.kt | 3 ++- .../skyhanni/features/misc/CustomTextBox.kt | 5 +++-- .../hannibal2/skyhanni/features/misc/HideArmor.kt | 3 ++- .../skyhanni/features/misc/IslandAreas.kt | 2 +- .../skyhanni/features/misc/LockMouseLook.kt | 5 +++-- .../skyhanni/features/misc/MarkedPlayerManager.kt | 5 +++-- .../skyhanni/features/misc/MiscFeatures.kt | 3 ++- .../skyhanni/features/misc/NoBitsWarning.kt | 3 +-- .../features/misc/NonGodPotEffectDisplay.kt | 2 +- .../skyhanni/features/misc/ParticleHider.kt | 3 ++- .../features/misc/PatcherSendCoordinates.kt | 3 ++- .../features/misc/PocketSackInASackDisplay.kt | 2 +- .../skyhanni/features/misc/QuickModMenuSwitch.kt | 3 ++- .../skyhanni/features/misc/TimeFeatures.kt | 3 ++- .../skyhanni/features/misc/TpsCounter.kt | 2 +- .../misc/compacttablist/AdvancedPlayerList.kt | 4 ++-- .../features/misc/compacttablist/TabListReader.kt | 3 +-- .../misc/compacttablist/TabListRenderer.kt | 2 +- .../features/misc/discordrpc/DiscordRPCManager.kt | 10 +++++----- .../features/misc/items/EstimatedItemValue.kt | 4 ++-- .../features/misc/items/enchants/EnchantParser.kt | 2 +- .../features/misc/limbo/LimboTimeTracker.kt | 6 +++--- .../features/misc/pets/CurrentPetDisplay.kt | 3 ++- .../features/misc/pets/PetCandyUsedDisplay.kt | 3 +-- .../skyhanni/features/misc/pets/PetExpTooltip.kt | 3 ++- .../features/misc/trevor/TrevorFeatures.kt | 8 ++++---- .../features/misc/update/UpdateManager.kt | 3 ++- .../nether/CrimsonMinibossRespawnTimer.kt | 3 ++- .../skyhanni/features/nether/SulphurSkitterBox.kt | 3 ++- .../nether/ashfang/AshfangFreezeCooldown.kt | 3 ++- .../features/nether/ashfang/AshfangHider.kt | 2 +- .../features/nether/ashfang/AshfangHighlights.kt | 2 +- .../features/nether/ashfang/AshfangManager.kt | 3 ++- .../nether/ashfang/AshfangNextResetCooldown.kt | 3 ++- .../CrimsonIsleReputationHelper.kt | 15 ++++++--------- .../dailyquest/DailyQuestHelper.kt | 2 +- .../rift/area/colosseum/BlobbercystsHighlight.kt | 3 ++- .../rift/area/dreadfarm/RiftAgaricusCap.kt | 2 +- .../area/dreadfarm/RiftWiltedBerberisHelper.kt | 2 +- .../area/livingcave/LivingCaveDefenseBlocks.kt | 2 +- .../rift/area/mirrorverse/DanceRoomHelper.kt | 2 +- .../rift/area/mirrorverse/RiftLavaMazeParkour.kt | 2 +- .../area/mirrorverse/RiftUpsideDownParkour.kt | 2 +- .../rift/area/mirrorverse/TubulatorParkour.kt | 2 +- .../area/stillgorechateau/RiftBloodEffigies.kt | 6 +++--- .../rift/area/westvillage/RiftGunthersRace.kt | 2 +- .../rift/area/westvillage/VerminHighlighter.kt | 3 ++- .../rift/area/westvillage/kloon/KloonHacking.kt | 3 ++- .../rift/area/wyldwoods/ShyCruxWarnings.kt | 3 ++- .../rift/everywhere/CruxTalismanDisplay.kt | 3 ++- .../rift/everywhere/PunchcardHighlight.kt | 4 ++-- .../features/rift/everywhere/RiftTimer.kt | 2 +- .../rift/everywhere/motes/RiftMotesOrb.kt | 3 ++- .../everywhere/motes/ShowMotesNpcSellPrice.kt | 3 ++- .../features/skillprogress/SkillProgress.kt | 2 +- .../features/slayer/SlayerProfitTracker.kt | 2 +- .../features/slayer/VampireSlayerFeatures.kt | 2 +- .../features/slayer/blaze/BlazeSlayerClearView.kt | 2 +- .../slayer/blaze/BlazeSlayerDaggerHelper.kt | 2 +- .../slayer/blaze/BlazeSlayerFirePitsWarning.kt | 2 +- .../features/slayer/blaze/HellionShieldHelper.kt | 3 ++- .../slayer/enderman/EndermanSlayerFeatures.kt | 2 +- .../enderman/EndermanSlayerHideParticles.kt | 3 ++- .../features/stranded/HighlightPlaceableNpcs.kt | 3 ++- .../features/summonings/SummoningMobManager.kt | 3 ++- .../at/hannibal2/skyhanni/test/DebugCommand.kt | 2 +- .../skyhanni/test/HighlightMissingRepoItems.kt | 3 ++- .../skyhanni/test/ParkourWaypointSaver.kt | 7 ++++--- .../at/hannibal2/skyhanni/test/ShowItemUuid.kt | 3 ++- .../skyhanni/test/SkyHanniDebugsAndTests.kt | 2 +- .../skyhanni/test/TestCopyBestiaryValues.kt | 3 ++- .../skyhanni/test/TestCopyRngMeterValues.kt | 3 ++- .../at/hannibal2/skyhanni/test/TestExportTools.kt | 3 +-- .../hannibal2/skyhanni/utils/ComputerEnvDebug.kt | 6 +++--- .../skyhanni/utils/ComputerTimeOffset.kt | 5 ++--- .../java/at/hannibal2/skyhanni/utils/ItemUtils.kt | 6 +++--- .../hannibal2/skyhanni/utils/KeyboardManager.kt | 10 +++++----- .../skyhanni/utils/MinecraftConsoleFilter.kt | 4 ++-- .../utils/repopatterns/RepoPatternManager.kt | 2 +- 234 files changed, 458 insertions(+), 379 deletions(-) delete mode 100644 src/main/java/at/hannibal2/skyhanni/events/LorenzKeyPressEvent.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/events/minecraft/KeyPressEvent.kt diff --git a/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt index 34a394d9dfa1..887b3e1144b2 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt @@ -215,8 +215,8 @@ object SkillAPI { } } - @SubscribeEvent - fun onDebugDataCollect(event: DebugDataCollectEvent) { + @HandleEvent + fun onDebug(event: DebugDataCollectEvent) { event.title("Skills") val storage = storage if (storage == null) { diff --git a/src/main/java/at/hannibal2/skyhanni/api/event/SkyHanniEvents.kt b/src/main/java/at/hannibal2/skyhanni/api/event/SkyHanniEvents.kt index 97fcbf3c6f62..dd7d60f3c9c1 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/event/SkyHanniEvents.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/event/SkyHanniEvents.kt @@ -53,7 +53,7 @@ object SkyHanniEvents { disabledHandlerInvokers = data.disabledInvokers } - @SubscribeEvent + @HandleEvent fun onDebug(event: DebugDataCollectEvent) { event.title("Events") event.addIrrelevant { diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt index adbd98073ba3..69ed7f8d8ca2 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt @@ -1,6 +1,6 @@ package at.hannibal2.skyhanni.config -import at.hannibal2.skyhanni.events.LorenzEvent +import at.hannibal2.skyhanni.api.event.SkyHanniEvent import at.hannibal2.skyhanni.features.misc.limbo.LimboTimeTracker import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils.asIntOrNull @@ -30,7 +30,7 @@ object ConfigUpdaterMigrator { val oldVersion: Int, var movesPerformed: Int, val dynamicPrefix: Map>, - ) : LorenzEvent() { + ) : SkyHanniEvent() { init { dynamicPrefix.entries @@ -141,7 +141,7 @@ object ConfigUpdaterMigrator { it.add("lastVersion", JsonPrimitive(i + 1)) }, i, 0, dynamicPrefix - ).also { it.postAndCatch() } + ).also { it.post() } logger.log("Transformations scheduled: ${migration.new}") val mergesPerformed = merge(migration.old, migration.new) logger.log("Migration done with $mergesPerformed merges and ${migration.movesPerformed} moves performed") diff --git a/src/main/java/at/hannibal2/skyhanni/data/BitsAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/BitsAPI.kt index 06f28d89ce28..1fec9965be8b 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/BitsAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/BitsAPI.kt @@ -391,7 +391,7 @@ object BitsAPI { fun isEnabled() = LorenzUtils.inSkyBlock && !LorenzUtils.isOnAlphaServer && profileStorage != null - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(35, "#profile.bits.bitsToClaim", "#profile.bits.bitsAvailable") } diff --git a/src/main/java/at/hannibal2/skyhanni/data/ElectionAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/ElectionAPI.kt index baedbd16cee5..e61d03af83d9 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ElectionAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ElectionAPI.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.data.ElectionCandidate.Companion.getMayorFromPerk import at.hannibal2.skyhanni.data.ElectionCandidate.Companion.setAssumeMayorJson @@ -242,8 +243,8 @@ object ElectionAPI { private fun List.bestCandidate() = maxBy { it.votes } - @SubscribeEvent - fun onConfigReload(event: ConfigLoadEvent) { + @HandleEvent + fun onConfigLoad(event: ConfigLoadEvent) { val config = SkyHanniMod.feature.dev.debug.assumeMayor config.onToggle { val mayor = config.get() @@ -257,8 +258,8 @@ object ElectionAPI { } } - @SubscribeEvent - fun onDebugDataCollect(event: DebugDataCollectEvent) { + @HandleEvent + fun onDebug(event: DebugDataCollectEvent) { event.title("Mayor") event.addIrrelevant { add("Current Mayor: ${currentMayor?.name ?: "Unknown"}") diff --git a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt index dbcd84af3ff1..ce611b7e2799 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt @@ -1,12 +1,13 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.core.config.Position import at.hannibal2.skyhanni.config.core.config.gui.GuiPositionEditor import at.hannibal2.skyhanni.events.GuiPositionMovedEvent import at.hannibal2.skyhanni.events.GuiRenderEvent -import at.hannibal2.skyhanni.events.LorenzKeyPressEvent import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.events.minecraft.KeyPressEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.test.SkyHanniDebugsAndTests import at.hannibal2.skyhanni.utils.ChatUtils @@ -38,8 +39,8 @@ object GuiEditManager { private val currentBorderSize = mutableMapOf>() private var lastMovedGui: String? = null - @SubscribeEvent - fun onKeyClick(event: LorenzKeyPressEvent) { + @HandleEvent + fun onKeyPress(event: KeyPressEvent) { if (event.keyCode != SkyHanniMod.feature.gui.keyBindOpen) return if (event.keyCode == Keyboard.KEY_RETURN) { ChatUtils.chat("You can't use Enter as a keybind to open the gui editor!") diff --git a/src/main/java/at/hannibal2/skyhanni/data/HotmData.kt b/src/main/java/at/hannibal2/skyhanni/data/HotmData.kt index a87255a6b5ab..39bc5b948665 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HotmData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HotmData.kt @@ -800,7 +800,7 @@ enum class HotmData( } } - @SubscribeEvent + @HandleEvent fun onDebug(event: DebugDataCollectEvent) { event.title("HotM") event.addIrrelevant { diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt index 1cfb6b9e6436..9214bf7ec5cf 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt @@ -229,8 +229,8 @@ object HypixelData { ) } - @SubscribeEvent - fun onDebugDataCollect(event: DebugDataCollectEvent) { + @HandleEvent + fun onDebug(event: DebugDataCollectEvent) { event.title("Server ID") if (!LorenzUtils.inSkyBlock) { event.addIrrelevant("not in sb") diff --git a/src/main/java/at/hannibal2/skyhanni/data/MiningAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/MiningAPI.kt index 1b4f36b22f3e..7f04a2952b95 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/MiningAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/MiningAPI.kt @@ -436,8 +436,8 @@ object MiningAPI { pickobulusWaitingForBlock = false } - @SubscribeEvent - fun onDebugDataCollect(event: DebugDataCollectEvent) { + @HandleEvent + fun onDebug(event: DebugDataCollectEvent) { event.title("Mining API") if (!inCustomMiningIsland()) { event.addIrrelevant("not in a mining island") diff --git a/src/main/java/at/hannibal2/skyhanni/data/NotificationManager.kt b/src/main/java/at/hannibal2/skyhanni/data/NotificationManager.kt index 748e46892865..301215e58169 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/NotificationManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/NotificationManager.kt @@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.commands.CommandCategory import at.hannibal2.skyhanni.config.commands.CommandRegistrationEvent import at.hannibal2.skyhanni.events.GuiRenderEvent -import at.hannibal2.skyhanni.events.LorenzKeyPressEvent +import at.hannibal2.skyhanni.events.minecraft.KeyPressEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.GuiRenderUtils import at.hannibal2.skyhanni.utils.InventoryUtils @@ -28,8 +28,8 @@ object NotificationManager { private const val CLOSE_TEXT = "§c[X] Close" - @SubscribeEvent - fun onKeyClick(event: LorenzKeyPressEvent) { + @HandleEvent + fun onKeyPress(event: KeyPressEvent) { currentNotification ?: return if (lastNotificationClosed.passedSince() < 200.milliseconds) return if (event.keyCode != Keyboard.KEY_X) return diff --git a/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt b/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt index 4c6a74be92d4..770dcd15eaee 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt @@ -51,7 +51,7 @@ object ProfileStorageData { } loadProfileSpecific(playerSpecific, sackPlayers, profileName) - ConfigLoadEvent().postAndCatch() + ConfigLoadEvent.post() } private fun workaroundIn10SecondsProfileStorage(profileName: String) { @@ -72,7 +72,7 @@ object ProfileStorageData { ErrorManager.skyHanniError("sackPlayers is null in ProfileJoinEvent!") } loadProfileSpecific(playerSpecific, sackPlayers, profileName) - ConfigLoadEvent().postAndCatch() + ConfigLoadEvent.post() } @HandleEvent @@ -122,7 +122,7 @@ object ProfileStorageData { profileSpecific = playerSpecific.profiles.getOrPut(profileName) { ProfileSpecificStorage() } sackProfiles = sackProfile.profiles.getOrPut(profileName) { SackData.ProfileSpecific() } loaded = true - ConfigLoadEvent().postAndCatch() + ConfigLoadEvent.post() } @HandleEvent @@ -130,7 +130,7 @@ object ProfileStorageData { val playerUuid = LorenzUtils.getRawPlayerUuid() playerSpecific = SkyHanniMod.feature.storage.players.getOrPut(playerUuid) { PlayerSpecificStorage() } sackPlayers = SkyHanniMod.sackData.players.getOrPut(playerUuid) { SackData.PlayerSpecific() } - ConfigLoadEvent().postAndCatch() + ConfigLoadEvent.post() } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt b/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt index 0aae783575b8..e8671efafe4d 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.data +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.chroma.ChromaConfig import at.hannibal2.skyhanni.events.GuiRenderEvent @@ -63,7 +64,7 @@ object RenderData { } // TODO find better spot for this - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.transform(17, "chroma.chromaDirection") { element -> ConfigUtils.migrateIntToEnum(element, ChromaConfig.Direction::class.java) diff --git a/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt index 168ac433add0..e9f0d2a8e115 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.data +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.DebugDataCollectEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent @@ -57,8 +58,8 @@ object SlayerAPI { } } - @SubscribeEvent - fun onDebugDataCollect(event: DebugDataCollectEvent) { + @HandleEvent + fun onDebug(event: DebugDataCollectEvent) { event.title("Slayer") if (!hasActiveSlayerQuest()) { diff --git a/src/main/java/at/hannibal2/skyhanni/data/TrackerManager.kt b/src/main/java/at/hannibal2/skyhanni/data/TrackerManager.kt index f2bce67b3617..fd46495cf347 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/TrackerManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/TrackerManager.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.ItemAddEvent @@ -19,7 +20,7 @@ object TrackerManager { var dirty = false var commandEditTrackerSuccess = false - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { val config = SkyHanniMod.feature.misc.tracker.hideCheapItems ConditionalUtils.onToggle(config.alwaysShowBest, config.minPrice, config.enabled) { diff --git a/src/main/java/at/hannibal2/skyhanni/data/bazaar/HypixelBazaarFetcher.kt b/src/main/java/at/hannibal2/skyhanni/data/bazaar/HypixelBazaarFetcher.kt index 06f84343411c..54648c445ac7 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/bazaar/HypixelBazaarFetcher.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/bazaar/HypixelBazaarFetcher.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.data.bazaar import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.events.DebugDataCollectEvent import at.hannibal2.skyhanni.events.LorenzTickEvent @@ -35,8 +36,8 @@ object HypixelBazaarFetcher { private var failedAttempts = 0 private var nextFetchIsManual = false - @SubscribeEvent - fun onDebugDataCollect(event: DebugDataCollectEvent) { + @HandleEvent + fun onDebug(event: DebugDataCollectEvent) { event.title("Bazaar Data Fetcher from API") val data = listOf( diff --git a/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerNameFormatter.kt b/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerNameFormatter.kt index e7d83a1bddf1..175e1502b2ad 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerNameFormatter.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerNameFormatter.kt @@ -35,7 +35,6 @@ import net.minecraft.client.gui.FontRenderer import net.minecraft.util.ChatComponentText import net.minecraft.util.EnumChatFormatting import net.minecraft.util.IChatComponent -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent /** * Listening to the player chat events, and applying custom chat options to them. @@ -280,7 +279,7 @@ object PlayerNameFormatter { fun isEnabled() = LorenzUtils.inSkyBlock && config.enable - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.transform(41, "chat.PlayerMessagesConfig.partsOrder") { element -> val newList = JsonArray() diff --git a/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt b/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt index 2a0300ad19ae..5619c8773602 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt @@ -377,8 +377,8 @@ object MobDetection { shouldClear.set(true) } - @SubscribeEvent - fun onDebugDataCollect(event: DebugDataCollectEvent) { + @HandleEvent + fun onDebug(event: DebugDataCollectEvent) { event.title("Mob Detection") if (forceReset) { event.addData("Mob Detection is manually disabled!") diff --git a/src/main/java/at/hannibal2/skyhanni/data/model/SkyblockStat.kt b/src/main/java/at/hannibal2/skyhanni/data/model/SkyblockStat.kt index 9ca7dc9ce6cf..999d21c10a30 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/model/SkyblockStat.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/model/SkyblockStat.kt @@ -174,7 +174,7 @@ enum class SkyblockStat( } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(69, "#profile.stats.TRUE_DEFENCE", "#profile.stats.TRUE_DEFENSE") } diff --git a/src/main/java/at/hannibal2/skyhanni/events/ConfigLoadEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/ConfigLoadEvent.kt index 4f1efeb9c246..72d0db796d68 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/ConfigLoadEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/ConfigLoadEvent.kt @@ -1,3 +1,5 @@ package at.hannibal2.skyhanni.events -class ConfigLoadEvent : LorenzEvent() +import at.hannibal2.skyhanni.api.event.SkyHanniEvent + +object ConfigLoadEvent : SkyHanniEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/DebugDataCollectEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/DebugDataCollectEvent.kt index 3b8a884a9e8f..011fbfb11bdd 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/DebugDataCollectEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/DebugDataCollectEvent.kt @@ -1,8 +1,9 @@ package at.hannibal2.skyhanni.events +import at.hannibal2.skyhanni.api.event.SkyHanniEvent import at.hannibal2.skyhanni.utils.StringUtils.equalsIgnoreColor -class DebugDataCollectEvent(private val list: MutableList, private val search: String) : LorenzEvent() { +class DebugDataCollectEvent(private val list: MutableList, private val search: String) : SkyHanniEvent() { var empty = true private var currentTitle = "" diff --git a/src/main/java/at/hannibal2/skyhanni/events/LorenzKeyPressEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/LorenzKeyPressEvent.kt deleted file mode 100644 index e5af23d22ab6..000000000000 --- a/src/main/java/at/hannibal2/skyhanni/events/LorenzKeyPressEvent.kt +++ /dev/null @@ -1,3 +0,0 @@ -package at.hannibal2.skyhanni.events - -class LorenzKeyPressEvent(val keyCode: Int) : LorenzEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/minecraft/KeyPressEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/minecraft/KeyPressEvent.kt new file mode 100644 index 000000000000..fd13d45365b4 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/events/minecraft/KeyPressEvent.kt @@ -0,0 +1,5 @@ +package at.hannibal2.skyhanni.events.minecraft + +import at.hannibal2.skyhanni.api.event.SkyHanniEvent + +class KeyPressEvent(val keyCode: Int) : SkyHanniEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt index b4ba01d58f0a..06a6745082ab 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.bingo +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.storage.PlayerSpecificStorage.BingoSession import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.data.jsonobjects.repo.BingoData @@ -36,8 +37,8 @@ object BingoAPI { " §.Ⓑ §.Bingo" ) - @SubscribeEvent - fun onDebugDataCollect(event: DebugDataCollectEvent) { + @HandleEvent + fun onDebug(event: DebugDataCollectEvent) { event.title("Bingo Card") if (!LorenzUtils.isBingoProfile) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt index ae7d98e5569b..05ab00ed1cc7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.bingo import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent @@ -276,7 +277,7 @@ object MinionCraftHelper { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.transform(26, "#player.bingoSessions") { element -> for ((_, data) in element.asJsonObject.entrySet()) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt index b04133b2abcc..470ca328b8c0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt @@ -256,14 +256,14 @@ object BingoCardDisplay { update() } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { config.hideCommunityGoals.onToggle { update() } config.nextTipDuration.onToggle { update() } update() } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "bingo", "event.bingo") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt index 9bfc80f4a0ab..6f596c20fa26 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.chat import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.HypixelData import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -628,7 +629,7 @@ object ChatFilter { (messagesContainsMap[key].orEmpty()).any { this.contains(it) } || (messagesStartsWithMap[key].orEmpty()).any { this.startsWith(it) } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "chat.hypixelHub", "chat.filterType.hypixelHub") event.move(3, "chat.empty", "chat.filterType.empty") diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt index 6e1b005040ee..44fc2db2b78a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.chat import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.ChatManager import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -52,7 +53,7 @@ object WatchdogHider { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "chat.watchDog", "chat.filterType.watchDog") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt index facd5efb70f6..6eb968c80606 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt @@ -10,7 +10,6 @@ import at.hannibal2.skyhanni.utils.StringUtils.applyIfPossible import net.minecraft.event.ClickEvent import net.minecraft.event.HoverEvent import net.minecraft.util.IChatComponent -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule object PlayerChatModifier { @@ -64,7 +63,7 @@ object PlayerChatModifier { return string } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "chat.playerRankHider", "chat.playerMessage.playerRankHider") event.move(3, "chat.chatFilter", "chat.playerMessage.chatFilter") diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/translation/Translator.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/translation/Translator.kt index ae2962da9727..0eece4eeebf5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/translation/Translator.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/translation/Translator.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.chat.translation import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.SkyHanniMod.Companion.coroutineScope +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -49,15 +50,15 @@ object Translator { editedComponent.setChatStyle(clickStyle) } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(55, "chat.translator", "chat.translator.translateOnClick") } var lastUserChange = SimpleTimeMark.farPast() - @SubscribeEvent - fun onConfigReload(event: ConfigLoadEvent) { + @HandleEvent + fun onConfigLoad(event: ConfigLoadEvent) { config.languageCode.onToggle { if (lastUserChange.passedSince() < 50.milliseconds) return@onToggle lastUserChange = SimpleTimeMark.now() diff --git a/src/main/java/at/hannibal2/skyhanni/features/chroma/ChromaManager.kt b/src/main/java/at/hannibal2/skyhanni/features/chroma/ChromaManager.kt index 052cea4e45f6..188b3edef0f2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chroma/ChromaManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chroma/ChromaManager.kt @@ -1,10 +1,10 @@ package at.hannibal2.skyhanni.features.chroma import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.chroma.ChromaConfig import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule object ChromaManager { @@ -23,7 +23,7 @@ object ChromaManager { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(31, "chroma", "gui.chroma") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt index 660c2f303960..512a994d2c71 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.combat import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.combat.BestiaryConfig import at.hannibal2.skyhanni.config.features.combat.BestiaryConfig.DisplayTypeEntry @@ -140,7 +141,7 @@ object BestiaryData { inInventory = false } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "misc.bestiaryData", "combat.bestiary") diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/HideDamageSplash.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/HideDamageSplash.kt index 215d4a0a3897..ef78e8f5ab5d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/HideDamageSplash.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/HideDamageSplash.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.combat import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.SkyHanniRenderEntityEvent import at.hannibal2.skyhanni.features.combat.damageindicator.DamageIndicatorManager @@ -23,7 +24,7 @@ object HideDamageSplash { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "misc.hideDamageSplash", "combat.hideDamageSplash") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt index 1ff880e3e15b..19c5933f9f1a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt @@ -909,7 +909,7 @@ object DamageIndicatorManager { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "damageIndicator", "combat.damageIndicator") event.move(3, "slayer.endermanPhaseDisplay", "slayer.endermen.phaseDisplay") diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt index 7c1ec18e679a..29ee260c9c9a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt @@ -182,7 +182,7 @@ object EnderNodeTracker { tracker.renderDisplay(config.position) } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { config.textFormat.afterChange { tracker.update() @@ -190,7 +190,7 @@ object EnderNodeTracker { tracker.update() } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "misc.enderNodeTracker", "combat.enderNodeTracker") event.transform(11, "combat.enderNodeTracker.textFormat") { element -> diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/ghosttracker/GhostTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/ghosttracker/GhostTracker.kt index fefa68f3536d..1daea5869717 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/ghosttracker/GhostTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/ghosttracker/GhostTracker.kt @@ -349,7 +349,7 @@ object GhostTracker { override fun toString(): String = display } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { val storage = storage ?: return if (storage.migratedTotalKills) return @@ -368,7 +368,7 @@ object GhostTracker { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { fun migrateItem(oldData: JsonElement): JsonElement { diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/PartyCommands.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/PartyCommands.kt index b0c29fdcbfa7..0010718e8455 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/PartyCommands.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/PartyCommands.kt @@ -117,7 +117,7 @@ object PartyCommands { return null } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(5, "commands.usePartyTransferAlias", "commands.shortCommands") diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt index 6eb0da01119c..f3bbf3ddcda0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt @@ -14,7 +14,6 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraft.item.ItemStack -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.net.URLEncoder @SkyHanniModule @@ -26,7 +25,7 @@ object WikiManager { private val config get() = SkyHanniMod.feature.misc.commands.betterWiki - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(6, "commands.useFandomWiki", "commands.fandomWiki.enabled") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/PlayerTabComplete.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/PlayerTabComplete.kt index 693c2615976f..4ca43c59b628 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/PlayerTabComplete.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/PlayerTabComplete.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.commands.tabcomplete import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.FriendAPI import at.hannibal2.skyhanni.data.GuildAPI @@ -110,7 +111,7 @@ object PlayerTabComplete { vipVisits = data.vipVisits } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "misc.tabCompleteCommands", "commands.tabComplete") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt index 8f318e8ea4c9..7ca7ad1b1d0d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.cosmetics import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent @@ -129,7 +130,7 @@ object CosmeticFollowingLine { private fun isEnabled() = (LorenzUtils.inSkyBlock || OutsideSbFeature.FOLLOWING_LINE.isSelected()) && config.enabled - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(9, "misc.cosmeticConfig", "misc.cosmetic") event.move(9, "misc.cosmeticConfig.followingLineConfig", "misc.cosmetic.followingLine") diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt index c1f52600b273..8edb9cefd83c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt @@ -341,8 +341,8 @@ object DungeonAPI { } } - @SubscribeEvent - fun onDebugDataCollect(event: DebugDataCollectEvent) { + @HandleEvent + fun onDebug(event: DebugDataCollectEvent) { event.title("Dungeon") if (!inDungeon()) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt index 3f7332016b3a..88e6c0625603 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt @@ -132,7 +132,7 @@ object DungeonCleanEnd { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "dungeon.cleanEndToggle", "dungeon.cleanEnd.enabled") event.move(3, "dungeon.cleanEndF3IgnoreGuardians", "dungeon.cleanEnd.F3IgnoreGuardians") diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt index ab73259ab713..cb2b5a8fd911 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt @@ -155,7 +155,7 @@ object DungeonCopilot { config.pos.renderString(nextStep, posLabel = "Dungeon Copilot") } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "dungeon.messageFilterKeysAndDoors", "dungeon.messageFilter.keysAndDoors") event.move(3, "dungeon.copilotEnabled", "dungeon.dungeonCopilot.enabled") diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt index d0c7a5b83945..aabc785c3a95 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt @@ -380,7 +380,7 @@ object DungeonFinderFeatures { toolTipMap = emptyMap() } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "dungeon.partyFinderColoredClassLevel", "dungeon.partyFinder.coloredClassLevel") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt index 0cb127635be6..32c9e6c60bfe 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt @@ -194,7 +194,7 @@ object DungeonHideItems { movingSkeletonSkulls.clear() } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "dungeon.hideSuperboomTNT", "dungeon.objectHider.hideSuperboomTNT") event.move(3, "dungeon.hideBlessing", "dungeon.objectHider.hideBlessing") diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt index 5eb13abb4ad3..6c48b0452323 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt @@ -101,7 +101,7 @@ object DungeonHighlightClickedBlocks { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(56, "dungeon.highlightClickedBlocks", "dungeon.clickedBlocks.enabled") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMobManager.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMobManager.kt index 83280a94cdea..858697ca13ee 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMobManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMobManager.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.dungeon import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.mob.Mob import at.hannibal2.skyhanni.data.mob.MobData @@ -29,7 +30,7 @@ object DungeonMobManager { private val staredInvisible = mutableSetOf() private val felOnTheGround = mutableSetOf() - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { onToggle( starredConfig.highlight, diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonsRaceGuide.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonsRaceGuide.kt index 32a10924cc0d..94fb6cd12daa 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonsRaceGuide.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonsRaceGuide.kt @@ -57,7 +57,7 @@ object DungeonsRaceGuide { updateConfig() } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { ConditionalUtils.onToggle(config.rainbowColor, config.monochromeColor, config.lookAhead) { updateConfig() diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt index 4074b465de33..206db62d2961 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt @@ -1,11 +1,12 @@ package at.hannibal2.skyhanni.features.event.diana import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.TitleManager import at.hannibal2.skyhanni.events.DebugDataCollectEvent import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.events.LorenzKeyPressEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.events.minecraft.KeyPressEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.CollectionUtils.sorted @@ -29,8 +30,8 @@ object BurrowWarpHelper { private var lastWarpTime = SimpleTimeMark.farPast() private var lastWarp: WarpPoint? = null - @SubscribeEvent - fun onKeyClick(event: LorenzKeyPressEvent) { + @HandleEvent + fun onKeyPress(event: KeyPressEvent) { if (!DianaAPI.isDoingDiana()) return if (!config.burrowNearestWarp) return @@ -73,8 +74,8 @@ object BurrowWarpHelper { currentWarp = null } - @SubscribeEvent - fun onDebugDataCollect(event: DebugDataCollectEvent) { + @HandleEvent + fun onDebug(event: DebugDataCollectEvent) { event.title("Diana Burrow Nearest Warp") if (!DianaAPI.isDoingDiana()) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt index bb9ce7ff3ad3..c4eebff84f62 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt @@ -69,8 +69,8 @@ object GriffinBurrowHelper { private var testList = listOf() private var testGriffinSpots = false - @SubscribeEvent - fun onDebugDataCollect(event: DebugDataCollectEvent) { + @HandleEvent + fun onDebug(event: DebugDataCollectEvent) { event.title("Griffin Burrow Helper") if (!DianaAPI.isDoingDiana()) { @@ -354,7 +354,7 @@ object GriffinBurrowHelper { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "diana", "event.diana") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt index 6b953eb939b5..1ce206a05599 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt @@ -36,8 +36,8 @@ object GriffinBurrowParticleFinder { // This exists to detect the unlucky timing when the user opens a burrow before it gets fully detected private var fakeBurrow: LorenzVec? = null - @SubscribeEvent - fun onDebugDataCollect(event: DebugDataCollectEvent) { + @HandleEvent + fun onDebug(event: DebugDataCollectEvent) { event.title("Griffin Burrow Particle Finder") if (!DianaAPI.isDoingDiana()) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt index 48bd5b8fcd14..309b456de4d0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt @@ -4,11 +4,11 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.events.LorenzKeyPressEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.events.diana.InquisitorFoundEvent import at.hannibal2.skyhanni.events.entity.EntityHealthUpdateEvent +import at.hannibal2.skyhanni.events.minecraft.KeyPressEvent import at.hannibal2.skyhanni.events.minecraft.packet.PacketReceivedEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.ChatUtils @@ -200,8 +200,8 @@ object InquisitorWaypointShare { } } - @SubscribeEvent - fun onKeyClick(event: LorenzKeyPressEvent) { + @HandleEvent + fun onKeyPress(event: KeyPressEvent) { if (!isEnabled()) return if (Minecraft.getMinecraft().currentScreen != null) return if (event.keyCode == config.keyBindShare) sendInquisitor() diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt index dbd46cd345aa..2068842aec05 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.event.diana import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.ElectionAPI.getElectionYear import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent @@ -125,7 +126,7 @@ object MythologicalCreatureTracker { addSearchString(" §7- §e${data.creaturesSinceLastInquisitor.addSeparators()} §7Creatures since last Minos Inquisitor") } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { ConditionalUtils.onToggle(config.showPercentage) { tracker.update() diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCallWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCallWarning.kt index 5223dd952f57..0b05c76f34fe 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCallWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCallWarning.kt @@ -5,9 +5,9 @@ import at.hannibal2.skyhanni.data.PurseAPI import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.events.LorenzKeyPressEvent import at.hannibal2.skyhanni.events.MessageSendToServerEvent import at.hannibal2.skyhanni.events.SecondPassedEvent +import at.hannibal2.skyhanni.events.minecraft.KeyPressEvent import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryAPI import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.ChatUtils @@ -73,8 +73,8 @@ object HoppityCallWarning { private var acceptUUID: String? = null private var commandSentTimer = SimpleTimeMark.farPast() - @SubscribeEvent - fun onKeyPress(event: LorenzKeyPressEvent) { + @HandleEvent + fun onKeyPress(event: KeyPressEvent) { if (config.acceptHotkey == Keyboard.KEY_NONE || config.acceptHotkey != event.keyCode) return acceptUUID?.let { HypixelCommands.callback(acceptUUID!!) @@ -82,7 +82,7 @@ object HoppityCallWarning { } } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { val soundProperty = config.hoppityCallSound ConditionalUtils.onToggle(soundProperty) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCollectionStats.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCollectionStats.kt index b20581830a80..32808c4f3cc5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCollectionStats.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCollectionStats.kt @@ -804,7 +804,7 @@ object HoppityCollectionStats { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { val bp = "inventory.chocolateFactory" mapOf( diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt index 1eb3438424ba..53de2ae200bd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt @@ -306,8 +306,8 @@ object HoppityEggLocator { return distToLine / disMultiplierSquared } - @SubscribeEvent - fun onDebugDataCollect(event: DebugDataCollectEvent) { + @HandleEvent + fun onDebug(event: DebugDataCollectEvent) { event.title("Hoppity Eggs Locations") if (!isEnabled()) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt index 5bf9e30dc0dd..46ce29f0d22b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt @@ -257,7 +257,7 @@ object HoppityEggsManager { SoundUtils.repeatSound(100, 10, SoundUtils.plingSound) } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move( 44, diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEventSummary.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEventSummary.kt index 02d530af4e79..564f424d8dcb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEventSummary.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEventSummary.kt @@ -20,11 +20,11 @@ import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.IslandChangeEvent import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.events.LorenzKeyPressEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.events.hoppity.RabbitFoundEvent +import at.hannibal2.skyhanni.events.minecraft.KeyPressEvent import at.hannibal2.skyhanni.features.event.hoppity.HoppityRabbitTheFishChecker.mealEggInventoryPattern import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryAPI import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateShopPrice.menuNamePattern @@ -191,8 +191,8 @@ object HoppityEventSummary { reCheckInventoryState() } - @SubscribeEvent - fun onKeyPress(event: LorenzKeyPressEvent) { + @HandleEvent + fun onKeyPress(event: KeyPressEvent) { reCheckInventoryState() if (!liveDisplayConfig.enabled) return if (liveDisplayConfig.toggleKeybind == Keyboard.KEY_NONE || liveDisplayConfig.toggleKeybind != event.keyCode) return @@ -232,13 +232,13 @@ object HoppityEventSummary { ) } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(64, "event.hoppity.preventMissingFish", "event.hoppity.preventMissingRabbitTheFish") event.move(65, "hoppityStatLiveDisplayToggled", "hoppityStatLiveDisplayToggledOff") } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { config.eventSummary.statDisplayList.afterChange { lastKnownStatHash = 0 diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt index e41a61013210..e24db7dd1f47 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.event.jerry.frozentreasure import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.event.winter.FrozenTreasureConfig.FrozenTreasureDisplayEntry import at.hannibal2.skyhanni.data.IslandType @@ -177,7 +178,7 @@ object FrozenTreasureTracker { tracker.renderDisplay(config.position) } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "misc.frozenTreasureTracker", "event.winter.frozenTreasureTracker") event.move( diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketWaypoints.kt index 254fea75bc58..7a6d5e38f44c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketWaypoints.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketWaypoints.kt @@ -151,7 +151,7 @@ object BasketWaypoints { isActive = newIsActive } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { config.pathfind.onToggle { if (config.pathfind.get() && isActive && isEnabled()) startPathfind() @@ -189,7 +189,7 @@ object BasketWaypoints { private fun isEnabled() = HypixelData.hypixelLive && !LorenzUtils.inSkyBlock - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(13, "event.halloweenBasket", "event.lobbyWaypoints.halloweenBasket") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/spook/TheGreatSpook.kt b/src/main/java/at/hannibal2/skyhanni/features/event/spook/TheGreatSpook.kt index d9d0a91e965c..7cbfdd64a920 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/spook/TheGreatSpook.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/spook/TheGreatSpook.kt @@ -116,7 +116,7 @@ object TheGreatSpook { displayGreatSpookEnd = Renderable.string(timeLeftString) } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { val config = SkyHanniMod.feature.dev.debug.forceGreatSpook config.afterChange { @@ -241,7 +241,7 @@ object TheGreatSpook { greatSpookEndTime = if (SkyHanniMod.feature.dev.debug.forceGreatSpook.get()) SimpleTimeMark.farFuture() else endTime } - @SubscribeEvent + @HandleEvent fun onDebug(event: DebugDataCollectEvent) { event.title("Great Spook") diff --git a/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt index 33498b274e50..01459cb2569d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.fame import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.EntityMovementData import at.hannibal2.skyhanni.data.IslandGraphs @@ -238,7 +239,7 @@ object CityProjectFeatures { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "misc.cityProject", "event.cityProject") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fame/UpgradeReminder.kt b/src/main/java/at/hannibal2/skyhanni/features/fame/UpgradeReminder.kt index 44f053f0aa73..92ed5b49da26 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fame/UpgradeReminder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fame/UpgradeReminder.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.fame import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.EntityMovementData import at.hannibal2.skyhanni.data.IslandGraphs @@ -167,7 +168,7 @@ object UpgradeReminder { private fun isEnabled() = LorenzUtils.inSkyBlock && config.accountUpgradeReminder - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move( 49, diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt index 8afd4899866e..779854fa26f3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt @@ -80,7 +80,7 @@ object ChumBucketHider { } } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { ConditionalUtils.onToggle(config.enabled, config.hideBucket, config.hideOwn) { reset() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt index 7ffb623a8571..ec1df2d9e14f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt @@ -7,12 +7,12 @@ import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.mob.Mob import at.hannibal2.skyhanni.events.DebugDataCollectEvent import at.hannibal2.skyhanni.events.GuiRenderEvent -import at.hannibal2.skyhanni.events.LorenzKeyPressEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.MobEvent import at.hannibal2.skyhanni.events.SeaCreatureFishEvent import at.hannibal2.skyhanni.events.SecondPassedEvent +import at.hannibal2.skyhanni.events.minecraft.KeyPressEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyClicked @@ -160,8 +160,8 @@ object FishingTimer { updateInfo() } - @SubscribeEvent - fun onKeyPress(event: LorenzKeyPressEvent) { + @HandleEvent + fun onKeyPress(event: KeyPressEvent) { if (!isEnabled()) return if (Minecraft.getMinecraft().currentScreen != null) return if (config.manualResetTimer.isKeyClicked()) { @@ -229,7 +229,7 @@ object FishingTimer { return "$timeColor$timeFormat §8($countColor$currentCount §b$name§8)" } - @SubscribeEvent + @HandleEvent fun onDebug(event: DebugDataCollectEvent) { event.title("Barn Fishing Timer") event.addIrrelevant { @@ -263,7 +263,7 @@ object FishingTimer { private fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled.get() - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "fishing.barnTimer", "fishing.barnTimer.enabled") event.move(3, "fishing.barnTimerAlertTime", "fishing.barnTimer.alertTime") diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/LavaReplacement.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/LavaReplacement.kt index 68029e35d8e4..ad00ead14a61 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/LavaReplacement.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/LavaReplacement.kt @@ -13,7 +13,6 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import com.google.gson.JsonArray import com.google.gson.JsonPrimitive import net.minecraft.client.Minecraft -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule object LavaReplacement { @@ -31,7 +30,7 @@ object LavaReplacement { } } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { ConditionalUtils.onToggle(config.enabled, config.everywhere, config.islands) { update() @@ -62,7 +61,7 @@ object LavaReplacement { fun inIsland() = island.isInIsland() } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(65, "fishing.lavaReplacement.onlyInCrimsonIsle", "fishing.lavaReplacement.everywhere") { element -> JsonPrimitive(!element.asBoolean) diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureFeatures.kt index 06c68482af53..24059bd4ef55 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureFeatures.kt @@ -101,7 +101,7 @@ object SeaCreatureFeatures { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "fishing.rareSeaCreatureHighlight", "fishing.rareCatches.highlight") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/ThunderSparksHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/ThunderSparksHighlight.kt index 0bd155afd8ef..d7ca5cd144d6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/ThunderSparksHighlight.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/ThunderSparksHighlight.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.fishing import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent @@ -67,7 +68,7 @@ object ThunderSparksHighlight { private fun isEnabled() = (IslandType.CRIMSON_ISLE.isInIsland() || LorenzUtils.isStrandedProfile) && config.highlight - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "fishing.thunderSparkHighlight", "fishing.thunderSpark.highlight") event.move(3, "fishing.thunderSparkColor", "fishing.thunderSpark.color") diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/TotemOfCorruption.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/TotemOfCorruption.kt index dd5ba4724520..64c02f3f76d5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/TotemOfCorruption.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/TotemOfCorruption.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.fishing import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.features.fishing.TotemOfCorruptionConfig.OutlineType import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent @@ -108,7 +109,7 @@ object TotemOfCorruption { } } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { config.showOverlay.onToggle { display = emptyList() diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt index 1944a65d8a76..742e5abfd97b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt @@ -168,7 +168,7 @@ object SeaCreatureTracker { return { it in items } } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { ConditionalUtils.onToggle(config.showPercentage) { tracker.update() diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/GoldenFishTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/GoldenFishTimer.kt index f79105fd414f..c50a250b507f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/GoldenFishTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/GoldenFishTimer.kt @@ -305,8 +305,8 @@ object GoldenFishTimer { removeGoldenFish() } - @SubscribeEvent - fun onDebugData(event: DebugDataCollectEvent) { + @HandleEvent + fun onDebug(event: DebugDataCollectEvent) { event.title("Golden Fish Timer") if (!isEnabled()) { event.addIrrelevant("Not Enabled") diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt index a5438d720db7..3d56036eea70 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.fishing.trophy import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent @@ -42,7 +43,7 @@ object OdgerWaypoint { event.drawDynamicText(location, "Odger", 1.5) } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "fishing.odgerLocation", "fishing.trophyFishing.odgerLocation") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishDisplay.kt index 7d25c35b8ec4..f9e729bd2131 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishDisplay.kt @@ -74,8 +74,8 @@ object TrophyFishDisplay { update() } - @SubscribeEvent - fun onConfigReload(event: ConfigLoadEvent) { + @HandleEvent + fun onConfigLoad(event: ConfigLoadEvent) { with(config) { ConditionalUtils.onToggle( enabled, diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt index 33bfd63f0bb3..1cca2aefe208 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.fishing.trophy import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishManager.getFilletValue @@ -35,7 +36,7 @@ object TrophyFishFillet { event.toolTip.add("§7Fillet: §8${filletValue.addSeparators()} Magmafish §7(§6${filletPrice.shortFormat()}§7)") } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "fishing.trophyFilletTooltip", "fishing.trophyFishing.filletTooltip") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt index 4a23e84e5d52..bcac56c1c2b5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.fishing.trophy import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.fishing.trophyfishing.ChatMessagesConfig.DesignFormat import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -113,7 +114,7 @@ object TrophyFishMessages { rarity == TrophyRarity.SILVER && amount != 1 - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "fishing.trophyCounter", "fishing.trophyFishing.chatMessages.enabled") event.move(2, "fishing.trophyDesign", "fishing.trophyFishing.chatMessages.design") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt index e0eb9fb45e78..f9a0a16ed48e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.garden +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent @@ -182,7 +183,7 @@ object AnitaMedalProfit { ) } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "garden.anitaMedalProfitEnabled", "garden.anitaShop.medalProfitEnabled") event.move(3, "garden.anitaMedalProfitPos", "garden.anitaShop.medalProfitPos") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt index 8c8dcdd18fd0..0dc6ce28cf15 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt @@ -396,7 +396,7 @@ object FarmingFortuneDisplay { fun CropType.getLatestTrueFarmingFortune() = latestFF?.get(this) - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "garden.farmingFortuneDisplay", "garden.farmingFortunes.display") event.move(3, "garden.farmingFortuneDropMultiplier", "garden.farmingFortunes.dropMultiplier") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt index ebcc82491e4c..2753c95616d5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt @@ -207,7 +207,7 @@ object GardenAPI { ChatUtils.chat("Manually reset all crop speed data!") } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { GardenBestCropTime.reset() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt index ae52f170e566..8344f6b32022 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt @@ -214,14 +214,14 @@ object GardenLevelDisplay { config.pos.renderString(display, posLabel = "Garden Level") } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { ConditionalUtils.onToggle(config.overflow) { update() } } private fun isEnabled() = GardenAPI.inGarden() && config.display - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "garden.gardenLevelDisplay", "garden.gardenLevels.display") event.move(3, "garden.gardenLevelPos", "garden.gardenLevels.pos") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt index 40162217e051..ebbdd8907c75 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt @@ -98,8 +98,8 @@ object GardenNextJacobContest { var fetchedFromElite = false private var isSendingContests = false - @SubscribeEvent - fun onDebugDataCollect(event: DebugDataCollectEvent) { + @HandleEvent + fun onDebug(event: DebugDataCollectEvent) { event.title("Garden Next Jacob Contest") if (!GardenAPI.inGarden()) { @@ -278,7 +278,7 @@ object GardenNextJacobContest { SkyHanniMod.configManager.saveConfig(ConfigFileType.JACOB_CONTESTS, "Save contests") } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { val savedContests = SkyHanniMod.jacobContestsData.contestTimes val year = savedContests.firstNotNullOfOrNull { @@ -641,7 +641,7 @@ object GardenNextJacobContest { fun isNextCrop(cropName: CropType) = nextContestCrops.contains(cropName) && config.otherGuis - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "garden.nextJacobContestDisplay", "garden.nextJacobContests.display") event.move(3, "garden.nextJacobContestEverywhere", "garden.nextJacobContests.everywhere") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt index 8d804141561c..ace5cba716e0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt @@ -130,7 +130,7 @@ object GardenOptimalSpeed { optimalSpeed = cropInHand?.getOptimalSpeed() } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { for (value in CropType.entries) { ConditionalUtils.onToggle(value.getConfig()) { @@ -217,7 +217,7 @@ object GardenOptimalSpeed { private fun isRancherOverlayEnabled() = GardenAPI.inGarden() && config.signEnabled - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "garden.optimalSpeedEnabled", "garden.optimalSpeeds.enabled") event.move(3, "garden.optimalSpeedWarning", "garden.optimalSpeeds.warning") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotBorders.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotBorders.kt index 9be28436815d..1a59dee59081 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotBorders.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotBorders.kt @@ -1,7 +1,8 @@ package at.hannibal2.skyhanni.features.garden -import at.hannibal2.skyhanni.events.LorenzKeyPressEvent +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent +import at.hannibal2.skyhanni.events.minecraft.KeyPressEvent import at.hannibal2.skyhanni.features.garden.GardenPlotAPI.renderPlot import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.LocationUtils.distanceSqToPlayer @@ -18,8 +19,8 @@ object GardenPlotBorders { private var timeLastSaved = SimpleTimeMark.farPast() private var showBorders = false - @SubscribeEvent - fun onKeyClick(event: LorenzKeyPressEvent) { + @HandleEvent + fun onKeyPress(event: KeyPressEvent) { if (!isEnabled()) return if (timeLastSaved.passedSince() < 250.milliseconds) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenWarpCommands.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenWarpCommands.kt index 281fb01447e4..853b72ed9bb6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenWarpCommands.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenWarpCommands.kt @@ -1,8 +1,8 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.api.event.HandleEvent -import at.hannibal2.skyhanni.events.LorenzKeyPressEvent import at.hannibal2.skyhanni.events.MessageSendToServerEvent +import at.hannibal2.skyhanni.events.minecraft.KeyPressEvent import at.hannibal2.skyhanni.features.misc.LockMouseLook import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.ChatUtils @@ -12,7 +12,6 @@ import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraft.client.Minecraft -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds @SkyHanniModule @@ -58,8 +57,8 @@ object GardenWarpCommands { } } - @SubscribeEvent - fun onKeyClick(event: LorenzKeyPressEvent) { + @HandleEvent + fun onKeyPress(event: KeyPressEvent) { if (!GardenAPI.inGarden()) return if (Minecraft.getMinecraft().currentScreen != null) return if (NEUItems.neuHasFocus()) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt index 73cf8634ac06..31fa31041284 100755 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt @@ -66,7 +66,7 @@ object GardenYawAndPitch { (LorenzUtils.inSkyBlock && (GardenAPI.inGarden() || config.showOutsideGarden)) ) - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(18, "garden.yawPitchDisplay.showEverywhere", "garden.yawPitchDisplay.showOutsideGarden") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/SensitivityReducer.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/SensitivityReducer.kt index 60d61a2fb09b..da849c384044 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/SensitivityReducer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/SensitivityReducer.kt @@ -79,7 +79,7 @@ object SensitivityReducer { } } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { config.reducingFactor.afterChange { reloadSensitivity() @@ -182,8 +182,8 @@ object SensitivityReducer { } } - @SubscribeEvent - fun onDebugDataCollect(event: DebugDataCollectEvent) { + @HandleEvent + fun onDebug(event: DebugDataCollectEvent) { event.title("Garden Sensitivity Reducer") if (!GardenAPI.inGarden()) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt index 95bcbbea74d2..4527b726f763 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.garden +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.garden.TooltipTweaksConfig.CropTooltipFortuneEntry import at.hannibal2.skyhanni.events.LorenzToolTipEvent @@ -160,7 +161,7 @@ object ToolTooltipTweaks { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "garden.compactToolTooltips", "garden.tooltipTweak.compactToolTooltips") event.move(3, "garden.fortuneTooltipKeybind", "garden.tooltipTweak.fortuneTooltipKeybind") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt index 9c8dc43f64a1..daf26417b52f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt @@ -205,7 +205,7 @@ object ComposterDisplay { LorenzUtils.sendTitle("§eComposter Warning!", 3.seconds) } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "garden.composterDisplayEnabled", "garden.composters.displayEnabled") event.move(3, "garden.composterDisplayOutsideGarden", "garden.composters.displayOutsideGarden") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterInventoryNumbers.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterInventoryNumbers.kt index c26c562b30ce..60613260019c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterInventoryNumbers.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterInventoryNumbers.kt @@ -12,7 +12,6 @@ import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat import at.hannibal2.skyhanni.utils.RegexUtils.firstMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule object ComposterInventoryNumbers { @@ -82,7 +81,7 @@ object ComposterInventoryNumbers { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "garden.composterInventoryNumbers", "garden.composters.inventoryNumbers") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt index ab7674806828..d4bcc6db5ca7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt @@ -621,7 +621,7 @@ object ComposterOverlay { DAY("Day", 60 * 60 * 24), } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "garden.composterOverlay", "garden.composters.overlay") event.move(3, "garden.composterOverlayPriceType", "garden.composters.overlayPriceType") @@ -634,8 +634,8 @@ object ComposterOverlay { } } - @SubscribeEvent - fun onDebugDataCollect(event: DebugDataCollectEvent) { + @HandleEvent + fun onDebug(event: DebugDataCollectEvent) { event.title("Garden Composter") event.addIrrelevant { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt index 0474d85fda6a..a9b0ae2d3ac2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.garden.composter +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.LorenzToolTipEvent @@ -91,7 +92,7 @@ object GardenComposterInventoryFeatures { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "garden.composterUpgradePrice", "garden.composters.upgradePrice") event.move(3, "garden.composterHighLightUpgrade", "garden.composters.highlightUpgrade") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingPersonalBestGain.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingPersonalBestGain.kt index 729693c1d4d0..43b17c58efe3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingPersonalBestGain.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingPersonalBestGain.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.garden.contest +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.jsonobjects.repo.GardenJson import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -58,7 +59,7 @@ object FarmingPersonalBestGain { personalBestIncrements = data.personalBestIncrement } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(68, "garden.contestPersonalBestIncreaseFF", "garden.personalBests.increaseFF") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt index a4fd33c6dcea..cf3617fdcece 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt @@ -228,7 +228,7 @@ object JacobFarmingContestsInventory { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move( 3, diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/ArmorDropTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/ArmorDropTracker.kt index 81ed91f01078..c9787683bfda 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/ArmorDropTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/ArmorDropTracker.kt @@ -163,7 +163,7 @@ object ArmorDropTracker { return currentArmorDropChance } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "garden.farmingArmorDropsEnabled", "garden.farmingArmorDrop.enabled") event.move(3, "garden.farmingArmorDropsHideChat", "garden.farmingArmorDrop.hideChat") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt index 0c5b6e3f9331..9e8aac9fbef1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt @@ -441,7 +441,7 @@ object CropMoneyDisplay { private fun isEnabled() = GardenAPI.inGarden() && config.display - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "garden.moneyPerHourDisplay", "garden.moneyPerHours.display") event.move(3, "garden.moneyPerHourShowOnlyBest", "garden.moneyPerHours.showOnlyBest") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/DicerRngDropTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/DicerRngDropTracker.kt index a1b142425667..04cc32c91311 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/DicerRngDropTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/DicerRngDropTracker.kt @@ -118,7 +118,7 @@ object DicerRngDropTracker { } } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { ConditionalUtils.onToggle(config.compact) { tracker.update() @@ -181,7 +181,7 @@ object DicerRngDropTracker { fun isEnabled() = GardenAPI.inGarden() && config.display - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "garden.dicerCounterDisplay", "garden.dicerCounters.display") event.move(3, "garden.dicerCounterHideChat", "garden.dicerCounters.hideChat") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt index 7e3eee6fe9da..b742bbd353ac 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt @@ -86,7 +86,7 @@ object FarmingWeightDisplay { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.transform(1, "garden.eliteFarmingWeightoffScreenDropMessage") event.move(3, "garden.eliteFarmingWeightDisplay", "garden.eliteFarmingWeights.display") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt index e8ca52ac8485..d441fab1015e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.garden.farming +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.garden.cropmilestones.NextConfig import at.hannibal2.skyhanni.config.features.garden.cropmilestones.NextConfig.BestTypeEntry @@ -17,7 +18,6 @@ import at.hannibal2.skyhanni.utils.CollectionUtils.sorted import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.TimeUnit import at.hannibal2.skyhanni.utils.TimeUtils.format -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.milliseconds @SkyHanniModule @@ -136,7 +136,7 @@ object GardenBestCropTime { private fun getGardenExpForTier(gardenLevel: Int) = if (gardenLevel > 30) 300 else gardenLevel * 10 - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "garden.cropMilestoneBestType", "garden.cropMilestones.next.bestType") event.move(3, "garden.cropMilestoneShowOnlyBest", "garden.cropMilestones.next.showOnlyBest") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt index 887c0c8ed602..fbf9a4cf18dd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt @@ -59,7 +59,7 @@ object GardenCropMilestoneDisplay { private var lastMushWarnedLevel = -1 private var previousMushNext = 0 - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { ConditionalUtils.onToggle( config.bestShowMaxedNeeded, @@ -338,7 +338,7 @@ object GardenCropMilestoneDisplay { private fun isEnabled() = GardenAPI.inGarden() && config.progress - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "garden.cropMilestoneProgress", "garden.cropMilestones.progress") event.move(3, "garden.cropMilestoneWarnClose", "garden.cropMilestones.warnClose") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt index a30f40727276..3bfec86484d6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt @@ -189,7 +189,7 @@ object GardenCropSpeed { fun isSpeedDataEmpty() = cropsPerSecond?.values?.sum()?.let { it == 0 } ?: true - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "garden.blocksBrokenResetTime", "garden.cropMilestones.blocksBrokenResetTime") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCustomKeybinds.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCustomKeybinds.kt index be5b60d31ba3..30705ee86d41 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCustomKeybinds.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCustomKeybinds.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.garden.farming +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.LorenzTickEvent @@ -66,7 +67,7 @@ object GardenCustomKeybinds { lastDuplicateKeybindsWarnTime = SimpleTimeMark.now() } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { with(config) { ConditionalUtils.onToggle(attack, useItem, left, right, forward, back, jump, sneak) { @@ -140,7 +141,7 @@ object GardenCustomKeybinds { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "garden.keyBindEnabled", "garden.keyBind.enabled") event.move(3, "garden.keyBindAttack", "garden.keyBind.attack") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt index 630e0a227e85..03a5bb0ec160 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt @@ -416,8 +416,8 @@ object CaptureFarmingGear { storage.outdatedItems.clear() } - @SubscribeEvent - fun onConfigUpdaterMigratorConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + @HandleEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(48, "#profile.garden.fortune.carrotFortune", "#profile.garden.fortune.carrolyn.CARROT") event.move(48, "#profile.garden.fortune.pumpkinFortune", "#profile.garden.fortune.carrolyn.PUMPKIN") event.move(48, "#profile.garden.fortune.cocoaBeansFortune", "#profile.garden.fortune.carrolyn.COCOA_BEANS") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt index c589562bcaec..6abaf0aff459 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.garden.inventory +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.jsonobjects.repo.AnitaUpgradeCostsJson import at.hannibal2.skyhanni.data.jsonobjects.repo.AnitaUpgradePrice @@ -86,7 +87,7 @@ object AnitaExtraFarmingFortune { levelPrice = data.levelPrice } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "garden.extraFarmingFortune", "garden.anitaShop.extraFarmingFortune") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneInventory.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneInventory.kt index 492e2016c364..d6fa123ab2a3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneInventory.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneInventory.kt @@ -82,7 +82,7 @@ object GardenCropMilestoneInventory { event.toolTip.add(index, "§7Progress to Tier $maxTier: §e$percentageFormat") } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "garden.numberAverageCropMilestone", "garden.number.averageCropMilestone") event.move(3, "garden.cropMilestoneTotalProgress", "garden.tooltipTweak.cropMilestoneTotalProgress") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryNumbers.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryNumbers.kt index f48d5b4580a8..88e9b30d96d7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryNumbers.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryNumbers.kt @@ -15,7 +15,6 @@ import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNecessary import at.hannibal2.skyhanni.utils.RegexUtils.firstMatcher import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule object GardenInventoryNumbers { @@ -62,7 +61,7 @@ object GardenInventoryNumbers { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "garden.numberCropMilestone", "garden.number.cropMilestone") event.move(3, "garden.numberCropUpgrades", "garden.number.cropUpgrades") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt index 6578748fca95..dcd82a256134 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.garden.inventory +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent @@ -112,7 +113,7 @@ object SkyMartCopperPrice { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "garden.skyMartCopperPrice", "garden.skyMart.copperPrice") event.move(3, "garden.skyMartCopperPriceAdvancedStats", "garden.skyMart.copperPriceAdvancedStats") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestAPI.kt index 129ec78e28f5..65125fda3989 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestAPI.kt @@ -383,8 +383,8 @@ object PestAPI { } } - @SubscribeEvent - fun onDebugDataCollect(event: DebugDataCollectEvent) { + @HandleEvent + fun onDebug(event: DebugDataCollectEvent) { event.title("Garden Pests") if (!GardenAPI.inGarden()) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt index 3d61325c27fc..302b0dc6c79c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt @@ -6,9 +6,9 @@ import at.hannibal2.skyhanni.data.model.TabWidget import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.IslandChangeEvent import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.events.LorenzKeyPressEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.garden.pests.PestUpdateEvent +import at.hannibal2.skyhanni.events.minecraft.KeyPressEvent import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.GardenPlotAPI import at.hannibal2.skyhanni.features.garden.GardenPlotAPI.isPestCountInaccurate @@ -191,8 +191,8 @@ object PestFinder { if (PestAPI.noPestsChatPattern.matches(event.message)) LorenzUtils.sendTitle("§eNo pests!", 2.seconds) } - @SubscribeEvent - fun onKeyClick(event: LorenzKeyPressEvent) { + @HandleEvent + fun onKeyPress(event: KeyPressEvent) { if (!GardenAPI.inGarden()) return if (Minecraft.getMinecraft().currentScreen != null) return if (NEUItems.neuHasFocus()) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawn.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawn.kt index d70b13a3b022..3ada64462ac9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawn.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawn.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.garden.pests +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.garden.pests.PestSpawnConfig import at.hannibal2.skyhanni.config.features.garden.pests.PestSpawnConfig.ChatMessageFormatEntry @@ -113,7 +114,7 @@ object PestSpawn { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.transform(15, "garden.pests.pestSpawn.chatMessageFormat") { element -> ConfigUtils.migrateIntToEnum(element, ChatMessageFormatEntry::class.java) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/StereoHarmonyDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/StereoHarmonyDisplay.kt index c537cbe26e4e..3620a1e55480 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/StereoHarmonyDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/StereoHarmonyDisplay.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.garden.pests +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent @@ -112,7 +113,7 @@ object StereoHarmonyDisplay { display = emptyList() } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { ConditionalUtils.onToggle(config.showHead, config.showCrop) { update() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt index 360768e560a2..f0ba066b481f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt @@ -298,7 +298,7 @@ object GardenVisitorDropStatistics { ) } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { val storage = GardenAPI.storage?.visitorDrops ?: return val visitorRarities = storage.visitorRarities @@ -326,7 +326,7 @@ object GardenVisitorDropStatistics { config.pos.renderStringsAndItems(display, posLabel = "Visitor Stats") } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { val originalPrefix = "garden.visitorDropsStatistics." val newPrefix = "garden.visitors.dropsStatistics." diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt index 89b1577a5618..3459a52413a6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt @@ -679,8 +679,8 @@ object GardenVisitorFeatures { return false } - @SubscribeEvent - fun onDebugDataCollect(event: DebugDataCollectEvent) { + @HandleEvent + fun onDebug(event: DebugDataCollectEvent) { event.title("Garden Visitor Stats") if (!GardenAPI.inGarden()) { @@ -707,7 +707,7 @@ object GardenVisitorFeatures { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "garden.visitorNeedsDisplay", "garden.visitors.needs.display") event.move(3, "garden.visitorNeedsPos", "garden.visitors.needs.pos") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt index 14ad314cfc8d..f0a192ab3aac 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt @@ -236,7 +236,7 @@ object GardenVisitorTimer { private fun isSixthVisitorWarningEnabled() = config.sixthVisitorWarning private fun isEnabled() = GardenAPI.inGarden() && config.enabled - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "garden.visitorTimerEnabled", "garden.visitors.timer.enabled") event.move(3, "garden.visitorTimerSixthVisitorEnabled", "garden.visitors.timer.sixthVisitorEnabled") diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt index 6df445836fc3..aa5b443f3571 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt @@ -182,7 +182,7 @@ object CustomScoreboard { takeIf { !informationFilteringConfig.hideEmptyLinesAtTopAndBottom } ?: dropWhile { it.display.isBlank() }.dropLastWhile { it.display.isBlank() } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { ConditionalUtils.onToggle( config.scoreboardEntries, @@ -209,8 +209,8 @@ object CustomScoreboard { currentIslandEvents = eventsConfig.eventEntries.get().map { it.event }.filter { it.showIsland() } } - @SubscribeEvent - fun onDebugDataCollect(event: DebugDataCollectEvent) { + @HandleEvent + fun onDebug(event: DebugDataCollectEvent) { event.title("Custom Scoreboard") event.addIrrelevant { if (!config.enabled.get()) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboardConfigFix.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboardConfigFix.kt index 44dac812764e..a8347585bec4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboardConfigFix.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboardConfigFix.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.gui.customscoreboard +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.RenderUtils.HorizontalAlignment @@ -7,7 +8,6 @@ import at.hannibal2.skyhanni.utils.RenderUtils.VerticalAlignment import com.google.gson.JsonArray import com.google.gson.JsonElement import com.google.gson.JsonPrimitive -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule object CustomScoreboardConfigFix { @@ -20,7 +20,7 @@ object CustomScoreboardConfigFix { private const val TITLE_AND_FOOTER_KEY = "$DISPLAY_PREFIX.titleAndFooter" private const val EVENT_ENTRIES_KEY = "$DISPLAY_PREFIX.events.eventEntries" - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(28, "$DISPLAY_CONFIG_PREFIX.showAllActiveEvents", "$EVENTS_CONFIG_KEY.showAllActiveEvents") diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/quiver/QuiverDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/quiver/QuiverDisplay.kt index 94b66b827a86..58594a562010 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/quiver/QuiverDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/quiver/QuiverDisplay.kt @@ -87,7 +87,7 @@ object QuiverDisplay { } } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { ConditionalUtils.onToggle( config.whenToShow, diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/quiver/QuiverWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/quiver/QuiverWarning.kt index 67d31b463326..039e80549989 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/quiver/QuiverWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/quiver/QuiverWarning.kt @@ -93,7 +93,7 @@ object QuiverWarning { private fun inInstance() = DungeonAPI.inDungeon() || KuudraAPI.inKuudra() - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(35, "inventory.quiverAlert", "combat.quiverConfig.lowQuiverNotification") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/AuctionsHighlighter.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/AuctionsHighlighter.kt index 0503a4e119b2..96df662dedf5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/AuctionsHighlighter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/AuctionsHighlighter.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.inventory import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.features.misc.items.EstimatedItemValueCalculator @@ -65,7 +66,7 @@ object AuctionsHighlighter { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(25, "inventory.highlightAuctions", "inventory.auctions.highlightAuctions") event.move(25, "inventory.highlightAuctionsUnderbid", "inventory.auctions.highlightAuctionsUnderbid") diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt index 7f0cedc7f1e9..0baae0861fba 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.inventory import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.inventory.ChestValueConfig.NumberFormatEntry import at.hannibal2.skyhanni.config.features.inventory.ChestValueConfig.SortingTypeEntry @@ -295,7 +296,7 @@ object ChestValue { private fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.transform(17, "inventory.chestValueConfig.formatType") { element -> ConfigUtils.migrateIntToEnum(element, NumberFormatEntry::class.java) diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt index f47a08bde047..42ab144fdb8f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt @@ -192,7 +192,7 @@ object HarpFeatures { event.stackTip = KeyboardManager.getKeyName(keyCode).take(3) } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "misc.harpKeybinds", "inventory.helper.harp.keybinds") event.move(2, "misc.harpNumbers", "inventory.helper.harp.showNumbers") 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 42e4fa07150f..d928516cd2b5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.inventory import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.jsonobjects.repo.HideNotClickableItemsJson import at.hannibal2.skyhanni.data.jsonobjects.repo.SalvageFilter @@ -617,7 +618,7 @@ object HideNotClickableItems { private fun isEnabled() = LorenzUtils.inSkyBlock && config.items - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "inventory.hideNotClickableItems", "inventory.hideNotClickable.items") event.move(3, "inventory.hideNotClickableItemsBlockClicks", "inventory.hideNotClickable.itemsBlockClicks") diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HighlightBonzoMasks.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HighlightBonzoMasks.kt index 41d673ad6263..6198c5037867 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HighlightBonzoMasks.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HighlightBonzoMasks.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.inventory import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -75,7 +76,7 @@ object HighlightBonzoMasks { maskTimers.clear() } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "inventory.highlightDepletedBonzosMasks", "itemAbilities.depletedBonzosMasks") } 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 e4ec55351758..d40d99f7253e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt @@ -60,7 +60,6 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import com.google.gson.JsonArray import com.google.gson.JsonElement import net.minecraft.item.ItemStack -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule object ItemDisplayOverlayFeatures { @@ -359,7 +358,7 @@ object ItemDisplayOverlayFeatures { return text } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.transform(11, "inventory.itemNumberAsStackSize") { element -> ConfigUtils.migrateIntArrayListToEnumArrayList(element, ItemNumberEntry::class.java) diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/RngMeterInventory.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/RngMeterInventory.kt index 2d6916355451..805d9a45778e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/RngMeterInventory.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/RngMeterInventory.kt @@ -58,7 +58,7 @@ object RngMeterInventory { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "inventory.rngMeterFloorName", "inventory.rngMeter.floorName") event.move(3, "inventory.rngMeterNoDrop", "inventory.rngMeter.noDrop") diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt index 41a12e13732a..258d5d6db48c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.inventory import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.inventory.SackDisplayConfig.NumberFormatEntry import at.hannibal2.skyhanni.config.features.inventory.SackDisplayConfig.PriceFormatEntry @@ -323,7 +324,7 @@ object SackDisplay { UNFORMATTED("Unformatted"), } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.transform(15, "inventory.sackDisplay.numberFormat") { element -> ConfigUtils.migrateIntToEnum(element, NumberFormatEntry::class.java) diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt index 935dc580bd90..f8e794bef4fd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt @@ -116,7 +116,7 @@ object StatsTuning { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "inventory.statsTuningSelectedStats", "inventory.statsTuning.selectedStats") event.move(3, "inventory.statsTuningSelectedTemplate", "inventory.statsTuning.selectedTemplate") diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/auctionhouse/AuctionHouseCopyUnderbidPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/auctionhouse/AuctionHouseCopyUnderbidPrice.kt index 329263f0a13d..0b297c120767 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/auctionhouse/AuctionHouseCopyUnderbidPrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/auctionhouse/AuctionHouseCopyUnderbidPrice.kt @@ -72,7 +72,7 @@ object AuctionHouseCopyUnderbidPrice { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(25, "inventory.copyUnderbidPrice", "inventory.auctions.autoCopyUnderbidPrice") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarApi.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarApi.kt index 855ad1668850..d621ccf3659a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarApi.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarApi.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.inventory.bazaar import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.OwnInventoryData import at.hannibal2.skyhanni.data.bazaar.HypixelBazaarFetcher @@ -176,7 +177,7 @@ object BazaarApi { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(25, "bazaar", "inventory.bazaar") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/caketracker/CakeTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/caketracker/CakeTracker.kt index 74a018db80ed..568d8acf36a0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/caketracker/CakeTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/caketracker/CakeTracker.kt @@ -168,7 +168,7 @@ object CakeTracker { } } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { ConditionalUtils.onToggle(config.maxHeight) { lastKnownCakeDataHash = 0 diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryAPI.kt index e256250cbaea..113b8be4596a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryAPI.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.inventory.chocolatefactory import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.inventory.chocolatefactory.ChocolateFactoryConfig import at.hannibal2.skyhanni.config.storage.ProfileSpecificStorage.ChocolateFactoryStorage @@ -174,7 +175,7 @@ object ChocolateFactoryAPI { ChocolateFactoryUpgrade.updateIgnoredSlots() } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { val old = "event.chocolateFactory" val new = "inventory.chocolateFactory" diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryDataLoader.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryDataLoader.kt index bf759fceac39..b192476290a3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryDataLoader.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryDataLoader.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.inventory.chocolatefactory +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent @@ -246,7 +247,7 @@ object ChocolateFactoryDataLoader { clearData() } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move( 47, @@ -255,7 +256,7 @@ object ChocolateFactoryDataLoader { ) } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { val soundProperty = config.rabbitWarning.specialRabbitSound ConditionalUtils.onToggle(soundProperty) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStats.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStats.kt index 02d6b50915a4..05666a1bad1e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStats.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStats.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.inventory.chocolatefactory +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.SecondPassedEvent @@ -187,7 +188,7 @@ object ChocolateFactoryStats { ) } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.transform(42, "event.chocolateFactory.statsDisplayList") { element -> addToDisplayList(element, "TIME_TOWER", "TIME_TO_PRESTIGE") diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayTracker.kt index 22e2013f397d..53692ff22ddf 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayTracker.kt @@ -327,7 +327,7 @@ object ChocolateFactoryStrayTracker { return newElement } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.transform(58, "chocolateFactory.strayTracker.straysCaught") { element -> migrateJsonStringKeyToRarityKey(element, LorenzRarity::class.java) diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/GuardianReminder.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/GuardianReminder.kt index 12cbcf659e28..237786a48c22 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/GuardianReminder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/GuardianReminder.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.inventory.experimentationtable import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent @@ -80,7 +81,7 @@ object GuardianReminder { GlStateManager.popMatrix() } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(59, "inventory.helper.enchanting.guardianReminder", "inventory.experimentationTable.guardianReminder") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/SuperpairsClicksAlert.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/SuperpairsClicksAlert.kt index 379d3aa50a71..5ded459d4a6e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/SuperpairsClicksAlert.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/SuperpairsClicksAlert.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.inventory.experimentationtable import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.InventoryOpenEvent import at.hannibal2.skyhanni.events.InventoryUpdatedEvent @@ -71,7 +72,7 @@ object SuperpairsClicksAlert { .filter { it.key < 45 } .any { it.value.stackSize > roundsNeeded } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(46, "misc.superpairsClicksAlert", "inventory.helper.enchanting.superpairsClicksAlert") diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/UltraRareBookAlert.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/UltraRareBookAlert.kt index 5845b33536ec..5eb7d8dd60e7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/UltraRareBookAlert.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/UltraRareBookAlert.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.inventory.experimentationtable import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent @@ -84,7 +85,7 @@ object UltraRareBookAlert { enchantsFound = false } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(59, "inventory.helper.enchanting.ultraRareBookAlert", "inventory.experimentationTable.ultraRareBookAlert") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/TiaRelayHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/TiaRelayHelper.kt index 897d8bb03440..a366fa4737d5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/TiaRelayHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/TiaRelayHelper.kt @@ -141,7 +141,7 @@ object TiaRelayHelper { lastClickTime = SimpleTimeMark.now() } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "misc.tiaRelayMute", "inventory.helper.tiaRelay.tiaRelayMute") event.move(2, "misc.tiaRelayHelper", "inventory.helper.tiaRelay.soundHelper") diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/CustomWardrobe.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/CustomWardrobe.kt index 3e90b17f35d0..c463b380e99c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/CustomWardrobe.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/CustomWardrobe.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.inventory.wardrobe import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.core.config.Position import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiContainerEvent @@ -125,8 +126,8 @@ object CustomWardrobe { } } - @SubscribeEvent - fun onConfigUpdate(event: ConfigLoadEvent) { + @HandleEvent + fun onConfigLoad(event: ConfigLoadEvent) { with(config.spacing) { ConditionalUtils.onToggle( globalScale, outlineThickness, outlineBlur, diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/EstimatedWardrobePrice.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/EstimatedWardrobePrice.kt index 82acccf49874..bbb8ba3db86c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/EstimatedWardrobePrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/EstimatedWardrobePrice.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.inventory.wardrobe import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule @@ -33,7 +34,7 @@ object EstimatedWardrobePrice { private fun isEnabled() = LorenzUtils.inSkyBlock && config.armor && WardrobeAPI.inWardrobe() && !WardrobeAPI.inCustomWardrobe - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "misc.estimatedIemValueArmor", "misc.estimatedItemValues.armor") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/WardrobeAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/WardrobeAPI.kt index 18371d6d6250..0cfbd9846add 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/WardrobeAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/WardrobeAPI.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.inventory.wardrobe +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.events.DebugDataCollectEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent @@ -179,8 +180,8 @@ object WardrobeAPI { } } - @SubscribeEvent - fun onDebugCollect(event: DebugDataCollectEvent) { + @HandleEvent + fun onDebug(event: DebugDataCollectEvent) { event.title("Wardrobe") event.addIrrelevant { for (slot in slots) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/ChickenHeadTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/ChickenHeadTimer.kt index be4af7d4b563..88fbe36bfa30 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/ChickenHeadTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/ChickenHeadTimer.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.itemabilities import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -68,7 +69,7 @@ object ChickenHeadTimer { config.position.renderString(displayText, posLabel = "Chicken Head Timer") } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "misc.chickenHeadTimerHideChat", "itemAbilities.chickenHead.hideChat") event.move(2, "misc.chickenHeadTimerPosition", "itemAbilities.chickenHead.position") diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt index 8fc6f3349c12..58ea560393a2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt @@ -62,7 +62,7 @@ object FireVeilWandParticles { RenderUtils.drawCircle(Minecraft.getMinecraft().thePlayer, event.partialTicks, 3.5, color) } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "itemAbilities.fireVeilWandDisplayColor", "itemAbilities.fireVeilWands.displayColor") event.move(3, "itemAbilities.fireVeilWandDisplay", "itemAbilities.fireVeilWands.display") diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt index 943292379228..8145d090d541 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt @@ -415,7 +415,7 @@ object ItemAbilityCooldown { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(31, "itemAbilities", "inventory.itemAbilities") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsGuide.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsGuide.kt index 674d2f413bec..248035f7da77 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsGuide.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsGuide.kt @@ -80,7 +80,7 @@ object DeepCavernsGuide { updateConfig() } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { ConditionalUtils.onToggle(config.rainbowColor, config.monochromeColor, config.lookAhead) { updateConfig() @@ -170,7 +170,7 @@ object DeepCavernsGuide { fun isEnabled() = IslandType.DEEP_CAVERNS.isInIsland() && config.enabled - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(38, "mining.deepCavernsParkour", "mining.deepCavernsGuide") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/HighlightMiningCommissionMobs.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/HighlightMiningCommissionMobs.kt index c2445ddc0f18..177f6129a3a4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/HighlightMiningCommissionMobs.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/HighlightMiningCommissionMobs.kt @@ -103,7 +103,7 @@ object HighlightMiningCommissionMobs { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "misc.mining", "mining") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/MiningCommissionsBlocksColor.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/MiningCommissionsBlocksColor.kt index 4e3b6ed7e45a..78cf3a2fcbfb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/MiningCommissionsBlocksColor.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/MiningCommissionsBlocksColor.kt @@ -130,8 +130,8 @@ object MiningCommissionsBlocksColor { } } - @SubscribeEvent - fun onConfigReload(event: ConfigLoadEvent) { + @HandleEvent + fun onConfigLoad(event: ConfigLoadEvent) { color = config.color.get().toDyeColor() config.sneakQuickToggle.onToggle { oldSneakState = false @@ -152,8 +152,8 @@ object MiningCommissionsBlocksColor { replaceBlocksMapCache = mutableMapOf() } - @SubscribeEvent - fun onDebugDataCollect(event: DebugDataCollectEvent) { + @HandleEvent + fun onDebug(event: DebugDataCollectEvent) { event.title("Mining Commissions Blocks Color") if (!enabled) { event.addIrrelevant("not enabled") diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/MiningNotifications.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/MiningNotifications.kt index 43f8e97d2326..282ae9d43b1f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/MiningNotifications.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/MiningNotifications.kt @@ -98,7 +98,7 @@ object MiningNotifications { hasSentAscensionRope = false } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { ConditionalUtils.onToggle(config.coldThreshold) { if (MiningAPI.cold != config.coldThreshold.get()) hasSentCold = false diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/TunnelsMaps.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/TunnelsMaps.kt index a8365a6eaaa8..b8c9c9df6b8c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/TunnelsMaps.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/TunnelsMaps.kt @@ -13,12 +13,12 @@ import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.IslandChangeEvent import at.hannibal2.skyhanni.events.ItemClickEvent -import at.hannibal2.skyhanni.events.LorenzKeyPressEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.events.SkyHanniWarpEvent +import at.hannibal2.skyhanni.events.minecraft.KeyPressEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.CollectionUtils.addString @@ -256,7 +256,7 @@ object TunnelsMaps { } } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { onToggle( config.compactGemstone, @@ -477,8 +477,8 @@ object TunnelsMaps { null } ?: config.pathColour.toSpecialColor() - @SubscribeEvent - fun onKeyPress(event: LorenzKeyPressEvent) { + @HandleEvent + fun onKeyPress(event: KeyPressEvent) { if (!isEnabled()) return if (Minecraft.getMinecraft().currentScreen != null) return campfireKey(event) @@ -493,7 +493,7 @@ object TunnelsMaps { nextSpot() } - private fun campfireKey(event: LorenzKeyPressEvent) { + private fun campfireKey(event: KeyPressEvent) { if (event.keyCode != config.campfireKey) return if (config.travelScroll) { HypixelCommands.warp("basecamp") @@ -523,7 +523,7 @@ object TunnelsMaps { private var nextSpotDelay = SimpleTimeMark.farPast() - private fun nextSpotKey(event: LorenzKeyPressEvent) { + private fun nextSpotKey(event: KeyPressEvent) { if (event.keyCode != config.nextSpotHotkey) return nextSpot() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventDisplay.kt index 990efb478818..6868a651241f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventDisplay.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.mining.eventtracker import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.config.features.mining.MiningEventConfig @@ -129,7 +130,7 @@ object MiningEventDisplay { return (isOnValidMiningLocation || OutsideSbFeature.MINING_EVENT_DISPLAY.isSelected()) && config.enabled } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.transform(46, "mining.miningEvent.compressedFormat") { ConfigUtils.migrateBooleanToEnum(it, CompressFormat.COMPACT_TEXT, CompressFormat.DEFAULT) diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt index 54865161f225..885f2ec6bcc8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt @@ -251,7 +251,7 @@ object MiningEventTracker { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.transform(29, "mining.miningEvent.showType") { element -> if (element.asString == "BOTH") JsonPrimitive("ALL") else element diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/solver/FossilSolverDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/solver/FossilSolverDisplay.kt index 85d3041c77fa..b4f0f472e6e4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/solver/FossilSolverDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/solver/FossilSolverDisplay.kt @@ -220,7 +220,7 @@ object FossilSolverDisplay { config.position.renderStrings(displayList, posLabel = "Fossil Excavator Solver") } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(36, "mining.fossilExcavator", "mining.fossilExcavator2.solver") event.move(37, "mining.fossilExcavator2", "mining.fossilExcavator") diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/MineshaftWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/MineshaftWaypoints.kt index 4f8b11101581..9909f4d99f85 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/MineshaftWaypoints.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/MineshaftWaypoints.kt @@ -5,9 +5,9 @@ import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.PartyAPI import at.hannibal2.skyhanni.events.IslandChangeEvent -import at.hannibal2.skyhanni.events.LorenzKeyPressEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.events.minecraft.KeyPressEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.HypixelCommands import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer @@ -58,8 +58,8 @@ object MineshaftWaypoints { } } - @SubscribeEvent - fun onKeyPress(event: LorenzKeyPressEvent) { + @HandleEvent + fun onKeyPress(event: KeyPressEvent) { if (Minecraft.getMinecraft().currentScreen != null) return if (event.keyCode != config.shareWaypointLocation) return if (timeLastShared.passedSince() < 500.milliseconds) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt index 240464944fb0..573e02b17900 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt @@ -223,7 +223,7 @@ object PowderTracker { } } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { config.textFormat.afterChange { tracker.update() @@ -256,7 +256,7 @@ object PowderTracker { tracker.update() } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "misc.powderTrackerConfig", "mining.powderTracker") event.transform(8, "#profile.powderTracker") { old -> old.asJsonObject.get("0") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt index f3c5cb449ca3..251c82a16c04 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt @@ -429,7 +429,7 @@ object MinionFeatures { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "minions.lastClickedMinionDisplay", "minions.lastClickedMinion.display") event.move(3, "minions.lastOpenedMinionColor", "minions.lastClickedMinion.color") diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/AuctionHousePriceComparison.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/AuctionHousePriceComparison.kt index 6ee64373aebe..75b2d4d0ac4a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/AuctionHousePriceComparison.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/AuctionHousePriceComparison.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.InventoryOpenEvent @@ -122,7 +123,7 @@ object AuctionHousePriceComparison { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(31, "inventory.auctionsPriceComparison", "inventory.auctions.auctionsPriceComparison") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/BetterSignEditing.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/BetterSignEditing.kt index 096f7eeccd66..5078ba8e460e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/BetterSignEditing.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/BetterSignEditing.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.mixins.transformers.AccessorGuiEditSign @@ -71,7 +72,7 @@ object BetterSignEditing { pasteLastClicked = pasteClicked } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(16, "misc.pasteIntoSigns", "misc.betterSignEditing") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/BetterWikiFromMenus.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/BetterWikiFromMenus.kt index 3bfa54c7b841..3e61da76eed6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/BetterWikiFromMenus.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/BetterWikiFromMenus.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.features.commands.WikiManager @@ -17,7 +18,7 @@ object BetterWikiFromMenus { private val config get() = SkyHanniMod.feature.misc.commands.betterWiki - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(6, "fandomWiki", "commands.fandomWiki") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ButtonOnPause.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ButtonOnPause.kt index 6060d2afb3f4..39a9af068efc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ButtonOnPause.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ButtonOnPause.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigGuiManager import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule @@ -49,7 +50,7 @@ object ButtonOnPause { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "misc.configButtonOnPause", "gui.configButtonOnPause") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt index 8bbfbdb30256..8e79168c6186 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.events.ConfigLoadEvent @@ -17,7 +18,7 @@ object CustomTextBox { private val config get() = SkyHanniMod.feature.gui.customTextBox private var display = listOf() - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { display = config.text.get().format() @@ -47,7 +48,7 @@ object CustomTextBox { private fun isEnabled() = (LorenzUtils.inSkyBlock || OutsideSbFeature.CUSTOM_TEXT_BOX.isSelected()) && config.enabled - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "misc.textBox", "gui.customTextBox") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/HideArmor.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/HideArmor.kt index 8d3cdac42877..8a6f7c0645a8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/HideArmor.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/HideArmor.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.misc.HideArmorConfig.ModeEntry import at.hannibal2.skyhanni.events.SkyHanniRenderEntityEvent @@ -70,7 +71,7 @@ object HideArmor { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.transform(15, "misc.hideArmor2.mode") { element -> ConfigUtils.migrateIntToEnum(element, ModeEntry::class.java) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/IslandAreas.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/IslandAreas.kt index 8aabed587c05..c4bc07d5fefe 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/IslandAreas.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/IslandAreas.kt @@ -254,7 +254,7 @@ object IslandAreas { } } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { ConditionalUtils.onToggle(config.pathfinder.color) { targetNode?.let { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt index c84192a02b53..0be92291a287 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.DebugDataCollectEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -80,8 +81,8 @@ object LockMouseLook { } } - @SubscribeEvent - fun onDebugDataCollect(event: DebugDataCollectEvent) { + @HandleEvent + fun onDebug(event: DebugDataCollectEvent) { event.title("Mouse Lock") if (!lockedMouse) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt index 4cf0cc3f937b..34323ffb9734 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.events.ConfigLoadEvent @@ -92,7 +93,7 @@ object MarkedPlayerManager { return text } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { config.markOwnName.whenChanged { _, new -> val name = LorenzUtils.getPlayerName() @@ -127,7 +128,7 @@ object MarkedPlayerManager { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(31, "markedPlayers", "gui.markedPlayers") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/MiscFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/MiscFeatures.kt index 98d4205256e0..726e565e873e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/MiscFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/MiscFeatures.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.ReceiveParticleEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule @@ -49,7 +50,7 @@ object MiscFeatures { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "mobs", "combat.mobs") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/NoBitsWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/NoBitsWarning.kt index 2fd181c8f494..888373c3f483 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/NoBitsWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/NoBitsWarning.kt @@ -11,7 +11,6 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.SoundUtils import at.hannibal2.skyhanni.utils.SoundUtils.createSound -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds @SkyHanniModule @@ -39,7 +38,7 @@ object NoBitsWarning { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(35, "misc.noBitsWarning", "misc.noBitsWarning.enabled") event.move(40, "misc.noBitsWarning.enabled", "misc.bits.enableWarning") diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt index 31efab14d9d4..5279bbc356d4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt @@ -282,7 +282,7 @@ object NonGodPotEffectDisplay { ) } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "misc.nonGodPotEffectDisplay", "misc.potionEffect.nonGodPotEffectDisplay") event.move(3, "misc.nonGodPotEffectShowMixins", "misc.potionEffect.nonGodPotEffectShowMixins") diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt index c9ad14620610..bfbfeb3b99bf 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.ReceiveParticleEvent import at.hannibal2.skyhanni.features.dungeon.DungeonAPI @@ -45,7 +46,7 @@ object ParticleHider { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "misc.hideBlazeParticles", "misc.particleHiders.hideBlazeParticles") event.move(3, "misc.hideEndermanParticles", "misc.particleHiders.hideEndermanParticles") diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PatcherSendCoordinates.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PatcherSendCoordinates.kt index 5a0a2897fbac..82046eb7bde8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/PatcherSendCoordinates.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PatcherSendCoordinates.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent @@ -98,7 +99,7 @@ object PatcherSendCoordinates { data class PatcherBeacon(val location: LorenzVec, val name: String, val time: Long) - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(39, "misc.patcherSendCoordWaypoint", "misc.patcherCoordsWaypoint.enabled") } 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 d277c5797232..4b16c639e80e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt @@ -56,7 +56,7 @@ object PocketSackInASackDisplay { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(31, "misc.pocketSackInASack", "inventory.pocketSackInASack") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt index 9bbaa38ab15e..2eef9111c189 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.data.jsonobjects.repo.ModGuiSwitcherJson @@ -164,7 +165,7 @@ object QuickModMenuSwitch { fun isEnabled() = (LorenzUtils.inSkyBlock || OutsideSbFeature.QUICK_MOD_MENU_SWITCH.isSelected()) && config.enabled - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "dev.modMenuLog", "dev.debug.modMenuLog") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt index bf28ff0f85e9..be0e474156d4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.data.IslandType @@ -57,7 +58,7 @@ object TimeFeatures { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "misc.timeConfigs.winterTime", "event.winter.islandCloseTime") event.move(2, "misc.timeConfigs.winterTimePos", "event.winter.islandCloseTimePosition") diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt index 66973e288032..83899e1944c9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt @@ -123,7 +123,7 @@ object TpsCounter { config.tpsDisplay && (LorenzUtils.inSkyBlock || OutsideSbFeature.TPS_DISPLAY.isSelected()) - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "misc.tpsDisplayEnabled", "gui.tpsDisplay") event.move(2, "misc.tpsDisplayPosition", "gui.tpsDisplayPosition") diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/AdvancedPlayerList.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/AdvancedPlayerList.kt index 15556a5281c3..856677cd2c2c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/AdvancedPlayerList.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/AdvancedPlayerList.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc.compacttablist import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.misc.compacttablist.AdvancedPlayerListConfig.PlayerSortEntry import at.hannibal2.skyhanni.data.FriendAPI @@ -22,7 +23,6 @@ import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TimeLimitedCache import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.regex.Matcher import kotlin.random.Random import kotlin.time.Duration.Companion.minutes @@ -256,7 +256,7 @@ object AdvancedPlayerList { constructor(icon: String, score: Int) : this({ icon }, score) } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.transform(15, "misc.compactTabList.advancedPlayerList.playerSortOrder") { element -> ConfigUtils.migrateIntToEnum(element, PlayerSortEntry::class.java) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.kt index 816bb7699d79..421a5f954b24 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.kt @@ -14,7 +14,6 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeSFormattingCode import at.hannibal2.skyhanni.utils.StringUtils.trimWhiteSpaceAndResets import at.hannibal2.skyhanni.utils.TabListData import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent // heavily inspired by SBA code @SkyHanniModule @@ -277,7 +276,7 @@ object TabListReader { } } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { ConditionalUtils.onToggle(config.enabled) { updateTablistData() diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListRenderer.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListRenderer.kt index 4d9ae1762704..81e56c4283e2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListRenderer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListRenderer.kt @@ -220,7 +220,7 @@ object TabListRenderer { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(31, "misc.compactTabList", "gui.compactTabList") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt index 29f20fc050ed..20ae7c37a96e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt @@ -13,12 +13,12 @@ import at.hannibal2.skyhanni.data.HypixelData import at.hannibal2.skyhanni.data.jsonobjects.repo.StackingEnchantData import at.hannibal2.skyhanni.data.jsonobjects.repo.StackingEnchantsJson import at.hannibal2.skyhanni.events.ConfigLoadEvent -import at.hannibal2.skyhanni.events.LorenzKeyPressEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.events.minecraft.ClientDisconnectEvent +import at.hannibal2.skyhanni.events.minecraft.KeyPressEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.ChatUtils @@ -98,7 +98,7 @@ object DiscordRPCManager : IPCListener { private fun isConnected() = client?.status == PipeStatus.CONNECTED - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { ConditionalUtils.onToggle(config.firstLine, config.secondLine, config.customText) { if (isConnected()) { @@ -216,13 +216,13 @@ object DiscordRPCManager : IPCListener { } // Events that change things in DiscordStatus - @SubscribeEvent - fun onKeyClick(event: LorenzKeyPressEvent) { + @HandleEvent + fun onKeyPress(event: KeyPressEvent) { if (!isEnabled() || !PriorityEntry.AFK.isSelected()) return // autoPriority 4 is dynamic afk beenAfkFor = SimpleTimeMark.now() } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.transform(11, "misc.discordRPC.firstLine") { element -> ConfigUtils.migrateIntToEnum(element, LineEntry::class.java) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt index 6b9721e12754..c5bb3973b552 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt @@ -138,7 +138,7 @@ object EstimatedItemValue { cache.clear() } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { with(config) { ConditionalUtils.onToggle( @@ -247,7 +247,7 @@ object EstimatedItemValue { return newDisplay } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "misc.estimatedIemValueEnabled", "misc.estimatedItemValues.enabled") event.move(3, "misc.estimatedItemValueHotkey", "misc.estimatedItemValues.hotkey") diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/EnchantParser.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/EnchantParser.kt index 824f4b3c7c48..8c1661739348 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/EnchantParser.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/EnchantParser.kt @@ -91,7 +91,7 @@ object EnchantParser { this.enchants = event.getConstant("Enchants") } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { // Add observers to config options that would need us to mark cache dirty ConditionalUtils.onToggle( diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboTimeTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboTimeTracker.kt index 787140aab65c..d42d0fb0cc8c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboTimeTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboTimeTracker.kt @@ -138,7 +138,7 @@ object LimboTimeTracker { shownPB = false } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(27, oldPath = "misc.limboTimePB", newPath = "#player.personalBest") } @@ -169,8 +169,8 @@ object LimboTimeTracker { } } - @SubscribeEvent - fun onDebugDataCollect(event: DebugDataCollectEvent) { + @HandleEvent + fun onDebug(event: DebugDataCollectEvent) { event.title("Limbo") if (!inLimbo) { event.addIrrelevant("not in limbo") diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/pets/CurrentPetDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/pets/CurrentPetDisplay.kt index 8c920f4b3e17..b07a921a945f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/pets/CurrentPetDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/pets/CurrentPetDisplay.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc.pets import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.PetAPI import at.hannibal2.skyhanni.events.GuiRenderEvent @@ -90,7 +91,7 @@ object CurrentPetDisplay { config.displayPos.renderString(PetAPI.currentPet, posLabel = "Current Pet") } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "misc.petDisplay", "misc.pets.display") event.move(9, "misc.petDisplayPos", "misc.pets.displayPos") diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/pets/PetCandyUsedDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/pets/PetCandyUsedDisplay.kt index 048864f1b4d6..df98bbcbd3c8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/pets/PetCandyUsedDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/pets/PetCandyUsedDisplay.kt @@ -10,7 +10,6 @@ import at.hannibal2.skyhanni.utils.RenderUtils.drawSlotText import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getMaxPetLevel import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getPetCandyUsed import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getPetLevel -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule object PetCandyUsedDisplay { @@ -37,7 +36,7 @@ object PetCandyUsedDisplay { event.drawSlotText(x, y, stackTip, .9f) } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(22, "misc.petCandyUsed", "misc.petCandy.showCandy") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/pets/PetExpTooltip.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/pets/PetExpTooltip.kt index 7343f84df5e5..fd7306f6fbca 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/pets/PetExpTooltip.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/pets/PetExpTooltip.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc.pets import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule @@ -115,7 +116,7 @@ object PetExpTooltip { return Pair(maxLevel, maxXp) } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "misc.petExperienceToolTip.petDisplay", "misc.pets.petExperienceToolTip.petDisplay") event.move(3, "misc.petExperienceToolTip.showAlways", "misc.pets.petExperienceToolTip.showAlways") diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt index ec93e9a25b3d..c1cf24cd3d64 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt @@ -9,11 +9,11 @@ import at.hannibal2.skyhanni.data.Perk import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.events.LorenzKeyPressEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.SecondPassedEvent +import at.hannibal2.skyhanni.events.minecraft.KeyPressEvent import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.ColorUtils.addAlpha @@ -303,8 +303,8 @@ object TrevorFeatures { } } - @SubscribeEvent - fun onKeyClick(event: LorenzKeyPressEvent) { + @HandleEvent + fun onKeyPress(event: KeyPressEvent) { if (!onFarmingIsland()) return if (Minecraft.getMinecraft().currentScreen != null) return if (NEUItems.neuHasFocus()) return @@ -368,7 +368,7 @@ object TrevorFeatures { fun onFarmingIsland() = IslandType.THE_FARMING_ISLANDS.isInIsland() - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.transform(11, "misc.trevorTheTrapper.textFormat") { element -> ConfigUtils.migrateIntArrayListToEnumArrayList(element, TrackerEntry::class.java) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt index 76ed7c14cd1e..e22395aebf09 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc.update import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.features.About.UpdateStream import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.LorenzTickEvent @@ -43,7 +44,7 @@ object UpdateManager { return potentialUpdate?.update?.versionNumber?.asString } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { SkyHanniMod.feature.about.updateStream.onToggle { reset() diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/CrimsonMinibossRespawnTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/CrimsonMinibossRespawnTimer.kt index 3c5325697dbb..e876a66d4380 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/CrimsonMinibossRespawnTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/CrimsonMinibossRespawnTimer.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.nether import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.mob.MobData import at.hannibal2.skyhanni.events.DebugDataCollectEvent @@ -186,7 +187,7 @@ object CrimsonMinibossRespawnTimer { currentAreaBoss = null } - @SubscribeEvent + @HandleEvent fun onDebug(event: DebugDataCollectEvent) { event.title("Crimson Isle Miniboss") event.addIrrelevant { diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/SulphurSkitterBox.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/SulphurSkitterBox.kt index eb7fb814523e..9d14063edac5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/SulphurSkitterBox.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/SulphurSkitterBox.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.nether import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.crimsonisle.SulphurSkitterBoxConfig import at.hannibal2.skyhanni.data.IslandType @@ -111,7 +112,7 @@ object SulphurSkitterBox { fun isEnabled() = IslandType.CRIMSON_ISLE.isInIsland() && config.enabled && (!config.onlyWithRods || FishingAPI.holdingLavaRod) - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(24, "crimsonIsle.sulphurSkitterBoxConfig", "fishing.trophyFishing.sulphurSkitterBox") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt index 07cf723fa6f4..c0206963fb2b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.nether.ashfang +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -45,7 +46,7 @@ object AshfangFreezeCooldown { fun isCurrentlyFrozen() = unfrozenTime.isInFuture() - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "ashfang.freezeCooldown", "crimsonIsle.ashfang.freezeCooldown") event.move(2, "ashfang.freezeCooldownPos", "crimsonIsle.ashfang.freezeCooldownPos") diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHider.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHider.kt index a136fc56a7bd..e86ee7dda243 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHider.kt @@ -40,7 +40,7 @@ object AshfangHider { if (event.entity.getWholeInventory().any { it?.name == "Glowstone" }) event.cancel() } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "ashfang.hideDamageSplash", "crimsonIsle.ashfang.hide.damageSplash") event.move(2, "ashfang.hideParticles", "crimsonIsle.ashfang.hide.particles") diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHighlights.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHighlights.kt index 6c6107f0f4c4..ee74e92e9cd9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHighlights.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHighlights.kt @@ -93,7 +93,7 @@ object AshfangHighlights { private fun getColorCode(distance: Double): String = ColorUtils.blendRGB(LorenzColor.GREEN.toColor(), LorenzColor.RED.toColor(), distance / MAX_DISTANCE).getExtendedColorCode() - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "ashfang.blazingSouls", "crimsonIsle.ashfang.blazingSouls.enabled") event.move(2, "ashfang.blazingSoulsColor", "crimsonIsle.ashfang.blazingSouls.color") diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangManager.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangManager.kt index 13c7264851fe..c7b6d286b57a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangManager.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.nether.ashfang import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.crimsonisle.ashfang.AshfangConfig import at.hannibal2.skyhanni.data.IslandType @@ -83,7 +84,7 @@ object AshfangManager { lastSpawnTime = SimpleTimeMark.farPast() } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "ashfang.nextResetCooldown", "crimsonIsle.ashfang.nextResetCooldown") event.move(2, "ashfang.highlightBlazes", "crimsonIsle.ashfang.highlightBlazes") diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt index b77301edc06d..e515e73aceb6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.nether.ashfang +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule @@ -30,7 +31,7 @@ object AshfangNextResetCooldown { ) } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "ashfang.nextResetCooldown", "crimsonIsle.ashfang.nextResetCooldown") event.move(2, "ashfang.nextResetCooldownPos", "crimsonIsle.ashfang.nextResetCooldownPos") diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt index 4566fcb560d5..04d0a5948155 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt @@ -77,13 +77,17 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) { update() } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { ProfileStorageData.profileSpecific?.crimsonIsle?.let { miniBossHelper.loadData(it) kuudraBossHelper.loadData(it) questHelper.load(it) } + + config.hideComplete.afterChange { + updateRender() + } } @HandleEvent @@ -117,13 +121,6 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) { } } - @SubscribeEvent - fun onConfigInit(event: ConfigLoadEvent) { - config.hideComplete.afterChange { - updateRender() - } - } - private fun updateRender() { val newList = mutableListOf>() @@ -169,7 +166,7 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) { return config.hotkey.isKeyHeld() } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "misc.crimsonIsleReputationHelper", "crimsonIsle.reputationHelper.enabled") event.move(2, "misc.reputationHelperUseHotkey", "crimsonIsle.reputationHelper.useHotkey") diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt index af85ffaa1d2c..0d57f11602af 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt @@ -97,7 +97,7 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) { questLoader.checkInventory(event) } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { ConditionalUtils.onToggle(config.enabled) { if (IslandType.CRIMSON_ISLE.isInIsland()) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/colosseum/BlobbercystsHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/colosseum/BlobbercystsHighlight.kt index b5fa2c225afb..da134901d0be 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/colosseum/BlobbercystsHighlight.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/colosseum/BlobbercystsHighlight.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.rift.area.colosseum import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent @@ -51,7 +52,7 @@ object BlobbercystsHighlight { fun isEnabled() = RiftAPI.inRift() && config.highlightBlobbercysts && LorenzUtils.skyBlockArea == "Colosseum" - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(9, "rift.area.colosseumConfig", "rift.area.colosseum") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftAgaricusCap.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftAgaricusCap.kt index c777bb5bcc86..24555c2a0ae6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftAgaricusCap.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftAgaricusCap.kt @@ -92,7 +92,7 @@ object RiftAgaricusCap { fun isEnabled() = RiftAPI.inRift() && inArea && config.agaricusCap - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(9, "rift.area.dreadfarmConfig", "rift.area.dreadfarm") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftWiltedBerberisHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftWiltedBerberisHelper.kt index 88e7a371f4ec..604947024a15 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftWiltedBerberisHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftWiltedBerberisHelper.kt @@ -145,7 +145,7 @@ object RiftWiltedBerberisHelper { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(60, "rift.area.dreadfarm.wiltedBerberis.hideparticles", "rift.area.dreadfarm.wiltedBerberis.hideParticles") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt index 311aa0b20ab3..74be91d60fdc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt @@ -174,7 +174,7 @@ object LivingCaveDefenseBlocks { fun isEnabled() = RiftAPI.inRift() && config.enabled && RiftAPI.inLivingCave() - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(9, "rift.area.livingCaveConfig", "rift.area.livingCave") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt index 2645ae0a790a..c502d1095799 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt @@ -183,7 +183,7 @@ object DanceRoomHelper { fun isEnabled() = RiftAPI.inRift() && config.enabled - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(9, "rift.area.mirrorVerseConfig", "rift.area.mirrorverse") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftLavaMazeParkour.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftLavaMazeParkour.kt index 8d20ba6c256d..afe8c615a7c8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftLavaMazeParkour.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftLavaMazeParkour.kt @@ -55,7 +55,7 @@ object RiftLavaMazeParkour { } } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { ConditionalUtils.onToggle(config.rainbowColor, config.monochromeColor, config.lookAhead) { updateConfig() diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftUpsideDownParkour.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftUpsideDownParkour.kt index b77e099222a2..d7a8060d24b0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftUpsideDownParkour.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftUpsideDownParkour.kt @@ -54,7 +54,7 @@ object RiftUpsideDownParkour { } } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { ConditionalUtils.onToggle(config.rainbowColor, config.monochromeColor, config.lookAhead) { updateConfig() diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/TubulatorParkour.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/TubulatorParkour.kt index f4d8cdaa63c6..d2419c0ec0dc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/TubulatorParkour.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/TubulatorParkour.kt @@ -47,7 +47,7 @@ object TubulatorParkour { } } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { ConditionalUtils.onToggle(config.rainbowColor, config.monochromeColor, config.lookAhead) { updateConfig() diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt index dc1ee79ac35c..c848880a7e32 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt @@ -55,8 +55,8 @@ object RiftBloodEffigies { private fun cleanMap() = (0..5).associateWith { SimpleTimeMark.farPast() } - @SubscribeEvent - fun onDebugDataCollect(event: DebugDataCollectEvent) { + @HandleEvent + fun onDebug(event: DebugDataCollectEvent) { event.title("Rift Blood Effigies") if (!isEnabled()) { @@ -164,7 +164,7 @@ object RiftBloodEffigies { fun isEnabled() = RiftAPI.inRift() && config.enabled && RiftAPI.inStillgoreChateau() - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(9, "rift.area.stillgoreChateauConfig", "rift.area.stillgoreChateau") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/RiftGunthersRace.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/RiftGunthersRace.kt index 0c8529f4b256..5786b6580332 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/RiftGunthersRace.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/RiftGunthersRace.kt @@ -78,7 +78,7 @@ object RiftGunthersRace { updateConfig() } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { ConditionalUtils.onToggle(config.rainbowColor, config.monochromeColor, config.lookAhead) { updateConfig() diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminHighlighter.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminHighlighter.kt index 232b73dd219c..f84d2b8a80b4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminHighlighter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminHighlighter.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.rift.area.westvillage +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.features.rift.RiftAPI @@ -45,7 +46,7 @@ object VerminHighlighter { } } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { ConditionalUtils.onToggle(config.color) { // running setEntityColorWithNoHurtTime() again diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/kloon/KloonHacking.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/kloon/KloonHacking.kt index d5e04fb63081..0f0fbe033764 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/kloon/KloonHacking.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/kloon/KloonHacking.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.rift.area.westvillage.kloon +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.events.GuiContainerEvent @@ -172,7 +173,7 @@ object KloonHacking { return closestTerminal } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(9, "rift.area.westVillageConfig", "rift.area.westVillage") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/ShyCruxWarnings.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/ShyCruxWarnings.kt index 540fb3b816ef..8a13b4c2429b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/ShyCruxWarnings.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/ShyCruxWarnings.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.rift.area.wyldwoods +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.features.rift.RiftAPI @@ -28,7 +29,7 @@ object ShyCruxWarnings { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(9, "rift.area.wyldWoodsConfig", "rift.area.wyldWoods") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/CruxTalismanDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/CruxTalismanDisplay.kt index a01dc53ef141..d4525fa963c7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/CruxTalismanDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/CruxTalismanDisplay.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.rift.everywhere +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.SecondPassedEvent @@ -129,7 +130,7 @@ object CruxTalismanDisplay { update() } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { ConditionalUtils.onToggle(config.showBonuses) { update() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/PunchcardHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/PunchcardHighlight.kt index 5123b5d63f09..cb402a30337b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/PunchcardHighlight.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/PunchcardHighlight.kt @@ -91,8 +91,8 @@ object PunchcardHighlight { } } - @SubscribeEvent - fun onToggle(event: ConfigLoadEvent) { + @HandleEvent + fun onConfigLoad(event: ConfigLoadEvent) { ConditionalUtils.onToggle( config.highlight, config.color, diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftTimer.kt index 9202f1130f07..84e5f905976b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftTimer.kt @@ -111,7 +111,7 @@ object RiftTimer { changes[System.currentTimeMillis()] = diffFormat } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { ConditionalUtils.onToggle( config.percentage, diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/RiftMotesOrb.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/RiftMotesOrb.kt index b81f3598532a..508680ef61bb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/RiftMotesOrb.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/RiftMotesOrb.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.rift.everywhere.motes +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent @@ -102,7 +103,7 @@ object RiftMotesOrb { fun isEnabled() = RiftAPI.inRift() && config.enabled - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(9, "rift.area.motesOrbsConfig", "rift.area.motesOrbs") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt index 66f6ff438ed6..cebae05d0558 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.rift.everywhere.motes +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.rift.motes.RiftInventoryValueConfig.NumberFormatEntry import at.hannibal2.skyhanni.events.GuiRenderEvent @@ -194,7 +195,7 @@ object ShowMotesNpcSellPrice { private fun isInventoryValueEnabled() = RiftAPI.inRift() && config.inventoryValue.enabled - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.transform(15, "rift.motes.inventoryValue.formatType") { element -> ConfigUtils.migrateIntToEnum(element, NumberFormatEntry::class.java) diff --git a/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt b/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt index 9cffee3156f6..281f550c1fe1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt @@ -195,7 +195,7 @@ object SkillProgress { SoundUtils.createSound("random.levelup", 1f, 1f).playSound() } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { onToggle( config.enabled, diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt index 5e3eae25fbd9..446b927deea9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt @@ -223,7 +223,7 @@ object SlayerProfitTracker { getTracker()?.renderDisplay(config.pos) } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.transform(10, "#profile.slayerProfitData") { old -> for (data in old.asJsonObject.entrySet().map { it.value.asJsonObject }) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt index 2d56287adce3..8f33097f6a5b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt @@ -349,7 +349,7 @@ object VampireSlayerFeatures { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(9, "slayer.vampireSlayerConfig", "slayer.vampire") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt index 065331ec2939..777e5ba3de23 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt @@ -56,7 +56,7 @@ object BlazeSlayerClearView { return LorenzUtils.inSkyBlock && SkyHanniMod.feature.slayer.blazes.clearView && nearBlaze } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "slayer.blazeClearView", "slayer.blazes.clearView") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt index b32cc19ec1e8..1ee722c7a608 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt @@ -254,7 +254,7 @@ object BlazeSlayerDaggerHelper { config.positionBottom.renderString(textBottom, posLabel = "Blaze Slayer Dagger Bottom") } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "slayer.blazeDaggers", "slayer.blazes.hellion.daggers") event.move(3, "slayer.blazeMarkRightHellionShield", "slayer.blazes.hellion.markRightHellionShield") diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt index 76eb9a0d19ff..9fb4590b4366 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt @@ -70,7 +70,7 @@ object BlazeSlayerFirePitsWarning { BossType.SLAYER_BLAZE_TYPHOEUS_4, ) - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "slayer.firePitsWarning", "slayer.blazes.firePitsWarning") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShieldHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShieldHelper.kt index 5dec7f92a5f1..b01e78736fe6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShieldHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShieldHelper.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.slayer.blaze import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper @@ -15,7 +16,7 @@ object HellionShieldHelper { val hellionShieldMobs = mutableMapOf() - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "slayer.blazeColoredMobs", "slayer.blazes.hellion.coloredMobs") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt index f5bf6d707522..184f5a97adc6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt @@ -243,7 +243,7 @@ object EndermanSlayerFeatures { logger.log("Reset everything (world change)") } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move( 3, diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerHideParticles.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerHideParticles.kt index 9a3c0aa1face..c3a0f99c3fad 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerHideParticles.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerHideParticles.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.slayer.enderman import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.LorenzTickEvent @@ -50,7 +51,7 @@ object EndermanSlayerHideParticles { fun isEnabled() = IslandType.THE_END.isInIsland() && SkyHanniMod.feature.slayer.endermen.hideParticles - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "slayer.endermanHideParticles", "slayer.endermen.hideParticles") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/stranded/HighlightPlaceableNpcs.kt b/src/main/java/at/hannibal2/skyhanni/features/stranded/HighlightPlaceableNpcs.kt index c57297607184..00a2d8049a72 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/stranded/HighlightPlaceableNpcs.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/stranded/HighlightPlaceableNpcs.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.stranded import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent @@ -73,7 +74,7 @@ object HighlightPlaceableNpcs { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(31, "stranded", "misc.stranded") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt index 170b27f402c3..14b7031d1af6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.summonings import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.mob.Mob import at.hannibal2.skyhanni.events.GuiRenderEvent @@ -132,7 +133,7 @@ object SummoningMobManager { config.summoningMobDisplayPos.renderRenderable(renderable, posLabel = "Summoning Mob Display") } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "summonings", "combat.summonings") } diff --git a/src/main/java/at/hannibal2/skyhanni/test/DebugCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/DebugCommand.kt index 5b1a48d069ae..ba6e10ba590e 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/DebugCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/DebugCommand.kt @@ -45,7 +45,7 @@ object DebugCommand { profileName(event) profileType(event) - event.postAndCatch() + event.post() if (event.empty) { list.add("") diff --git a/src/main/java/at/hannibal2/skyhanni/test/HighlightMissingRepoItems.kt b/src/main/java/at/hannibal2/skyhanni/test/HighlightMissingRepoItems.kt index 04b9651c30c5..bbcf3a3787d2 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/HighlightMissingRepoItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/HighlightMissingRepoItems.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.test import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule @@ -45,7 +46,7 @@ object HighlightMissingRepoItems { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "dev.highlightMissingRepo", "dev.debug.highlightMissingRepo") } diff --git a/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt b/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt index 89e7c8514a2e..479a04da60bd 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt @@ -1,8 +1,9 @@ package at.hannibal2.skyhanni.test import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.events.LorenzKeyPressEvent +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent +import at.hannibal2.skyhanni.events.minecraft.KeyPressEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils @@ -25,8 +26,8 @@ object ParkourWaypointSaver { private var locations = mutableListOf() private var parkourHelper: ParkourHelper? = null - @SubscribeEvent - fun onKeyClick(event: LorenzKeyPressEvent) { + @HandleEvent + fun onKeyPress(event: KeyPressEvent) { if (!LorenzUtils.inSkyBlock && !config.parkourOutsideSB) return if (Minecraft.getMinecraft().currentScreen != null) return if (NEUItems.neuHasFocus()) return diff --git a/src/main/java/at/hannibal2/skyhanni/test/ShowItemUuid.kt b/src/main/java/at/hannibal2/skyhanni/test/ShowItemUuid.kt index f8c2029cf90d..5a845c7317c3 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/ShowItemUuid.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/ShowItemUuid.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.test import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule @@ -18,7 +19,7 @@ object ShowItemUuid { } } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "dev.showItemUuid", "dev.debug.showItemUuid") } diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt index fa14402b5c33..8f8f6cdf348c 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt @@ -634,7 +634,7 @@ object SkyHanniDebugsAndTests { // println("offset: $offset") } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "dev.debugEnabled", "dev.debug.enabled") event.move(3, "dev.showInternalName", "dev.debug.showInternalName") diff --git a/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt b/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt index 4bf183d74fbf..4e50baac24ca 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.test import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.InventoryUpdatedEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule @@ -112,7 +113,7 @@ object TestCopyBestiaryValues { SkyHanniDebugsAndTests.displayLine = "Bestiary for $titleName" } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "dev.copyBestiaryData", "dev.debug.copyBestiaryData") } diff --git a/src/main/java/at/hannibal2/skyhanni/test/TestCopyRngMeterValues.kt b/src/main/java/at/hannibal2/skyhanni/test/TestCopyRngMeterValues.kt index 5121e342139c..0bd4e7f169af 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/TestCopyRngMeterValues.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/TestCopyRngMeterValues.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.test import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent @@ -49,7 +50,7 @@ object TestCopyRngMeterValues { ChatUtils.debug("${map.size} items saved to clipboard.") } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "dev.copyRngMeter", "dev.debug.copyRngMeter") } diff --git a/src/main/java/at/hannibal2/skyhanni/test/TestExportTools.kt b/src/main/java/at/hannibal2/skyhanni/test/TestExportTools.kt index 20c825cf2824..90907d60bcdf 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/TestExportTools.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/TestExportTools.kt @@ -18,7 +18,6 @@ import com.google.gson.GsonBuilder import com.google.gson.JsonElement import net.minecraft.item.ItemStack import net.minecraft.nbt.NBTTagCompound -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.io.InputStreamReader import java.io.Reader @@ -71,7 +70,7 @@ object TestExportTools { return fromJson(category, reader) } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "dev.copyNBTDataCompressed", "dev.debug.copyNBTDataCompressed") event.move(4, "dev.debug.copyNBTData", "dev.debug.copyItemData") diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ComputerEnvDebug.kt b/src/main/java/at/hannibal2/skyhanni/utils/ComputerEnvDebug.kt index ff792adcbb1f..4dfdb274ab11 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ComputerEnvDebug.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ComputerEnvDebug.kt @@ -1,17 +1,17 @@ package at.hannibal2.skyhanni.utils +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.DebugDataCollectEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.system.PlatformUtils -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule object ComputerEnvDebug { - @SubscribeEvent - fun onDebugDataCollect(event: DebugDataCollectEvent) { + @HandleEvent + fun onDebug(event: DebugDataCollectEvent) { os(event) java(event) launcher(event) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ComputerTimeOffset.kt b/src/main/java/at/hannibal2/skyhanni/utils/ComputerTimeOffset.kt index 7e61c03c3751..7f12a4547be6 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ComputerTimeOffset.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ComputerTimeOffset.kt @@ -8,7 +8,6 @@ import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.TimeUtils.format import kotlinx.coroutines.launch -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import org.apache.commons.net.ntp.NTPUDPClient import java.net.InetAddress import kotlin.concurrent.thread @@ -114,8 +113,8 @@ object ComputerTimeOffset { ) } - @SubscribeEvent - fun onDebugCollect(event: DebugDataCollectEvent) { + @HandleEvent + fun onDebug(event: DebugDataCollectEvent) { event.title("Time Offset") val offset = offsetMillis ?: run { event.addIrrelevant("not calculated yet") diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt index 0b86be39b195..4bb28c0f2dd8 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.utils +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.NotificationManager import at.hannibal2.skyhanni.data.PetAPI import at.hannibal2.skyhanni.data.SkyHanniNotification @@ -31,7 +32,6 @@ import net.minecraft.nbt.NBTTagCompound import net.minecraft.nbt.NBTTagList import net.minecraft.nbt.NBTTagString import net.minecraftforge.common.util.Constants -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.LinkedList import java.util.regex.Matcher import kotlin.time.Duration.Companion.INFINITE @@ -552,8 +552,8 @@ object ItemUtils { it.key.getPrice(priceSource, pastRecipes) * it.value }.sum() - @SubscribeEvent - fun onDebugDataCollect(event: DebugDataCollectEvent) { + @HandleEvent + fun onDebug(event: DebugDataCollectEvent) { event.title("Missing Repo Items") if (missingRepoItems.isNotEmpty()) { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt b/src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt index 9c3b8e9b466f..47393b79e740 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt @@ -1,8 +1,8 @@ package at.hannibal2.skyhanni.utils import at.hannibal2.skyhanni.events.GuiKeyPressEvent -import at.hannibal2.skyhanni.events.LorenzKeyPressEvent import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.events.minecraft.KeyPressEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.test.command.ErrorManager import io.github.notenoughupdates.moulconfig.gui.GuiScreenElementWrapper @@ -71,21 +71,21 @@ object KeyboardManager { if (Mouse.getEventButtonState() && Mouse.getEventButton() != -1) { val key = Mouse.getEventButton() - 100 - LorenzKeyPressEvent(key).postAndCatch() + KeyPressEvent(key).post() lastClickedMouseButton = key return } if (Keyboard.getEventKeyState() && Keyboard.getEventKey() != 0) { val key = Keyboard.getEventKey() - LorenzKeyPressEvent(key).postAndCatch() + KeyPressEvent(key).post() lastClickedMouseButton = -1 return } if (Mouse.getEventButton() == -1 && lastClickedMouseButton != -1) { if (lastClickedMouseButton.isKeyHeld()) { - LorenzKeyPressEvent(lastClickedMouseButton).postAndCatch() + KeyPressEvent(lastClickedMouseButton).post() return } lastClickedMouseButton = -1 @@ -93,7 +93,7 @@ object KeyboardManager { // This is needed because of other keyboards that don't have a key code for the key, but is read as a character if (Keyboard.getEventKey() == 0) { - LorenzKeyPressEvent(Keyboard.getEventCharacter().code + 256).postAndCatch() + KeyPressEvent(Keyboard.getEventCharacter().code + 256).post() } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt b/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt index 19e912215df2..eb769bf3b4e7 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt @@ -1,9 +1,9 @@ package at.hannibal2.skyhanni.utils import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import org.apache.logging.log4j.Level import org.apache.logging.log4j.LogManager import org.apache.logging.log4j.Marker @@ -237,7 +237,7 @@ class MinecraftConsoleFilter(private val loggerConfigName: String) : AbstractFil return Filter.Result.ACCEPT } - @SubscribeEvent + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "dev.printUnfilteredDebugs", "dev.minecraftConsoles.printUnfilteredDebugs") event.move(3, "dev.logUnfilteredFile", "dev.minecraftConsoles.logUnfilteredFile") diff --git a/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternManager.kt b/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternManager.kt index 0ae922f55b7d..f6f18479e1e0 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternManager.kt @@ -167,7 +167,7 @@ object RepoPatternManager { reloadPatterns() } - @SubscribeEvent + @HandleEvent fun onConfigLoad(event: ConfigLoadEvent) { config.forceLocal.afterChange { reloadPatterns() } } From a19df7d95ce731796b29e8d68339d1f4514c4300 Mon Sep 17 00:00:00 2001 From: martimavocado <39881008+martimavocado@users.noreply.github.com> Date: Sat, 14 Dec 2024 00:54:20 +0000 Subject: [PATCH 21/21] Fix + Backend: Allow removing items with ReplaceItemEvent (#3057) --- .../skyhanni/events/render/gui/ReplaceItemEvent.kt | 12 +++++++++++- .../garden/inventory/plots/GardenPlotIcon.kt | 2 +- .../features/inventory/CarnivalShopHelper.kt | 4 ++-- .../skyhanni/features/inventory/EssenceShopHelper.kt | 2 +- .../skyhanni/features/misc/UserLuckBreakdown.kt | 2 +- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/events/render/gui/ReplaceItemEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/render/gui/ReplaceItemEvent.kt index 55887f7b995c..e0c69a314d55 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/render/gui/ReplaceItemEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/render/gui/ReplaceItemEvent.kt @@ -9,11 +9,17 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable class ReplaceItemEvent(val inventory: IInventory, val originalItem: ItemStack, val slot: Int) : SkyHanniEvent() { var replacement: ItemStack? = null private set + var shouldRemove = false + private set - fun replace(replacement: ItemStack?) { + fun replace(replacement: ItemStack) { this.replacement = replacement } + fun remove() { + shouldRemove = true + } + companion object { @JvmStatic fun postEvent( @@ -25,6 +31,10 @@ class ReplaceItemEvent(val inventory: IInventory, val originalItem: ItemStack, v val originalItem = inventoryContents.getOrNull(slot) ?: return val event = ReplaceItemEvent(inventory, originalItem, slot) event.post() + if (event.shouldRemove) { + cir.returnValue = null + return + } event.replacement?.let { cir.returnValue = it } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/plots/GardenPlotIcon.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/plots/GardenPlotIcon.kt index 09f73fc6d4bb..db18e91e6fea 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/plots/GardenPlotIcon.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/plots/GardenPlotIcon.kt @@ -81,7 +81,7 @@ object GardenPlotIcon { lastClickedSlotId = -1 return } - event.replace(cachedStack[event.slot]) + cachedStack[event.slot]?.let { event.replace(it) } } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/CarnivalShopHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/CarnivalShopHelper.kt index 904e3f62c72d..270b3492a4f6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/CarnivalShopHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/CarnivalShopHelper.kt @@ -100,12 +100,12 @@ object CarnivalShopHelper { private fun tryReplaceShopSpecificStack(event: ReplaceItemEvent) { if (currentProgress == null || event.isUnknownShop()) return - shopSpecificInfoItemStack.let { event.replace(it) } + shopSpecificInfoItemStack?.let { event.replace(it) } } private fun tryReplaceOverviewStack(event: ReplaceItemEvent) { if (!overviewInventoryNamesPattern.matches(event.inventory.name)) return - overviewInfoItemStack.let { event.replace(it) } + overviewInfoItemStack?.let { event.replace(it) } } @HandleEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/EssenceShopHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/EssenceShopHelper.kt index 0000d72747e8..a40a44824140 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/EssenceShopHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/EssenceShopHelper.kt @@ -113,7 +113,7 @@ object EssenceShopHelper { fun replaceItem(event: ReplaceItemEvent) { if (!isEnabled() || essenceShops.isEmpty() || currentProgress == null || event.slot != CUSTOM_STACK_LOCATION) return if (!essenceShopPattern.matches(event.inventory.name)) return - infoItemStack.let { event.replace(it) } + infoItemStack?.let { event.replace(it) } } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/UserLuckBreakdown.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/UserLuckBreakdown.kt index 79affc11063e..d13c646702b0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/UserLuckBreakdown.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/UserLuckBreakdown.kt @@ -104,7 +104,7 @@ object UserLuckBreakdown { 10 -> event.replace(skillsItem) 11 -> event.replace(limboItem) - in validItemSlots -> event.replace(null) + in validItemSlots -> event.remove() in invalidItemSlots -> { if (event.originalItem.item == limboID.getItemStack().item) return