diff options
author | CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> | 2024-06-08 13:33:35 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-08 13:33:35 +1000 |
commit | 5b3ee9de1856d9989e20cc4d534cac17089ce0e5 (patch) | |
tree | 6186c64e1f7d59c2dd04b7ffb05925609811895a /src/main/java | |
parent | aaca5f08d47732b3db5329a3a9404281b21d2f55 (diff) | |
download | skyhanni-5b3ee9de1856d9989e20cc4d534cac17089ce0e5.tar.gz skyhanni-5b3ee9de1856d9989e20cc4d534cac17089ce0e5.tar.bz2 skyhanni-5b3ee9de1856d9989e20cc4d534cac17089ce0e5.zip |
Backend: Start using new event system (#2023)
Diffstat (limited to 'src/main/java')
37 files changed, 78 insertions, 60 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 020ca7c88..48ec9e8bd 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -17,7 +17,7 @@ import at.hannibal2.skyhanni.data.jsonobjects.local.KnownFeaturesJson import at.hannibal2.skyhanni.data.jsonobjects.local.VisualWordsJson import at.hannibal2.skyhanni.data.repo.RepoManager import at.hannibal2.skyhanni.events.LorenzTickEvent -import at.hannibal2.skyhanni.events.PreInitFinishedEvent +import at.hannibal2.skyhanni.events.utils.PreInitFinishedEvent import at.hannibal2.skyhanni.features.bingo.card.BingoCardDisplay import at.hannibal2.skyhanni.features.bingo.card.nextstephelper.BingoNextStepHelper import at.hannibal2.skyhanni.features.chat.Translator @@ -94,7 +94,7 @@ class SkyHanniMod { Commands.init() - PreInitFinishedEvent().postAndCatch() + PreInitFinishedEvent().post() } @Mod.EventHandler diff --git a/src/main/java/at/hannibal2/skyhanni/api/FmlEventApi.kt b/src/main/java/at/hannibal2/skyhanni/api/FmlEventApi.kt index 784409637..c2b1571f4 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/FmlEventApi.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/FmlEventApi.kt @@ -12,7 +12,7 @@ object FmlEventApi { @SubscribeEvent fun onDisconnect(event: FMLNetworkEvent.ClientDisconnectionFromServerEvent) { - ClientDisconnectEvent().postAndCatch() + ClientDisconnectEvent().post() } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/data/GuiData.kt b/src/main/java/at/hannibal2/skyhanni/data/GuiData.kt index e128143e1..c51e4cccc 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GuiData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GuiData.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.data +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent @@ -60,7 +61,7 @@ object GuiData { preDrawEventCanceled = false } - @SubscribeEvent + @HandleEvent fun onDisconnect(event: ClientDisconnectEvent) { preDrawEventCanceled = false } diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt index a46ff6de4..06ed7f44f 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.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.Companion.gson import at.hannibal2.skyhanni.data.model.TabWidget import at.hannibal2.skyhanni.events.HypixelJoinEvent @@ -235,7 +236,7 @@ class HypixelData { skyBlockAreaWithSymbol = null } - @SubscribeEvent + @HandleEvent fun onDisconnect(event: ClientDisconnectEvent) { hypixelLive = false hypixelAlpha = false diff --git a/src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt b/src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt index 70cd9cd34..482b590fe 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt @@ -37,7 +37,7 @@ object ToolTipData { @JvmStatic fun onHover(stack: ItemStack, toolTip: MutableList<String>) { - ItemHoverEvent(stack, toolTip).postAndCatch() + ItemHoverEvent(stack, toolTip).post() } var lastSlot: Slot? = null 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 452fa09b3..a5e34f0fc 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.data.mob 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.logger import at.hannibal2.skyhanni.data.mob.MobFilter.isDisplayNPC @@ -333,7 +334,7 @@ object MobDetection { allEntitiesViaPacketId.add(id) } - @SubscribeEvent + @HandleEvent fun onDisconnect(event: ClientDisconnectEvent) { shouldClear.set(true) } diff --git a/src/main/java/at/hannibal2/skyhanni/events/PreInitFinishedEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/PreInitFinishedEvent.kt deleted file mode 100644 index 8294b8bd7..000000000 --- a/src/main/java/at/hannibal2/skyhanni/events/PreInitFinishedEvent.kt +++ /dev/null @@ -1,3 +0,0 @@ -package at.hannibal2.skyhanni.events - -class PreInitFinishedEvent : LorenzEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/bingo/BingoCardUpdateEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/bingo/BingoCardUpdateEvent.kt index f7406498b..de9a83214 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/bingo/BingoCardUpdateEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/bingo/BingoCardUpdateEvent.kt @@ -1,5 +1,5 @@ package at.hannibal2.skyhanni.events.bingo -import at.hannibal2.skyhanni.events.LorenzEvent +import at.hannibal2.skyhanni.api.event.SkyHanniEvent -class BingoCardUpdateEvent : LorenzEvent() +class BingoCardUpdateEvent : SkyHanniEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/bingo/BingoGoalReachedEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/bingo/BingoGoalReachedEvent.kt index b091c24f3..06d392251 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/bingo/BingoGoalReachedEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/bingo/BingoGoalReachedEvent.kt @@ -1,6 +1,6 @@ package at.hannibal2.skyhanni.events.bingo -import at.hannibal2.skyhanni.events.LorenzEvent +import at.hannibal2.skyhanni.api.event.SkyHanniEvent import at.hannibal2.skyhanni.features.bingo.card.goals.BingoGoal -class BingoGoalReachedEvent(val goal: BingoGoal) : LorenzEvent() +class BingoGoalReachedEvent(val goal: BingoGoal) : SkyHanniEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/diana/InquisitorFoundEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/diana/InquisitorFoundEvent.kt index 9978c6f3c..9061eaa72 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/diana/InquisitorFoundEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/diana/InquisitorFoundEvent.kt @@ -1,6 +1,6 @@ package at.hannibal2.skyhanni.events.diana -import at.hannibal2.skyhanni.events.LorenzEvent +import at.hannibal2.skyhanni.api.event.SkyHanniEvent import net.minecraft.client.entity.EntityOtherPlayerMP -class InquisitorFoundEvent(val inquisitorEntity: EntityOtherPlayerMP) : LorenzEvent() +class InquisitorFoundEvent(val inquisitorEntity: EntityOtherPlayerMP) : SkyHanniEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/farming/FarmingLaneSwitchEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/farming/FarmingLaneSwitchEvent.kt deleted file mode 100644 index 3f78fd9c0..000000000 --- a/src/main/java/at/hannibal2/skyhanni/events/farming/FarmingLaneSwitchEvent.kt +++ /dev/null @@ -1,6 +0,0 @@ -package at.hannibal2.skyhanni.events.farming - -import at.hannibal2.skyhanni.events.LorenzEvent -import at.hannibal2.skyhanni.features.garden.farming.lane.FarmingLane - -class FarmingLaneSwitchEvent(val lane: FarmingLane?) : LorenzEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/fishing/TrophyFishCaughtEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/fishing/TrophyFishCaughtEvent.kt index 358b057bc..46215c90e 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/fishing/TrophyFishCaughtEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/fishing/TrophyFishCaughtEvent.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.events.fishing -import at.hannibal2.skyhanni.events.LorenzEvent +import at.hannibal2.skyhanni.api.event.SkyHanniEvent import at.hannibal2.skyhanni.features.fishing.trophy.TrophyRarity // trophyFishName is NO Neu Internal Name -class TrophyFishCaughtEvent(val trophyFishName: String, val rarity: TrophyRarity) : LorenzEvent() +class TrophyFishCaughtEvent(val trophyFishName: String, val rarity: TrophyRarity) : SkyHanniEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/garden/farming/FarmingLaneSwitchEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/garden/farming/FarmingLaneSwitchEvent.kt new file mode 100644 index 000000000..c2e514135 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/events/garden/farming/FarmingLaneSwitchEvent.kt @@ -0,0 +1,6 @@ +package at.hannibal2.skyhanni.events.garden.farming + +import at.hannibal2.skyhanni.api.event.SkyHanniEvent +import at.hannibal2.skyhanni.features.garden.farming.lane.FarmingLane + +class FarmingLaneSwitchEvent(val lane: FarmingLane?) : SkyHanniEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/garden/pests/PestSpawnEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/garden/pests/PestSpawnEvent.kt index 219516b9b..5c441a2de 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/garden/pests/PestSpawnEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/garden/pests/PestSpawnEvent.kt @@ -1,5 +1,5 @@ package at.hannibal2.skyhanni.events.garden.pests -import at.hannibal2.skyhanni.events.LorenzEvent +import at.hannibal2.skyhanni.api.event.SkyHanniEvent -class PestSpawnEvent(val amountPests: Int, val plotNames: List<String>, val unknownAmount: Boolean) : LorenzEvent() +class PestSpawnEvent(val amountPests: Int, val plotNames: List<String>, val unknownAmount: Boolean) : SkyHanniEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/garden/pests/PestUpdateEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/garden/pests/PestUpdateEvent.kt index 6f444fa86..c4c299b13 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/garden/pests/PestUpdateEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/garden/pests/PestUpdateEvent.kt @@ -1,5 +1,5 @@ package at.hannibal2.skyhanni.events.garden.pests -import at.hannibal2.skyhanni.events.LorenzEvent +import at.hannibal2.skyhanni.api.event.SkyHanniEvent -class PestUpdateEvent : LorenzEvent() +class PestUpdateEvent : SkyHanniEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/item/ItemHoverEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/item/ItemHoverEvent.kt index 343883841..1081f8647 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/item/ItemHoverEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/item/ItemHoverEvent.kt @@ -1,9 +1,9 @@ package at.hannibal2.skyhanni.events.item -import at.hannibal2.skyhanni.events.LorenzEvent +import at.hannibal2.skyhanni.api.event.SkyHanniEvent import net.minecraft.item.ItemStack -class ItemHoverEvent(val itemStack: ItemStack, private val toolTip0: MutableList<String>) : LorenzEvent() { +class ItemHoverEvent(val itemStack: ItemStack, private val toolTip0: MutableList<String>) : SkyHanniEvent() { var toolTip set(value) { toolTip0.clear() diff --git a/src/main/java/at/hannibal2/skyhanni/events/minecraft/ClientDisconnectEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/minecraft/ClientDisconnectEvent.kt index b041fc595..6c7a5e8a1 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/minecraft/ClientDisconnectEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/minecraft/ClientDisconnectEvent.kt @@ -1,5 +1,5 @@ package at.hannibal2.skyhanni.events.minecraft -import at.hannibal2.skyhanni.events.LorenzEvent +import at.hannibal2.skyhanni.api.event.SkyHanniEvent -class ClientDisconnectEvent : LorenzEvent() +class ClientDisconnectEvent : SkyHanniEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/utils/PreInitFinishedEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/utils/PreInitFinishedEvent.kt new file mode 100644 index 000000000..1d52761ed --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/events/utils/PreInitFinishedEvent.kt @@ -0,0 +1,5 @@ +package at.hannibal2.skyhanni.events.utils + +import at.hannibal2.skyhanni.api.event.SkyHanniEvent + +class PreInitFinishedEvent : SkyHanniEvent() 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 b00b88569..72d8fb955 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 @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.bingo.card import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent @@ -247,7 +248,7 @@ class BingoCardDisplay { private fun canEditDisplay() = Minecraft.getMinecraft().currentScreen is GuiInventory || InventoryUtils.openInventoryName() == "Bingo Card" - @SubscribeEvent + @HandleEvent fun onBingoCardUpdate(event: BingoCardUpdateEvent) { if (!config.enabled) return if (!LorenzUtils.isBingoProfile) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardReader.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardReader.kt index 6d4a45789..b04a081ea 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardReader.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardReader.kt @@ -96,7 +96,7 @@ object BingoCardReader { } BingoAPI.lastBingoCardOpenTime = SimpleTimeMark.now() - BingoCardUpdateEvent().postAndCatch() + BingoCardUpdateEvent().post() } private fun bingoGoalDifference(bingoGoal: BingoGoal, new: Double) { @@ -162,8 +162,8 @@ object BingoCardReader { val goal = BingoAPI.personalGoals.firstOrNull { it.displayName == name } ?: return goal.done = true - BingoGoalReachedEvent(goal).postAndCatch() - BingoCardUpdateEvent().postAndCatch() + BingoGoalReachedEvent(goal).post() + BingoCardUpdateEvent().post() } private fun BingoData.getDescriptionLine() = "ยง7" + note.joinToString(" ") diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaAPI.kt index a8c440efe..468c3ecbe 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaAPI.kt @@ -35,7 +35,7 @@ object DianaAPI { @HandleEvent(onlyOnSkyblock = true) fun onJoinWorld(event: EntityEnterWorldEvent<EntityOtherPlayerMP>) { if (event.entity.name == "Minos Inquisitor") { - InquisitorFoundEvent(event.entity).postAndCatch() + InquisitorFoundEvent(event.entity).post() } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/HighlightInquisitors.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/HighlightInquisitors.kt index e37041717..0d1cd7bd0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/HighlightInquisitors.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/HighlightInquisitors.kt @@ -1,18 +1,18 @@ package at.hannibal2.skyhanni.features.event.diana import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.diana.InquisitorFoundEvent import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColorInt -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule object HighlightInquisitors { private val config get() = SkyHanniMod.feature.event.diana - @SubscribeEvent + @HandleEvent fun onInquisitorFound(event: InquisitorFoundEvent) { if (!config.highlightInquisitors) return 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 238b951c2..268eacf0e 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 @@ -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.events.EntityHealthUpdateEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzKeyPressEvent @@ -109,7 +110,7 @@ object InquisitorWaypointShare { val inquisitorTime = mutableListOf<SimpleTimeMark>() - @SubscribeEvent + @HandleEvent fun onInquisitorFound(event: InquisitorFoundEvent) { val inquisitor = event.inquisitorEntity inquisitorsNearby = inquisitorsNearby.editCopy { add(inquisitor) } 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 c1522c88d..d54f7cf48 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 @@ -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.features.fishing.trophyfishing.TrophyFishDisplayConfig.HideCaught import at.hannibal2.skyhanni.config.features.fishing.trophyfishing.TrophyFishDisplayConfig.TextPart import at.hannibal2.skyhanni.config.features.fishing.trophyfishing.TrophyFishDisplayConfig.TrophySorting @@ -58,7 +59,7 @@ object TrophyFishDisplay { } } - @SubscribeEvent + @HandleEvent fun onTrophyFishCaught(event: TrophyFishCaughtEvent) { recentlyDroppedTrophies[getInternalName(event.trophyFishName)] = event.rarity update() 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 562ea732a..606f78041 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 @@ -47,7 +47,7 @@ object TrophyFishMessages { val trophyFishes = TrophyFishManager.fish ?: return val trophyFishCounts = trophyFishes.getOrPut(internalName) { mutableMapOf() } val amount = trophyFishCounts.addOrPut(rarity, 1) - TrophyFishCaughtEvent(internalName, rarity).postAndCatch() + TrophyFishCaughtEvent(internalName, rarity).post() if (shouldBlockTrophyFish(rarity, amount)) { event.blockedReason = "low_trophy_fish" diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/lane/FarmingLaneAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/lane/FarmingLaneAPI.kt index f01097d2d..0a29c85ec 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/lane/FarmingLaneAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/lane/FarmingLaneAPI.kt @@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.features.garden.farming.lane import at.hannibal2.skyhanni.events.CropClickEvent import at.hannibal2.skyhanni.events.GardenToolChangeEvent -import at.hannibal2.skyhanni.events.farming.FarmingLaneSwitchEvent +import at.hannibal2.skyhanni.events.garden.farming.FarmingLaneSwitchEvent import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule @@ -38,7 +38,7 @@ object FarmingLaneAPI { if (currentLane == lane) return currentLane = lane - FarmingLaneSwitchEvent(lane).postAndCatch() + FarmingLaneSwitchEvent(lane).post() } private fun warnNoLane(crop: CropType?) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/lane/FarmingLaneFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/lane/FarmingLaneFeatures.kt index 180e57251..59a9f5e7b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/lane/FarmingLaneFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/lane/FarmingLaneFeatures.kt @@ -1,10 +1,11 @@ package at.hannibal2.skyhanni.features.garden.farming.lane +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.GardenToolChangeEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzTickEvent -import at.hannibal2.skyhanni.events.farming.FarmingLaneSwitchEvent +import at.hannibal2.skyhanni.events.garden.farming.FarmingLaneSwitchEvent import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.farming.lane.FarmingLaneAPI.getValue import at.hannibal2.skyhanni.features.garden.farming.lane.FarmingLaneAPI.setValue @@ -51,7 +52,7 @@ object FarmingLaneFeatures { ; } - @SubscribeEvent + @HandleEvent fun onFarmingLaneSwitch(event: FarmingLaneSwitchEvent) { display = emptyList() } 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 4508f6b99..0d3cadfac 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 @@ -1,5 +1,7 @@ package at.hannibal2.skyhanni.features.garden.pests +import at.hannibal2.skyhanni.api.event.HandleEvent +import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.events.DebugDataCollectEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent @@ -152,12 +154,11 @@ object PestAPI { private fun updatePests() { if (!firstScoreboardCheck) return fixPests() - PestUpdateEvent().postAndCatch() + PestUpdateEvent().post() } - @SubscribeEvent + @HandleEvent(onlyOnIsland = IslandType.GARDEN) fun onPestSpawn(event: PestSpawnEvent) { - if (!GardenAPI.inGarden()) return PestSpawnTimer.lastSpawnTime = SimpleTimeMark.now() val plotNames = event.plotNames for (plotName in plotNames) { 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 f691a7693..468c389a6 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 @@ -1,5 +1,6 @@ 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.events.GuiRenderEvent import at.hannibal2.skyhanni.events.IslandChangeEvent @@ -39,7 +40,7 @@ object PestFinder { private var display = emptyList<Renderable>() - @SubscribeEvent + @HandleEvent fun onPestUpdate(event: PestUpdateEvent) { update() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleWaypoint.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleWaypoint.kt index 9ed0f75ef..a4363a50e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleWaypoint.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleWaypoint.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden.pests import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.ClickType import at.hannibal2.skyhanni.events.ItemClickEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent @@ -169,7 +170,7 @@ object PestParticleWaypoint { reset() } - @SubscribeEvent + @HandleEvent fun onPestUpdate(event: PestUpdateEvent) { if (PestAPI.scoreboardPests == 0) reset() } 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 cc3d1d57d..0dcab57f5 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 @@ -119,7 +119,7 @@ object PestSpawn { } private fun pestSpawn(amount: Int, plotNames: List<String>, unknownAmount: Boolean) { - PestSpawnEvent(amount, plotNames, unknownAmount).postAndCatch() + PestSpawnEvent(amount, plotNames, unknownAmount).post() if (unknownAmount) return // todo make this work with offline pest spawn messages val plotName = plotNames.firstOrNull() ?: error("first plot name is null") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawnTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawnTimer.kt index c654d6462..1a958f77b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawnTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawnTimer.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.garden.pests +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.garden.pests.PestSpawnEvent import at.hannibal2.skyhanni.features.garden.GardenAPI @@ -16,7 +17,7 @@ object PestSpawnTimer { var lastSpawnTime = SimpleTimeMark.farPast() - @SubscribeEvent + @HandleEvent fun onPestSpawn(event: PestSpawnEvent) { lastSpawnTime = SimpleTimeMark.now() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt index 39c1f90c5..577c014b4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt @@ -1,6 +1,8 @@ package at.hannibal2.skyhanni.features.garden.visitor +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.features.garden.visitor.VisitorConfig +import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.GuiKeyPressEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent @@ -132,7 +134,7 @@ object VisitorListener { inventory.handleMouseClick_skyhanni(slot, slot.slotIndex, 0, 0) } - @SubscribeEvent + @HandleEvent(onlyOnIsland = IslandType.GARDEN) fun onTooltip(event: ItemHoverEvent) { if (!GardenAPI.onBarnPlot) return if (!VisitorAPI.inInventory) return 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 aaf41ac19..75b1d6ad3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.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.GuiKeyPressEvent @@ -130,7 +131,7 @@ object HarpFeatures { unSetGUIScale() } - @SubscribeEvent + @HandleEvent fun onDisconnect(event: ClientDisconnectEvent) { if (!config.guiScale) return unSetGUIScale() 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 44449b2db..1565b7871 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 @@ -5,6 +5,7 @@ package at.hannibal2.skyhanni.features.misc.discordrpc import at.hannibal2.skyhanni.SkyHanniMod.Companion.coroutineScope import at.hannibal2.skyhanni.SkyHanniMod.Companion.feature import at.hannibal2.skyhanni.SkyHanniMod.Companion.logger +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.misc.DiscordRPCConfig.LineEntry import at.hannibal2.skyhanni.config.features.misc.DiscordRPCConfig.PriorityEntry @@ -186,7 +187,7 @@ object DiscordRPCManager : IPCListener { } } - @SubscribeEvent + @HandleEvent fun onDisconnect(event: ClientDisconnectEvent) { stop() } 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 d0e198765..a2ed65ee7 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 @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc.items 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.ItemsJson import at.hannibal2.skyhanni.data.jsonobjects.repo.neu.NeuReforgeStoneJson @@ -64,9 +65,8 @@ object EstimatedItemValue { bookBundleAmount = data.bookBundleAmount } - @SubscribeEvent + @HandleEvent(onlyOnSkyblock = true) fun onTooltip(event: ItemHoverEvent) { - if (!LorenzUtils.inSkyBlock) return if (!config.enabled) return if (Minecraft.getMinecraft().currentScreen !is GuiProfileViewer) return 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 cc17fa17f..d52f8ccb4 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternManager.kt @@ -1,12 +1,13 @@ package at.hannibal2.skyhanni.utils.repopatterns import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.config.features.dev.RepoPatternConfig import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.LorenzEvent -import at.hannibal2.skyhanni.events.PreInitFinishedEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent +import at.hannibal2.skyhanni.events.utils.PreInitFinishedEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.ConditionalUtils.afterChange @@ -249,7 +250,7 @@ object RepoPatternManager { file.writeText(data) } - @SubscribeEvent + @HandleEvent fun onPreInitFinished(event: PreInitFinishedEvent) { wasPreinitialized = true val dumpDirective = System.getenv("SKYHANNI_DUMP_REGEXES") |