diff --git a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt index ac4b411df1f5..22d11710eef8 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt @@ -57,7 +57,7 @@ object CollectionAPI { "Mushroom" to "RED_MUSHROOM".toInternalName(), ) - @SubscribeEvent + @HandleEvent fun onProfileJoin(event: ProfileJoinEvent) { collectionValue.clear() } diff --git a/src/main/java/at/hannibal2/skyhanni/api/GetFromSackAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/GetFromSackAPI.kt index 6ee909a5f7e0..b7e4b4b850c5 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/GetFromSackAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/GetFromSackAPI.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.api import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.SackAPI import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent @@ -124,7 +125,7 @@ object GetFromSackAPI { } } - @SubscribeEvent + @HandleEvent fun onMessageToServer(event: MessageSendToServerEvent) { if (!LorenzUtils.inSkyBlock) return if (!config.queuedGFS && !config.bazaarGFS) return @@ -132,7 +133,7 @@ object GetFromSackAPI { val replacedEvent = GetFromSacksTabComplete.handleUnderlineReplace(event) queuedHandler(replacedEvent) bazaarHandler(replacedEvent) - if (replacedEvent.isCanceled) { + if (replacedEvent.isCancelled) { event.cancel() return } @@ -159,7 +160,7 @@ object GetFromSackAPI { } private fun bazaarHandler(event: MessageSendToServerEvent) { - if (event.isCanceled) return + if (event.isCancelled) return if (!config.bazaarGFS || LorenzUtils.noTradeMode) return lastItemStack = commandValidator(event.splitMessage.drop(1)).second } diff --git a/src/main/java/at/hannibal2/skyhanni/api/ReforgeAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/ReforgeAPI.kt index 46d941fe007a..01ce629e03a1 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/ReforgeAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/ReforgeAPI.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.api +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.jsonobjects.repo.neu.NeuReforgeJson import at.hannibal2.skyhanni.data.model.SkyblockStat import at.hannibal2.skyhanni.data.model.SkyblockStatList @@ -20,7 +21,6 @@ import com.google.gson.TypeAdapter import com.google.gson.stream.JsonReader import com.google.gson.stream.JsonWriter import net.minecraft.item.ItemStack -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule object ReforgeAPI { @@ -151,7 +151,7 @@ object ReforgeAPI { override fun toString(): String = "Reforge $name" } - @SubscribeEvent + @HandleEvent fun onNeuRepoReload(event: NeuRepositoryReloadEvent) { val reforgeStoneData = event.readConstant>("reforgestones", reforgeGson).values val reforgeData = event.readConstant>("reforges", reforgeGson).values diff --git a/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt index 4c7d1ad89d97..34a394d9dfa1 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt @@ -126,7 +126,7 @@ object SkillAPI { skillMultiplierPattern -> handleSkillPatternMultiplier(matcher, skillType, skillInfo) } - SkillExpGainEvent(skillType, matcher.group("gained").formatDouble()).postAndCatch() + SkillExpGainEvent(skillType, matcher.group("gained").formatDouble()).post() showDisplay = true lastUpdate = SimpleTimeMark.now() @@ -139,7 +139,7 @@ object SkillAPI { } } - @SubscribeEvent + @HandleEvent fun onNEURepoReload(event: NeuRepositoryReloadEvent) { val data = event.readConstant("leveling") @@ -274,7 +274,7 @@ object SkillAPI { calculateSkillLevel(totalXp, cap) if (skillInfo.overflowLevel > 60 && levelOverflow == skillInfo.overflowLevel + 1) - SkillOverflowLevelUpEvent(skillType, skillInfo.overflowLevel, levelOverflow).postAndCatch() + SkillOverflowLevelUpEvent(skillType, skillInfo.overflowLevel, levelOverflow).post() skillInfo.apply { this.level = level diff --git a/src/main/java/at/hannibal2/skyhanni/events/NeuEventWrappers.kt b/src/main/java/at/hannibal2/skyhanni/api/enoughupdates/NeuEventWrappers.kt similarity index 93% rename from src/main/java/at/hannibal2/skyhanni/events/NeuEventWrappers.kt rename to src/main/java/at/hannibal2/skyhanni/api/enoughupdates/NeuEventWrappers.kt index dc59e0b7aef4..d4ec8ea36ca1 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/NeuEventWrappers.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/enoughupdates/NeuEventWrappers.kt @@ -1,7 +1,9 @@ -package at.hannibal2.skyhanni.events +package at.hannibal2.skyhanni.api.enoughupdates import at.hannibal2.skyhanni.data.jsonobjects.other.HypixelApiTrophyFish import at.hannibal2.skyhanni.data.jsonobjects.other.HypixelPlayerApiJson +import at.hannibal2.skyhanni.events.NeuProfileDataLoadedEvent +import at.hannibal2.skyhanni.events.NeuRepositoryReloadEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.NumberUtil.isInt @@ -71,6 +73,6 @@ object NeuEventWrappers { @SubscribeEvent fun onNeuRepoReload(event: RepositoryReloadEvent) { - NeuRepositoryReloadEvent().postAndCatch() + NeuRepositoryReloadEvent.post() } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/BitsAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/BitsAPI.kt index a2646d6925dc..06f28d89ce28 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/BitsAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/BitsAPI.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.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.FameRanks.getFameRankByNameOrNull import at.hannibal2.skyhanni.events.BitsUpdateEvent @@ -187,7 +188,7 @@ object BitsAPI { "^§aCommunity Shop|§eFame Rank$", ) - @SubscribeEvent + @HandleEvent fun onScoreboardChange(event: ScoreboardUpdateEvent) { if (!isEnabled()) return for (line in event.added) { diff --git a/src/main/java/at/hannibal2/skyhanni/data/BlockData.kt b/src/main/java/at/hannibal2/skyhanni/data/BlockData.kt index 0dcc1714e1a1..ec135d96b187 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/BlockData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/BlockData.kt @@ -15,10 +15,10 @@ object BlockData { if (event.packet is S23PacketBlockChange) { val blockPos = event.packet.blockPosition ?: return val blockState = event.packet.blockState ?: return - ServerBlockChangeEvent(blockPos, blockState).postAndCatch() + ServerBlockChangeEvent(blockPos, blockState).post() } else if (event.packet is S22PacketMultiBlockChange) { for (block in event.packet.changedBlocks) { - ServerBlockChangeEvent(block.pos, block.blockState).postAndCatch() + ServerBlockChangeEvent(block.pos, block.blockState).post() } } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt b/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt index da35ccfe19b5..8ce497bc1f59 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt @@ -112,7 +112,7 @@ object ChatManager { trimmedMessage, trimmedMessage.split(" "), originatingModContainer - ).postAndCatch() + ).post() ) { event.cancel() messageHistory[IdentityCharacteristics(component)] = result.copy(actionKind = ActionKind.OUTGOING_BLOCKED) diff --git a/src/main/java/at/hannibal2/skyhanni/data/CropAccessoryData.kt b/src/main/java/at/hannibal2/skyhanni/data/CropAccessoryData.kt index 502b7f21e64c..beec86281a4a 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/CropAccessoryData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/CropAccessoryData.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.data +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.InventoryUpdatedEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.events.SecondPassedEvent @@ -28,7 +29,7 @@ object CropAccessoryData { private var accessoryInBag = CropAccessory.NONE private var accessoryInInventory = CropAccessory.NONE - @SubscribeEvent + @HandleEvent fun onProfileJoin(event: ProfileJoinEvent) { accessoryInBag = CropAccessory.NONE accessoryInInventory = CropAccessory.NONE diff --git a/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt b/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt index ff46166c4f6b..4511cea13f3c 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt @@ -54,7 +54,7 @@ object EntityMovementData { } } - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { val nextData = nextTeleport ?: return if (nextData.island != event.newIsland) return diff --git a/src/main/java/at/hannibal2/skyhanni/data/GuiData.kt b/src/main/java/at/hannibal2/skyhanni/data/GuiData.kt index 7023cddc27b5..457b6c42648f 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GuiData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GuiData.kt @@ -1,10 +1,10 @@ package at.hannibal2.skyhanni.data -import at.hannibal2.skyhanni.api.enoughupdates.NEURenderEvent 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 +import at.hannibal2.skyhanni.events.NEURenderEvent import at.hannibal2.skyhanni.events.minecraft.ClientDisconnectEvent import at.hannibal2.skyhanni.features.inventory.wardrobe.CustomWardrobeKeybinds import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule diff --git a/src/main/java/at/hannibal2/skyhanni/data/HotmData.kt b/src/main/java/at/hannibal2/skyhanni/data/HotmData.kt index 5ee38ccae8e8..a87255a6b5ab 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HotmData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HotmData.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.api.HotmAPI import at.hannibal2.skyhanni.api.HotmAPI.MayhemPerk import at.hannibal2.skyhanni.api.HotmAPI.SkymallPerk +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.storage.ProfileSpecificStorage import at.hannibal2.skyhanni.data.jsonobjects.local.HotmTree import at.hannibal2.skyhanni.data.model.TabWidget @@ -690,7 +691,7 @@ enum class HotmData( } } - @SubscribeEvent + @HandleEvent fun onScoreboardUpdate(event: ScoreboardUpdateEvent) { if (!LorenzUtils.inSkyBlock) return @@ -726,7 +727,7 @@ enum class HotmData( } } - @SubscribeEvent + @HandleEvent fun onWidgetUpdate(event: WidgetUpdateEvent) { if (!event.isWidget(TabWidget.POWDER)) return event.lines.forEach { @@ -780,14 +781,14 @@ enum class HotmData( } } - @SubscribeEvent - fun onWorldSwitch(event: IslandChangeEvent) { + @HandleEvent + fun onIslandChange(event: IslandChangeEvent) { if (HotmAPI.mineshaftMayhem == null) return HotmAPI.mineshaftMayhem = null ChatUtils.debug("resetting mineshaftMayhem") } - @SubscribeEvent + @HandleEvent fun onProfileSwitch(event: ProfileJoinEvent) { HotmAPI.PowderType.entries.forEach { if (it.getStorage() == null) { diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt index b243fe9be355..4f41a6ae47a5 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt @@ -355,7 +355,7 @@ object HypixelData { hasScoreboardUpdated = false } - @SubscribeEvent + @HandleEvent fun onScoreboardUpdate(event: ScoreboardUpdateEvent) { hasScoreboardUpdated = true } @@ -369,14 +369,14 @@ object HypixelData { val newProfile = message.replace("your profile was changed to:", "").replace("(co-op)", "").trim() if (profileName == newProfile) return profileName = newProfile - ProfileJoinEvent(newProfile).postAndCatch() + ProfileJoinEvent(newProfile).post() } if (message.startsWith("you are playing on profile:")) { val newProfile = message.replace("you are playing on profile:", "").replace("(co-op)", "").trim() ProfileStorageData.profileJoinMessage() if (profileName == newProfile) return profileName = newProfile - ProfileJoinEvent(newProfile).postAndCatch() + ProfileJoinEvent(newProfile).post() } } @@ -387,7 +387,7 @@ object HypixelData { if (RiftAPI.inRift()) newProfile = newProfile.reversed() if (profileName == newProfile) return profileName = newProfile - ProfileJoinEvent(newProfile).postAndCatch() + ProfileJoinEvent(newProfile).post() } } @@ -444,7 +444,7 @@ object HypixelData { } } - @SubscribeEvent + @HandleEvent fun onTabListUpdate(event: WidgetUpdateEvent) { when (event.widget) { TabWidget.AREA -> checkIsland(event) @@ -458,7 +458,7 @@ object HypixelData { UtilsPatterns.tabListProfilePattern.firstMatcher(TabListData.getTabList()) { profileName = group("profile").lowercase() - ProfileJoinEvent(profileName).postAndCatch() + ProfileJoinEvent(profileName).post() } } @@ -538,7 +538,7 @@ object HypixelData { if (skyBlockIsland != newIsland) { val oldIsland = skyBlockIsland skyBlockIsland = newIsland - IslandChangeEvent(newIsland, oldIsland).postAndCatch() + IslandChangeEvent(newIsland, oldIsland).post() if (newIsland == IslandType.UNKNOWN) { ChatUtils.debug("Unknown island detected: '$foundIsland'") diff --git a/src/main/java/at/hannibal2/skyhanni/data/IslandGraphs.kt b/src/main/java/at/hannibal2/skyhanni/data/IslandGraphs.kt index af9c7fd80d68..61978684d4bf 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/IslandGraphs.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/IslandGraphs.kt @@ -143,7 +143,7 @@ object IslandGraphs { loadIsland(LorenzUtils.skyBlockIsland) } - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { if (currentIslandGraph != null) return if (event.newIsland == IslandType.NONE) return diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt index ce49b0add140..5ebaff057fec 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt @@ -25,7 +25,7 @@ object ItemTipHelper { if (!LorenzUtils.inSkyBlock || stack.stackSize != 1) return val itemTipEvent = RenderItemTipEvent(stack, mutableListOf()) - itemTipEvent.postAndCatch() + itemTipEvent.post() if (itemTipEvent.renderObjects.isEmpty()) return @@ -59,7 +59,7 @@ object ItemTipHelper { val stack = slot.stack ?: continue val itemTipEvent = RenderInventoryItemTipEvent(inventoryName, slot, stack) - itemTipEvent.postAndCatch() + itemTipEvent.post() val stackTip = itemTipEvent.stackTip if (stackTip.isEmpty()) continue diff --git a/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt b/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt index 60d9a95817fe..114f23d056f8 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt @@ -28,19 +28,19 @@ object MinecraftData { @HandleEvent(receiveCancelled = true) fun onPacket(event: PacketReceivedEvent) { - val packet = event.packet - when (packet) { + when (val packet = event.packet) { is S29PacketSoundEffect -> { if (PlaySoundEvent( packet.soundName, LorenzVec(packet.x, packet.y, packet.z), packet.pitch, - packet.volume - ).postAndCatch() + packet.volume, + ).post() ) { event.cancel() } } + is S2APacketParticles -> { if (ReceiveParticleEvent( packet.particleType!!, @@ -55,6 +55,7 @@ object MinecraftData { event.cancel() } } + is S32PacketConfirmTransaction -> { totalServerTicks++ ServerTickEvent.post() diff --git a/src/main/java/at/hannibal2/skyhanni/data/MiningAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/MiningAPI.kt index 575c2af4040e..1b4f36b22f3e 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/MiningAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/MiningAPI.kt @@ -190,7 +190,7 @@ object MiningAPI { fun inColdIsland() = inAnyIsland(IslandType.DWARVEN_MINES, IslandType.MINESHAFT) - @SubscribeEvent + @HandleEvent fun onScoreboardChange(event: ScoreboardUpdateEvent) { if (!inCustomMiningIsland()) return @@ -256,7 +256,7 @@ object MiningAPI { } } - @SubscribeEvent + @HandleEvent fun onPlaySound(event: PlaySoundEvent) { if (!inCustomMiningIsland()) return if (event.soundName == "random.explode" && lastPickobulusUse.passedSince() < 5.seconds) { @@ -300,7 +300,7 @@ object MiningAPI { } } - @SubscribeEvent + @HandleEvent fun onBlockChange(event: ServerBlockChangeEvent) { if (!inCustomMiningIsland()) return val oldState = event.oldState @@ -369,7 +369,7 @@ object MiningAPI { updateLocation() } - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { updateLocation() } diff --git a/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt b/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt index f7bb5929b823..7fdea1b779ba 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt @@ -58,7 +58,7 @@ object OwnInventoryData { val slot = packet.func_149173_d() val item = packet.func_149174_e() ?: return DelayedRun.runNextTick { - OwnInventoryItemUpdateEvent(item, slot).postAndCatch() + OwnInventoryItemUpdateEvent(item, slot).post() } } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/PartyAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/PartyAPI.kt index 013c923ead02..36d61b5dad16 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/PartyAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/PartyAPI.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.data +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.hypixel.chat.event.PartyChatEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule @@ -163,7 +164,7 @@ object PartyAPI { } } - @SubscribeEvent + @HandleEvent fun onPartyChat(event: PartyChatEvent) { val name = event.author.cleanPlayerName() addPlayer(name) diff --git a/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt b/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt index 6db19ef80f41..4c6a74be92d4 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt @@ -20,7 +20,6 @@ import at.hannibal2.skyhanni.utils.HypixelCommands import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.TabListData -import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds @@ -36,7 +35,7 @@ object ProfileStorageData { var sackProfiles: SackData.ProfileSpecific? = null private var hypixelDataLoaded = false - @SubscribeEvent(priority = EventPriority.HIGHEST) + @HandleEvent(priority = HandleEvent.HIGHEST) fun onProfileJoin(event: ProfileJoinEvent) { val playerSpecific = playerSpecific val sackPlayers = sackPlayers @@ -76,7 +75,7 @@ object ProfileStorageData { ConfigLoadEvent().postAndCatch() } - @SubscribeEvent + @HandleEvent fun onTabListUpdate(event: WidgetUpdateEvent) { if (!event.isWidget(TabWidget.PROFILE)) return noTabListTime = if (event.isClear()) SimpleTimeMark.now() else SimpleTimeMark.farPast() diff --git a/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt index 4a355319ddf6..ef2494837c3a 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.data +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.PurseChangeCause import at.hannibal2.skyhanni.events.PurseChangeEvent @@ -44,7 +45,7 @@ object PurseAPI { inventoryCloseTime = SimpleTimeMark.now() } - @SubscribeEvent + @HandleEvent fun onScoreboardChange(event: ScoreboardUpdateEvent) { coinsPattern.firstMatcher(event.added) { val newPurse = group("coins").formatDouble() @@ -52,7 +53,7 @@ object PurseAPI { if (diff == 0.0) return currentPurse = newPurse - PurseChangeEvent(diff, currentPurse, getCause(diff)).postAndCatch() + PurseChangeEvent(diff, currentPurse, getCause(diff)).post() } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/QuiverAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/QuiverAPI.kt index 1833ad599d07..529294fba609 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/QuiverAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/QuiverAPI.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.data +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.jsonobjects.repo.ArrowTypeJson import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -219,7 +220,7 @@ object QuiverAPI { } } - @SubscribeEvent + @HandleEvent fun onInventoryUpdate(event: OwnInventoryItemUpdateEvent) { if (!isEnabled() && event.slot != 44) return val stack = event.itemStack diff --git a/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt index e137cfb62a42..9db3f0ff1ac7 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/SackAPI.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.ConfigFileType import at.hannibal2.skyhanni.data.jsonobjects.repo.neu.NeuSacksJson import at.hannibal2.skyhanni.events.InventoryCloseEvent @@ -279,7 +280,7 @@ object SackAPI { } } - @SubscribeEvent + @HandleEvent fun onNeuRepoReload(event: NeuRepositoryReloadEvent) { val sacksData = event.readConstant("sacks").sacks val uniqueSackItems = mutableSetOf() diff --git a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt index cf2e93a9d5bc..02bf5c93e7e3 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt @@ -111,7 +111,7 @@ object ScoreboardData { val semiFormatted = list.map { cleanSB(it) } if (semiFormatted != sidebarLines) { sidebarLines = semiFormatted - RawScoreboardUpdateEvent(semiFormatted).postAndCatch() + RawScoreboardUpdateEvent(semiFormatted).post() } sidebarLinesRaw = list @@ -119,7 +119,7 @@ object ScoreboardData { if (new != sidebarLinesFormatted) { val old = sidebarLinesFormatted sidebarLinesFormatted = new - ScoreboardUpdateEvent(new, old).postAndCatch() + ScoreboardUpdateEvent(new, old).post() } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt b/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt index 4e886e34d560..313e2f5f61fc 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt @@ -27,7 +27,7 @@ object SkillExperience { ".* §e(?.*)§6/.*" ) - @SubscribeEvent + @HandleEvent fun onProfileJoin(event: ProfileJoinEvent) { skillExp.clear() } diff --git a/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt index 35d53834ea61..168ac433add0 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt @@ -112,12 +112,12 @@ object SlayerAPI { if (slayerQuest != latestSlayerCategory) { val old = latestSlayerCategory latestSlayerCategory = slayerQuest - SlayerChangeEvent(old, latestSlayerCategory).postAndCatch() + SlayerChangeEvent(old, latestSlayerCategory).post() } val slayerProgress = ScoreboardData.sidebarLinesFormatted.nextAfter("Slayer Quest", 2).orEmpty() if (latestSlayerProgress != slayerProgress) { - SlayerProgressChangeEvent(latestSlayerProgress, slayerProgress).postAndCatch() + SlayerProgressChangeEvent(latestSlayerProgress, slayerProgress).post() latestSlayerProgress = slayerProgress } diff --git a/src/main/java/at/hannibal2/skyhanni/data/TitleData.kt b/src/main/java/at/hannibal2/skyhanni/data/TitleData.kt index f8ad4f652fc3..a58e00a16a78 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/TitleData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/TitleData.kt @@ -16,7 +16,7 @@ object TitleData { if (packet !is S45PacketTitle) return val message = packet.message ?: return val formattedText = message.formattedText - if (TitleReceivedEvent(formattedText).postAndCatch()) { + if (TitleReceivedEvent(formattedText).post()) { event.cancel() } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt b/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt index 2647768db5e9..8a6c789e9a7b 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.data +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule @@ -52,7 +53,7 @@ object TitleManager { sendTitle(title, duration, height, fontSize) } - @SubscribeEvent + @HandleEvent fun onProfileJoin(event: ProfileJoinEvent) { endTime = SimpleTimeMark.farPast() } diff --git a/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerChatManager.kt b/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerChatManager.kt index a0a79abcb475..ca2b6447c632 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerChatManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerChatManager.kt @@ -213,13 +213,13 @@ object PlayerChatManager { private fun sendSystemMessage(event: LorenzChatEvent) { with(SystemMessageEvent(event.message, event.chatComponent)) { - postAndCatch() + post() event.handleChat(blockedReason, chatComponent) } } private fun AbstractChatEvent.postChat(event: LorenzChatEvent) { - postAndCatch() + post() event.handleChat(blockedReason, chatComponent) } 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 b2a09fa90217..e7d83a1bddf1 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 @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.data.hypixel.chat import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.chat.PlayerMessagesConfig import at.hannibal2.skyhanni.data.hypixel.chat.event.CoopChatEvent @@ -59,7 +60,7 @@ object PlayerNameFormatter { "(?(?:§.){0,2}.) (?.*)", ) - @SubscribeEvent + @HandleEvent fun onPlayerAllChat(event: PlayerAllChatEvent) { if (!isEnabled()) return val levelColor = event.levelColor @@ -87,7 +88,7 @@ object PlayerNameFormatter { event.chatComponent = StringUtils.replaceIfNeeded(event.chatComponent, all) ?: return } - @SubscribeEvent + @HandleEvent fun onCoopChat(event: CoopChatEvent) { if (!isEnabled()) return event.chatComponent = StringUtils.replaceIfNeeded( @@ -100,7 +101,7 @@ object PlayerNameFormatter { ) ?: return } - @SubscribeEvent + @HandleEvent fun onGuildChat(event: GuildChatEvent) { if (!isEnabled()) return event.chatComponent = StringUtils.replaceIfNeeded( @@ -113,7 +114,7 @@ object PlayerNameFormatter { ) ?: return } - @SubscribeEvent + @HandleEvent fun onPartyChat(event: PartyChatEvent) { if (!isEnabled()) return event.chatComponent = StringUtils.replaceIfNeeded( @@ -126,7 +127,7 @@ object PlayerNameFormatter { ) ?: return } - @SubscribeEvent + @HandleEvent fun onPrivateChat(event: PrivateMessageChatEvent) { if (!isEnabled()) return event.chatComponent = StringUtils.replaceIfNeeded( @@ -140,7 +141,7 @@ object PlayerNameFormatter { ) ?: return } - @SubscribeEvent + @HandleEvent fun onPlayerShowItemChat(event: PlayerShowItemChatEvent) { if (!isEnabled()) return event.chatComponent = StringUtils.replaceIfNeeded( diff --git a/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/event/AbstractChatEvent.kt b/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/event/AbstractChatEvent.kt index 6ef6861f2d56..630bd5c8072b 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/event/AbstractChatEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/event/AbstractChatEvent.kt @@ -1,6 +1,6 @@ package at.hannibal2.skyhanni.data.hypixel.chat.event -import at.hannibal2.skyhanni.events.LorenzEvent +import at.hannibal2.skyhanni.api.event.SkyHanniEvent import at.hannibal2.skyhanni.utils.ComponentSpan import net.minecraft.util.IChatComponent @@ -9,7 +9,7 @@ open class AbstractChatEvent( val messageComponent: ComponentSpan, var chatComponent: IChatComponent, var blockedReason: String? = null, -) : LorenzEvent() { +) : SkyHanniEvent() { val message by lazy { messageComponent.getText().removePrefix("§r") } val author by lazy { authorComponent.getText() } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/event/PlayerAllChatEvent.kt b/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/event/PlayerAllChatEvent.kt index e33165b34acc..bb2de00104f5 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/event/PlayerAllChatEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/event/PlayerAllChatEvent.kt @@ -1,10 +1,7 @@ package at.hannibal2.skyhanni.data.hypixel.chat.event import at.hannibal2.skyhanni.utils.ComponentSpan -import net.minecraft.util.ChatComponentText import net.minecraft.util.IChatComponent -import net.minecraftforge.fml.common.eventhandler.ListenerList -import org.jetbrains.annotations.ApiStatus class PlayerAllChatEvent( val levelComponent: ComponentSpan?, @@ -19,44 +16,4 @@ class PlayerAllChatEvent( val levelColor = levelComponent?.sampleStyleAtStart()?.color val level by lazy { levelComponent?.getText()?.toInt() } val isAGuest by lazy { privateIslandGuest != null } - - companion object { - private val listenerList = ListenerList( - AbstractChatEvent( - ComponentSpan.empty(), - ComponentSpan.empty(), - ChatComponentText(""), - "" - ).listenerList - ) - } - - /** - * This method is here to prevent FML from trying to add its own constructor. FML adds a public no args - * constructor to every Event class, which is used to determine the listener list using inheritance. This is done - * using class transformations, more specifically ASM. Sadly this class contains expressions which cause the class - * writer used by ASM to perform type unifications. Due to the way ASM is loaded these type unifications do not - * have access to some of the classes used in this class, causing a ClassNotFoundException. In order to prevent - * these unifications from happening we need to prevent FML from trying to generate this constructor, which we do - * by having our own setup function. - */ - override fun setup() { - super.setup() - } - - /** - * This method is required if [setup] is present. - */ - @ApiStatus.Internal - constructor() : this( - null, null, null, "", - ComponentSpan.empty(), ComponentSpan.empty(), ChatComponentText("") - ) - - /** - * This method is required if [setup] is present. - */ - override fun getListenerList(): ListenerList { - return PlayerAllChatEvent.listenerList - } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/event/SystemMessageEvent.kt b/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/event/SystemMessageEvent.kt index 82c53d0b16d2..53e1440aed55 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/event/SystemMessageEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/event/SystemMessageEvent.kt @@ -1,10 +1,10 @@ package at.hannibal2.skyhanni.data.hypixel.chat.event -import at.hannibal2.skyhanni.events.LorenzEvent +import at.hannibal2.skyhanni.api.event.SkyHanniEvent import net.minecraft.util.IChatComponent class SystemMessageEvent( val message: String, var chatComponent: IChatComponent, var blockedReason: String? = null, -) : LorenzEvent() +) : SkyHanniEvent() 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 cead1b7c1368..9ca7dc9ce6cf 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/model/SkyblockStat.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/model/SkyblockStat.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.data.model +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent @@ -155,7 +156,7 @@ enum class SkyblockStat( } } - @SubscribeEvent + @HandleEvent fun onTabList(event: WidgetUpdateEvent) { if (!event.isWidget(TabWidget.STATS, TabWidget.DUNGEON_SKILLS_AND_STATS)) return val type = if (event.isWidget(TabWidget.DUNGEON_SKILLS_AND_STATS)) StatSourceType.TABLIST_DUNGEON else StatSourceType.TABLIST 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 d93053d73fec..40973b5898d5 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/model/TabWidget.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/model/TabWidget.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.data.model +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.events.SecondPassedEvent @@ -354,12 +355,12 @@ enum class TabWidget( if (lines == this.lines) return this.lines = lines isActive = true - WidgetUpdateEvent(this, lines).postAndCatch() + WidgetUpdateEvent(this, lines).post() } private fun postClearEvent() { lines = emptyList() - WidgetUpdateEvent(this, lines).postAndCatch() + WidgetUpdateEvent(this, lines).post() } /** Update the state of the widget, posts the clear if [isActive] == true && [gotChecked] == false */ @@ -398,7 +399,7 @@ enum class TabWidget( ChatUtils.debug("Forcefully Updated Widgets") } - @SubscribeEvent(priority = EventPriority.HIGH) + @HandleEvent(priority = HandleEvent.HIGH) fun onTabListUpdate(event: TabListUpdateEvent) { if (!LorenzUtils.inSkyBlock) { if (separatorIndexes.isNotEmpty()) { diff --git a/src/main/java/at/hannibal2/skyhanni/events/IslandChangeEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/IslandChangeEvent.kt index ae22a4c751ad..587b35048021 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/IslandChangeEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/IslandChangeEvent.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.events +import at.hannibal2.skyhanni.api.event.SkyHanniEvent import at.hannibal2.skyhanni.data.IslandType -class IslandChangeEvent(val newIsland: IslandType, val oldIsland: IslandType) : LorenzEvent() +class IslandChangeEvent(val newIsland: IslandType, val oldIsland: IslandType) : SkyHanniEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/MessageSendToServerEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/MessageSendToServerEvent.kt index 6aa07cb54ca0..82cbcfed1a6a 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/MessageSendToServerEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/MessageSendToServerEvent.kt @@ -1,11 +1,10 @@ package at.hannibal2.skyhanni.events +import at.hannibal2.skyhanni.api.event.CancellableSkyHanniEvent import at.hannibal2.skyhanni.utils.system.ModInstance -import net.minecraftforge.fml.common.eventhandler.Cancelable -@Cancelable class MessageSendToServerEvent( val message: String, val splitMessage: List, val originatingModContainer: ModInstance? -) : LorenzEvent() +) : CancellableSkyHanniEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/MinionOpenEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/MinionOpenEvent.kt index bfe8649ba97c..571bb70c7f90 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/MinionOpenEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/MinionOpenEvent.kt @@ -1,8 +1,9 @@ package at.hannibal2.skyhanni.events +import at.hannibal2.skyhanni.api.event.SkyHanniEvent import at.hannibal2.skyhanni.utils.LorenzVec import net.minecraft.item.ItemStack -class MinionOpenEvent(val inventoryName: String, val inventoryItems: Map) : LorenzEvent() -class MinionCloseEvent : LorenzEvent() -class MinionStorageOpenEvent(val position: LorenzVec?, val inventoryItems: Map) : LorenzEvent() +class MinionOpenEvent(val inventoryName: String, val inventoryItems: Map) : SkyHanniEvent() +class MinionCloseEvent : SkyHanniEvent() +class MinionStorageOpenEvent(val position: LorenzVec?, val inventoryItems: Map) : SkyHanniEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/api/enoughupdates/NEURenderEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/NEURenderEvent.kt similarity index 70% rename from src/main/java/at/hannibal2/skyhanni/api/enoughupdates/NEURenderEvent.kt rename to src/main/java/at/hannibal2/skyhanni/events/NEURenderEvent.kt index 91dda4f67bfd..c92944c31fc0 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/enoughupdates/NEURenderEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/NEURenderEvent.kt @@ -1,4 +1,4 @@ -package at.hannibal2.skyhanni.api.enoughupdates +package at.hannibal2.skyhanni.events import at.hannibal2.skyhanni.api.event.CancellableSkyHanniEvent diff --git a/src/main/java/at/hannibal2/skyhanni/events/NeuRepositoryReloadEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/NeuRepositoryReloadEvent.kt index 9feb170c1f08..5597eb3cd128 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/NeuRepositoryReloadEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/NeuRepositoryReloadEvent.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.events +import at.hannibal2.skyhanni.api.event.SkyHanniEvent import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.data.repo.RepoError import at.hannibal2.skyhanni.data.repo.RepoUtils @@ -14,7 +15,7 @@ import com.google.gson.JsonSyntaxException import java.io.File import java.lang.reflect.Type -class NeuRepositoryReloadEvent : LorenzEvent() { +object NeuRepositoryReloadEvent : SkyHanniEvent() { fun getConstant(file: String): JsonObject? = File(manager.repoLocation, "constants/$file.json").getJson() inline fun readConstant(file: String, gson: Gson = ConfigManager.gson): T { diff --git a/src/main/java/at/hannibal2/skyhanni/events/OwnInventoryItemUpdateEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/OwnInventoryItemUpdateEvent.kt index 56264e198767..986e658bd9b0 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/OwnInventoryItemUpdateEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/OwnInventoryItemUpdateEvent.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.events +import at.hannibal2.skyhanni.api.event.SkyHanniEvent import net.minecraft.item.ItemStack -data class OwnInventoryItemUpdateEvent(val itemStack: ItemStack, val slot: Int) : LorenzEvent() +data class OwnInventoryItemUpdateEvent(val itemStack: ItemStack, val slot: Int) : SkyHanniEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/PlaySoundEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/PlaySoundEvent.kt index 96f228a6ba85..0bbc090d213b 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/PlaySoundEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/PlaySoundEvent.kt @@ -1,13 +1,11 @@ package at.hannibal2.skyhanni.events +import at.hannibal2.skyhanni.api.event.CancellableSkyHanniEvent import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.NumberUtil.roundTo -import net.minecraftforge.fml.common.eventhandler.Cancelable -@Cancelable -class PlaySoundEvent(val soundName: String, val location: LorenzVec, val pitch: Float, val volume: Float) : - LorenzEvent() { +class PlaySoundEvent(val soundName: String, val location: LorenzVec, val pitch: Float, val volume: Float) : CancellableSkyHanniEvent() { val distanceToPlayer by lazy { location.distanceToPlayer() } override fun toString(): String { diff --git a/src/main/java/at/hannibal2/skyhanni/events/ProfileJoinEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/ProfileJoinEvent.kt index 68d8f075d914..e4f53ba3a208 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/ProfileJoinEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/ProfileJoinEvent.kt @@ -1,3 +1,5 @@ package at.hannibal2.skyhanni.events -class ProfileJoinEvent(val name: String) : LorenzEvent() +import at.hannibal2.skyhanni.api.event.SkyHanniEvent + +class ProfileJoinEvent(val name: String) : SkyHanniEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/PurseChangeEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/PurseChangeEvent.kt index 776a226d63e9..21a219b29342 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/PurseChangeEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/PurseChangeEvent.kt @@ -1,6 +1,8 @@ package at.hannibal2.skyhanni.events -class PurseChangeEvent(val coins: Double, val purse: Double, val reason: PurseChangeCause) : LorenzEvent() +import at.hannibal2.skyhanni.api.event.SkyHanniEvent + +class PurseChangeEvent(val coins: Double, val purse: Double, val reason: PurseChangeCause) : SkyHanniEvent() enum class PurseChangeCause { GAIN_MOB_KILL, diff --git a/src/main/java/at/hannibal2/skyhanni/events/RawScoreboardUpdateEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/RawScoreboardUpdateEvent.kt index ac11a5bcb153..45cc13659ac7 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/RawScoreboardUpdateEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/RawScoreboardUpdateEvent.kt @@ -1,3 +1,5 @@ package at.hannibal2.skyhanni.events -class RawScoreboardUpdateEvent(val rawScoreboard: List) : LorenzEvent() +import at.hannibal2.skyhanni.api.event.SkyHanniEvent + +class RawScoreboardUpdateEvent(val rawScoreboard: List) : SkyHanniEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/RenderBlockInWorldEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/RenderBlockInWorldEvent.kt deleted file mode 100644 index 395d1be2db0c..000000000000 --- a/src/main/java/at/hannibal2/skyhanni/events/RenderBlockInWorldEvent.kt +++ /dev/null @@ -1,9 +0,0 @@ -package at.hannibal2.skyhanni.events - -import net.minecraft.block.state.IBlockState -import net.minecraft.util.BlockPos -import net.minecraft.world.IBlockAccess -import net.minecraftforge.fml.common.eventhandler.Cancelable - -@Cancelable -data class RenderBlockInWorldEvent(@JvmField var state: IBlockState?, var world: IBlockAccess, var pos: BlockPos?) : LorenzEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/RenderGuiItemOverlayEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/RenderGuiItemOverlayEvent.kt index 0db2e4e1466a..2034b09fbbd0 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/RenderGuiItemOverlayEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/RenderGuiItemOverlayEvent.kt @@ -1,9 +1,10 @@ package at.hannibal2.skyhanni.events +import at.hannibal2.skyhanni.api.event.SkyHanniEvent import net.minecraft.item.ItemStack class RenderGuiItemOverlayEvent( val stack: ItemStack?, val x: Int, val y: Int, -) : LorenzEvent() +) : SkyHanniEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/RenderInventoryItemTipEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/RenderInventoryItemTipEvent.kt index 0f16dad2a4a1..79c974dbde65 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/RenderInventoryItemTipEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/RenderInventoryItemTipEvent.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.events +import at.hannibal2.skyhanni.api.event.SkyHanniEvent import net.minecraft.inventory.Slot import net.minecraft.item.ItemStack @@ -11,4 +12,4 @@ class RenderInventoryItemTipEvent( var offsetX: Int = 0, var offsetY: Int = 0, var alignLeft: Boolean = true, -) : LorenzEvent() +) : SkyHanniEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/RenderItemTipEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/RenderItemTipEvent.kt index 5a144cb7e04d..451302602b3d 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/RenderItemTipEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/RenderItemTipEvent.kt @@ -1,11 +1,12 @@ package at.hannibal2.skyhanni.events +import at.hannibal2.skyhanni.api.event.SkyHanniEvent import net.minecraft.item.ItemStack class RenderItemTipEvent( val stack: ItemStack, var renderObjects: MutableList, -) : LorenzEvent() { +) : SkyHanniEvent() { var stackTip = "" set(value) { diff --git a/src/main/java/at/hannibal2/skyhanni/events/RenderItemTooltipEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/RenderItemTooltipEvent.kt index f8cb98802b1c..ea1283a52d58 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/RenderItemTooltipEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/RenderItemTooltipEvent.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.events +import at.hannibal2.skyhanni.api.event.SkyHanniEvent import net.minecraft.item.ItemStack -class RenderItemTooltipEvent(val stack: ItemStack) : LorenzEvent() +class RenderItemTooltipEvent(val stack: ItemStack) : SkyHanniEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/ScoreboardUpdateEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/ScoreboardUpdateEvent.kt index e2efcbaf2675..cb13423bcbd7 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/ScoreboardUpdateEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/ScoreboardUpdateEvent.kt @@ -1,9 +1,11 @@ package at.hannibal2.skyhanni.events +import at.hannibal2.skyhanni.api.event.SkyHanniEvent + class ScoreboardUpdateEvent( val full: List, val old: List, -) : LorenzEvent() { +) : SkyHanniEvent() { val added: List = full - old.toSet() val removed: List = old - full.toSet() diff --git a/src/main/java/at/hannibal2/skyhanni/events/SeaCreatureFishEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/SeaCreatureFishEvent.kt index 0c0c4f62780a..158fc47c2c7a 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/SeaCreatureFishEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/SeaCreatureFishEvent.kt @@ -1,9 +1,10 @@ package at.hannibal2.skyhanni.events +import at.hannibal2.skyhanni.api.event.SkyHanniEvent import at.hannibal2.skyhanni.features.fishing.SeaCreature class SeaCreatureFishEvent( val seaCreature: SeaCreature, val chatEvent: LorenzChatEvent, val doubleHook: Boolean, -) : LorenzEvent() +) : SkyHanniEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/ServerBlockChangeEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/ServerBlockChangeEvent.kt index 106ee2821cb3..ed0ef4ac9311 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/ServerBlockChangeEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/ServerBlockChangeEvent.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.events +import at.hannibal2.skyhanni.api.event.SkyHanniEvent import at.hannibal2.skyhanni.utils.BlockUtils.getBlockAt import at.hannibal2.skyhanni.utils.BlockUtils.getBlockStateAt import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher @@ -7,7 +8,7 @@ import at.hannibal2.skyhanni.utils.toLorenzVec import net.minecraft.block.state.IBlockState import net.minecraft.util.BlockPos -class ServerBlockChangeEvent(blockPos: BlockPos, blockState: IBlockState) : LorenzEvent() { +class ServerBlockChangeEvent(blockPos: BlockPos, blockState: IBlockState) : SkyHanniEvent() { val location by lazy { blockPos.toLorenzVec() } val old by lazy { location.getBlockAt().toString().getName() } diff --git a/src/main/java/at/hannibal2/skyhanni/events/SkillExpGainEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/SkillExpGainEvent.kt index 09365a7baa9c..a0a6a771f69d 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/SkillExpGainEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/SkillExpGainEvent.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.events +import at.hannibal2.skyhanni.api.event.SkyHanniEvent import at.hannibal2.skyhanni.features.skillprogress.SkillType // does not know how much exp is there, also gets called multiple times -class SkillExpGainEvent(val skill: SkillType, val gained: Double) : LorenzEvent() +class SkillExpGainEvent(val skill: SkillType, val gained: Double) : SkyHanniEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/SkillOverflowLevelUpEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/SkillOverflowLevelUpEvent.kt index d3f356da7f7d..cd50caa5ea66 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/SkillOverflowLevelUpEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/SkillOverflowLevelUpEvent.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.events +import at.hannibal2.skyhanni.api.event.SkyHanniEvent import at.hannibal2.skyhanni.features.skillprogress.SkillType -class SkillOverflowLevelUpEvent(val skill: SkillType, val oldLevel: Int, val newLevel: Int) : LorenzEvent() +class SkillOverflowLevelUpEvent(val skill: SkillType, val oldLevel: Int, val newLevel: Int) : SkyHanniEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/SkipTabListLineEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/SkipTabListLineEvent.kt index 0250b821f1f5..30d8f42fb6b3 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/SkipTabListLineEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/SkipTabListLineEvent.kt @@ -1,11 +1,10 @@ package at.hannibal2.skyhanni.events +import at.hannibal2.skyhanni.api.event.CancellableSkyHanniEvent import at.hannibal2.skyhanni.features.misc.compacttablist.TabLine -import net.minecraftforge.fml.common.eventhandler.Cancelable -@Cancelable data class SkipTabListLineEvent( val line: TabLine, val lastSubTitle: TabLine?, val lastTitle: TabLine?, -) : LorenzEvent() +) : CancellableSkyHanniEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/SlayerChangeEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/SlayerChangeEvent.kt index c7da7f7bd7d3..05d2a357e3dc 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/SlayerChangeEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/SlayerChangeEvent.kt @@ -1,3 +1,5 @@ package at.hannibal2.skyhanni.events -class SlayerChangeEvent(val oldSlayer: String, val newSlayer: String) : LorenzEvent() +import at.hannibal2.skyhanni.api.event.SkyHanniEvent + +class SlayerChangeEvent(val oldSlayer: String, val newSlayer: String) : SkyHanniEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/SlayerProgressChangeEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/SlayerProgressChangeEvent.kt index b87a854e1922..78a68c5d492f 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/SlayerProgressChangeEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/SlayerProgressChangeEvent.kt @@ -1,3 +1,5 @@ package at.hannibal2.skyhanni.events -class SlayerProgressChangeEvent(val oldProgress: String, val newProgress: String) : LorenzEvent() +import at.hannibal2.skyhanni.api.event.SkyHanniEvent + +class SlayerProgressChangeEvent(val oldProgress: String, val newProgress: String) : SkyHanniEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/TabListLineRenderEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/TabListLineRenderEvent.kt index 47478959291d..7a863a8e9635 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/TabListLineRenderEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/TabListLineRenderEvent.kt @@ -1,3 +1,5 @@ package at.hannibal2.skyhanni.events -class TabListLineRenderEvent(var text: String) : LorenzEvent() +import at.hannibal2.skyhanni.api.event.SkyHanniEvent + +class TabListLineRenderEvent(var text: String) : SkyHanniEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/TabListUpdateEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/TabListUpdateEvent.kt index a1b36a667fb3..c4e44624ab11 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/TabListUpdateEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/TabListUpdateEvent.kt @@ -1,3 +1,5 @@ package at.hannibal2.skyhanni.events -class TabListUpdateEvent(val tabList: List) : LorenzEvent() +import at.hannibal2.skyhanni.api.event.SkyHanniEvent + +class TabListUpdateEvent(val tabList: List) : SkyHanniEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/TablistFooterUpdateEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/TablistFooterUpdateEvent.kt index 6f12e99bc47e..ffca3d846259 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/TablistFooterUpdateEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/TablistFooterUpdateEvent.kt @@ -1,3 +1,5 @@ package at.hannibal2.skyhanni.events -class TablistFooterUpdateEvent(val footer: String) : LorenzEvent() +import at.hannibal2.skyhanni.api.event.SkyHanniEvent + +class TablistFooterUpdateEvent(val footer: String) : SkyHanniEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/TitleReceivedEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/TitleReceivedEvent.kt index 912a4d8d6564..82f261e7614b 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/TitleReceivedEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/TitleReceivedEvent.kt @@ -1,6 +1,5 @@ package at.hannibal2.skyhanni.events -import net.minecraftforge.fml.common.eventhandler.Cancelable +import at.hannibal2.skyhanni.api.event.CancellableSkyHanniEvent -@Cancelable -class TitleReceivedEvent(val title: String) : LorenzEvent() +class TitleReceivedEvent(val title: String) : CancellableSkyHanniEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/WidgetUpdateEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/WidgetUpdateEvent.kt index a91e7dca3a03..1c0bedcad69e 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/WidgetUpdateEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/WidgetUpdateEvent.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.events +import at.hannibal2.skyhanni.api.event.SkyHanniEvent import at.hannibal2.skyhanni.data.model.TabWidget import at.hannibal2.skyhanni.utils.LorenzUtils.isAnyOf @@ -7,7 +8,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.isAnyOf open class WidgetUpdateEvent( val widget: TabWidget, val lines: List, -) : LorenzEvent() { +) : SkyHanniEvent() { fun isWidget(widgetType: TabWidget) = widget == widgetType fun isWidget(vararg widgetType: TabWidget) = widget.isAnyOf(*widgetType) diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/StashCompact.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/StashCompact.kt index 9eb5f1029cfd..34d745502a00 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/StashCompact.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/StashCompact.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.events.LorenzChatEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.features.chat.StashCompact.StashType.Companion.fromGroup @@ -94,7 +95,7 @@ object StashCompact { var differingMaterialsCount: Int? = null } - @SubscribeEvent + @HandleEvent fun onProfileJoin(event: ProfileJoinEvent) { joinedProfileAt = SimpleTimeMark.now() } 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 7bcaea265db1..facd5efb70f6 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 @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.chat.playerchat import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.hypixel.chat.event.SystemMessageEvent import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager @@ -22,7 +23,7 @@ object PlayerChatModifier { patterns.add("§[7ab6](\\w{2,16})§r(?!§7x)(?!\$)".toRegex()) // all players without rank prefix in notification messages } - @SubscribeEvent + @HandleEvent fun onChat(event: SystemMessageEvent) { event.applyIfPossible { cutMessage(it) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/BroodmotherFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/BroodmotherFeatures.kt index 6b324ffdc2fa..435419d87115 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/BroodmotherFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/BroodmotherFeatures.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.data.IslandType import at.hannibal2.skyhanni.data.model.TabWidget import at.hannibal2.skyhanni.events.GuiRenderEvent @@ -47,7 +48,7 @@ object BroodmotherFeatures { private var broodmotherSpawnTime = SimpleTimeMark.farPast() private var display = "" - @SubscribeEvent + @HandleEvent fun onTabListUpdate(event: WidgetUpdateEvent) { if (!event.isWidget(TabWidget.BROODMOTHER)) return val newStage = event.widget.matchMatcherFirstLine { group("stage") }.orEmpty() 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 26b434903819..7c1ec18e679a 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 @@ -136,7 +136,7 @@ object EnderNodeTracker { } } - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { if (!isEnabled()) return miteGelInInventory = InventoryUtils.getItemsInOwnInventory().filter { @@ -158,7 +158,7 @@ object EnderNodeTracker { } } - @SubscribeEvent + @HandleEvent fun onOwnInventoryItemUpdate(event: OwnInventoryItemUpdateEvent) { if (!isEnabled()) return if (!ProfileStorageData.loaded) return 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 99a5eb34b7a2..fefa68f3536d 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 @@ -176,7 +176,7 @@ object GhostTracker { add(tracker.addTotalProfit(profit, data.kills, "kill")) } - @SubscribeEvent + @HandleEvent fun onSkillExp(event: SkillExpGainEvent) { if (!isEnabled()) return if (event.gained > 10_000) return @@ -208,7 +208,7 @@ object GhostTracker { } } - @SubscribeEvent + @HandleEvent fun onPurseChange(event: PurseChangeEvent) { if (!isEnabled()) return if (event.reason != PurseChangeCause.GAIN_MOB_KILL) return @@ -276,7 +276,7 @@ object GhostTracker { } } - @SubscribeEvent + @HandleEvent fun onWidgetUpdate(event: WidgetUpdateEvent) { if (!event.isWidget(TabWidget.BESTIARY)) return if (isMaxBestiary || !isEnabled()) return @@ -301,7 +301,7 @@ object GhostTracker { if (inArea) parseBestiaryWidget(TabWidget.BESTIARY.lines) } - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { if (event.newIsland == IslandType.DWARVEN_MINES) { tracker.firstUpdate() diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/PartyChatCommands.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/PartyChatCommands.kt index 38a85fdf8bab..2d249794048f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/PartyChatCommands.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/PartyChatCommands.kt @@ -12,7 +12,6 @@ import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.HypixelCommands import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.SimpleTimeMark -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds @SkyHanniModule @@ -38,7 +37,7 @@ object PartyChatCommands { requiresPartyLead = true, executable = { HypixelCommands.partyTransfer(it.cleanedAuthor) - } + }, ), PartyChatCommand( listOf("pw", "warp", "warpus"), @@ -47,7 +46,7 @@ object PartyChatCommands { executable = { lastWarp = SimpleTimeMark.now() HypixelCommands.partyWarp() - } + }, ), PartyChatCommand( listOf("allinv", "allinvite"), @@ -56,7 +55,7 @@ object PartyChatCommands { executable = { lastAllInvite = SimpleTimeMark.now() HypixelCommands.partyAllInvite() - } + }, ), ) @@ -84,7 +83,7 @@ object PartyChatCommands { return storage.blacklistedUsers.any { it.equals(name, ignoreCase = true) } } - @SubscribeEvent + @HandleEvent fun onPartyCommand(event: PartyChatEvent) { if (event.message.firstOrNull() !in commandPrefixes) return val commandLabel = event.message.substring(1).substringBefore(' ') 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 3cbd43a785a2..b0c29fdcbfa7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/PartyCommands.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/PartyCommands.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.commands import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.PartyAPI import at.hannibal2.skyhanni.data.PartyAPI.partyLeader @@ -91,7 +92,7 @@ object PartyCommands { } } - @SubscribeEvent + @HandleEvent fun onMessageSendToServer(event: MessageSendToServerEvent) { if (!config.partyKickReason) { return diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt index ba65fac3a77d..af4d449b76bc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt @@ -1,15 +1,15 @@ package at.hannibal2.skyhanni.features.commands +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.MessageSendToServerEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LocationUtils -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule object SendCoordinatedCommand { - @SubscribeEvent + @HandleEvent fun onMessageSendToServer(event: MessageSendToServerEvent) { val message = event.message if (message.startsWith("/sendcoords")) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/TransferCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/TransferCooldown.kt index 2a9c70cd9233..3eec90a2a45d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/TransferCooldown.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/TransferCooldown.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.commands import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.MessageSendToServerEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule @@ -31,7 +32,7 @@ object TransferCooldown { } } - @SubscribeEvent + @HandleEvent fun onCommand(event: MessageSendToServerEvent) { if (!LorenzUtils.inSkyBlock || !config.transferCooldown || lastRunCompleted.isInPast()) return when (event.splitMessage[0]) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt index dbaf037ca363..6164ce066c85 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.commands import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.MessageSendToServerEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.ChatUtils.senderIsSkyhanni @@ -9,7 +10,6 @@ import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NumberUtil.isInt import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule object ViewRecipeCommand { @@ -26,7 +26,7 @@ object ViewRecipeCommand { "\\/viewrecipe (?.*)" ) - @SubscribeEvent + @HandleEvent fun onMessageSendToServer(event: MessageSendToServerEvent) { if (!config.viewRecipeLowerCase) return if (event.senderIsSkyhanni()) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt index b78e6cf63123..c4dffc304e7f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt @@ -1,16 +1,16 @@ package at.hannibal2.skyhanni.features.commands import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.MessageSendToServerEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.HypixelCommands import at.hannibal2.skyhanni.utils.LorenzUtils -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule object WarpIsCommand { - @SubscribeEvent + @HandleEvent fun onMessageSendToServer(event: MessageSendToServerEvent) { if (!LorenzUtils.inSkyBlock) return if (!SkyHanniMod.feature.misc.commands.replaceWarpIs) return 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 666014ed15d2..6eb0da01119c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt @@ -31,7 +31,7 @@ object WikiManager { event.move(6, "commands.useFandomWiki", "commands.fandomWiki.enabled") } - @SubscribeEvent + @HandleEvent fun onMessageSendToServer(event: MessageSendToServerEvent) { if (!LorenzUtils.inSkyBlock) return if (!isEnabled()) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/ArrowTrail.kt b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/ArrowTrail.kt index 2ea145ae4f44..afa65585cb9a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/ArrowTrail.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/ArrowTrail.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.enums.OutsideSbFeature import at.hannibal2.skyhanni.events.IslandChangeEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent @@ -69,7 +70,7 @@ object ArrowTrail { private fun isEnabled() = config.enabled && (LorenzUtils.inSkyBlock || OutsideSbFeature.ARROW_TRAIL.isSelected()) - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { listAllArrow.clear() listYourArrow.clear() diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt index 9cac2098f0bd..9d58858a73fa 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt @@ -205,7 +205,7 @@ object CroesusChestTracker { } } - @SubscribeEvent + @HandleEvent fun onRenderItemTip(event: RenderItemTipEvent) { if (!LorenzUtils.inSkyBlock) return if (!config.kismetStackSize) return @@ -215,7 +215,7 @@ object CroesusChestTracker { event.stackTip = "§a$kismetAmountCache" } - @SubscribeEvent + @HandleEvent fun onRenderItemTipIsKismetable(event: RenderInventoryItemTipEvent) { if (!LorenzUtils.inSkyBlock) return if (!config.showUsedKismets) return 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 c00a74f0f463..c1f52600b273 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt @@ -183,7 +183,7 @@ object DungeonAPI { else -> "§7" } - @SubscribeEvent + @HandleEvent fun onScoreboardUpdate(event: ScoreboardUpdateEvent) { // TODO: move this under inDungeon check when we use Hypixel's ModAPI for island detection floorPattern.firstMatcher(event.added) { @@ -204,7 +204,7 @@ object DungeonAPI { } } - @SubscribeEvent + @HandleEvent fun onTablistChange(event: TabListUpdateEvent) { if (!inDungeon()) return if (dungeonFloor == null || playerClass != null) return @@ -220,7 +220,7 @@ object DungeonAPI { } } - @SubscribeEvent + @HandleEvent fun onTabUpdate(event: TablistFooterUpdateEvent) { if (!inDungeon()) return for (line in event.footer.split("\n")) { 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 3a07e3e7e363..42e126782f8a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt @@ -125,7 +125,7 @@ object DungeonCleanEnd { } } - @SubscribeEvent + @HandleEvent fun onPlaySound(event: PlaySoundEvent) { if (shouldBlock() && !chestsSpawned && event.soundName.startsWith("note.")) { event.cancel() 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 8ffd8f913e61..d0c7a5b83945 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.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.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent @@ -352,7 +353,7 @@ object DungeonFinderFeatures { } } - @SubscribeEvent + @HandleEvent fun onRenderItemTip(event: RenderInventoryItemTipEvent) { if (!isEnabled()) return if (!config.floorAsStackSize) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonRankTabListColor.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonRankTabListColor.kt index df33ee6f6c14..a07b9b490da3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonRankTabListColor.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonRankTabListColor.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.events.TabListLineRenderEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNecessary @@ -9,7 +10,6 @@ import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.cleanPlayerName import at.hannibal2.skyhanni.utils.StringUtils.stripHypixelMessage import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule object DungeonRankTabListColor { @@ -27,7 +27,7 @@ object DungeonRankTabListColor { "^(?:§.)*(?\\[(?:§.)*\\d+(?:§.)*]) (?(?:§.)*\\[(?:§.)*[^]]+(?:§.)*])? ?(?\\S+) (?[^(]*)\\((?:§.)*(?\\S+) (?[CLXVI]+)(?:§.)*\\)(?:§.)*$" ) - @SubscribeEvent + @HandleEvent fun onTabListText(event: TabListLineRenderEvent) { if (!isEnabled()) return 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 5e052e133f34..32a10924cc0d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonsRaceGuide.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonsRaceGuide.kt @@ -35,7 +35,7 @@ object DungeonsRaceGuide { private var currentRace: String? = null - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { parkourHelpers.forEach { it.value.reset() } currentRace = null diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/carnival/CarnivalGoal.kt b/src/main/java/at/hannibal2/skyhanni/features/event/carnival/CarnivalGoal.kt index d65e65ba16ac..4fa766e141d0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/carnival/CarnivalGoal.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/carnival/CarnivalGoal.kt @@ -170,7 +170,7 @@ enum class CarnivalGoal( private fun getEntry(item: Item, lore: List): CarnivalGoal? = entries.filter { it.type.item == item }.firstOrNull { it.lorePattern.matches(lore.firstOrNull()) } - @SubscribeEvent + @HandleEvent fun onProfileJoin(event: ProfileJoinEvent) { dirty = true } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/carnival/CarnivalReminder.kt b/src/main/java/at/hannibal2/skyhanni/features/event/carnival/CarnivalReminder.kt index 3bd097de401c..fc85b528ed33 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/carnival/CarnivalReminder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/carnival/CarnivalReminder.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.event.carnival import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.EntityMovementData import at.hannibal2.skyhanni.data.IslandGraphs import at.hannibal2.skyhanni.data.IslandType @@ -61,7 +62,7 @@ object CarnivalReminder { check() } - @SubscribeEvent + @HandleEvent fun onProfileJoin(event: ProfileJoinEvent) { claimedToday = false if (!isEnabled()) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/carnival/CarnivalZombieShootout.kt b/src/main/java/at/hannibal2/skyhanni/features/event/carnival/CarnivalZombieShootout.kt index 75fba6369210..afd6e3cc5e24 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/carnival/CarnivalZombieShootout.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/carnival/CarnivalZombieShootout.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.event.carnival import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent @@ -143,7 +144,7 @@ object CarnivalZombieShootout { config.lampPosition.renderRenderable(content, posLabel = "Lantern Timer") } - @SubscribeEvent + @HandleEvent fun onBlockChange(event: ServerBlockChangeEvent) { if (!isEnabled() || !started) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinPetWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinPetWarning.kt index 13db0b88757b..97732f25dd5e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinPetWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinPetWarning.kt @@ -45,7 +45,7 @@ object GriffinPetWarning { } } - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { DelayedRun.runDelayed(5.seconds) { wasCorrectPetAlready = false diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/SoopyGuessBurrow.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/SoopyGuessBurrow.kt index 29590cea96ed..7878e5990ea6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/SoopyGuessBurrow.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/SoopyGuessBurrow.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.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.PlaySoundEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent @@ -59,7 +60,7 @@ object SoopyGuessBurrow { dingSlope.clear() } - @SubscribeEvent + @HandleEvent fun onPlaySound(event: PlaySoundEvent) { if (!isEnabled()) return if (event.soundName != "note.harp") return 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 741d7309b0d4..302ca6d0861b 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 @@ -225,7 +225,7 @@ object HoppityAPI { } } - @SubscribeEvent + @HandleEvent fun onCommandSend(event: MessageSendToServerEvent) { if (!LorenzUtils.inSkyBlock) return if (!pickupOutgoingCommandPattern.matches(event.message)) return 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 f2e7bed0602c..5223dd952f57 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 @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.event.hoppity +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.PurseAPI import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent @@ -133,7 +134,7 @@ object HoppityCallWarning { GlStateManager.color(1F, 1F, 1F, 1F) } - @SubscribeEvent + @HandleEvent fun onCommandSend(event: MessageSendToServerEvent) { if (!LorenzUtils.inSkyBlock) return if (!HoppityAPI.pickupOutgoingCommandPattern.matches(event.message)) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCollectionData.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCollectionData.kt index cc904a081679..b6056451dd66 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCollectionData.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCollectionData.kt @@ -1,10 +1,10 @@ package at.hannibal2.skyhanni.features.event.hoppity +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.jsonobjects.repo.neu.NeuHoppityJson import at.hannibal2.skyhanni.events.NeuRepositoryReloadEvent import at.hannibal2.skyhanni.features.event.hoppity.HoppityCollectionStats.RabbitCollectionRarity import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule object HoppityCollectionData { @@ -38,7 +38,7 @@ object HoppityCollectionData { else -> lowercase().replace("[- ]".toRegex(), "_") } - @SubscribeEvent + @HandleEvent fun onNeuRepoReload(event: NeuRepositoryReloadEvent) { rabbitRarities.clear() rarityBonuses.clear() 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 aff9442c5780..b20581830a80 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 @@ -297,7 +297,7 @@ object HoppityCollectionStats { reCalcHotspotCount() } - @SubscribeEvent + @HandleEvent fun onNeuRepoReload(event: NeuRepositoryReloadEvent) { val data = event.readConstant("hoppity").hoppity neuCountData = data diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocations.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocations.kt index 2a361e97dd76..b067b4111a92 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocations.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocations.kt @@ -75,7 +75,7 @@ object HoppityEggLocations { private var loadedNeuThisProfile = false - @SubscribeEvent + @HandleEvent fun onProfileJoin(event: ProfileJoinEvent) { loadedNeuThisProfile = false } 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 97869684fd6c..9a187a6feb25 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 @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.event.hoppity +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent @@ -9,7 +10,6 @@ import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.SimpleTimeMark.Companion.asTimeMark import at.hannibal2.skyhanni.utils.SkyBlockTime -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.regex.Matcher import kotlin.time.Duration import kotlin.time.Duration.Companion.minutes @@ -84,7 +84,7 @@ enum class HoppityEggType( private val mealLastFound get() = ProfileStorageData.profileSpecific?.chocolateFactory?.mealLastFound ?: mutableMapOf() - @SubscribeEvent + @HandleEvent fun onProfileJoin(event: ProfileJoinEvent) { mealLastFound.forEach { (meal, mark) -> if (mark.passedSince() < 40.minutes) meal.markClaimed(mark) 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 642cbbc6eb35..02d530af4e79 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 @@ -151,7 +151,7 @@ object HoppityEventSummary { allowedHoppityIslands = event.getConstant("HoppityEggLocations").apiEggLocations.keys.toSet() } - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { onHoppityIsland = LorenzUtils.inSkyBlock && allowedHoppityIslands.any { it.isInIsland() } @@ -255,7 +255,7 @@ object HoppityEventSummary { checkAddCfTime() } - @SubscribeEvent + @HandleEvent fun onProfileJoin(event: ProfileJoinEvent) { checkEnded() } 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 b2e76eb03b38..254fea75bc58 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 @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.event.lobby.waypoints.halloween 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.data.IslandGraphs @@ -114,7 +115,7 @@ object BasketWaypoints { event.drawDynamicText(position, "§dBasket", 1.0) } - @SubscribeEvent + @HandleEvent fun onScoreboardChange(event: ScoreboardUpdateEvent) { if (LorenzUtils.inSkyBlock) { isActive = false 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 a206b18a93ce..d9d0a91e965c 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 @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.event.spook import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.jsonobjects.repo.EventsJson import at.hannibal2.skyhanni.data.model.SkyblockStat import at.hannibal2.skyhanni.events.ConfigLoadEvent @@ -135,8 +136,8 @@ object TheGreatSpook { } } - @SubscribeEvent - fun onWorldSwitch(event: IslandChangeEvent) { + @HandleEvent + fun onIslandChange(event: IslandChangeEvent) { val currentTime = SimpleTimeMark.now() val timeRange = greatSpookTimeRange ?: run { isGreatSpookActive = false diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/winter/JyrreTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/event/winter/JyrreTimer.kt index fdabf8733132..513753f2c383 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/winter/JyrreTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/winter/JyrreTimer.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.event.winter import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent @@ -29,7 +30,7 @@ object JyrreTimer { private var display = emptyList() private var duration = 0.seconds - @SubscribeEvent + @HandleEvent fun onProfileJoin(event: ProfileJoinEvent) { resetDisplay() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/winter/UniqueGiftCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/event/winter/UniqueGiftCounter.kt index 309d9a6eac65..9889864f77b8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/winter/UniqueGiftCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/winter/UniqueGiftCounter.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.event.winter import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.data.WinterAPI import at.hannibal2.skyhanni.events.GuiRenderEvent @@ -43,7 +44,7 @@ object UniqueGiftCounter { } } - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { update() } 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 f23c3aefbf8c..0b7058db1572 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.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.data.mob.Mob @@ -116,7 +117,7 @@ object FishingTimer { updateInfo() } - @SubscribeEvent + @HandleEvent fun onSeaCreatureFish(event: SeaCreatureFishEvent) { if (!isEnabled()) return if (!rightLocation) return 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 eb34a391dff0..68029e35d8e4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/LavaReplacement.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/LavaReplacement.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.ConfigLoadEvent @@ -23,7 +24,7 @@ object LavaReplacement { var isActive: Boolean = false private set - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { if (event.newIsland != IslandType.NONE) { update() 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 9c6de0e32459..06c68482af53 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureFeatures.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.config.features.combat.damageindicator.DamageIndicatorConfig import at.hannibal2.skyhanni.data.mob.Mob @@ -73,7 +74,7 @@ object SeaCreatureFeatures { rareSeaCreatures.remove(event.mob) } - @SubscribeEvent + @HandleEvent fun onSeaCreatureFish(event: SeaCreatureFishEvent) { if (!LorenzUtils.inSkyBlock) return if (!config.alertOwnCatches) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt index 504b3ae212bb..2914863f1848 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt @@ -50,7 +50,7 @@ object SeaCreatureManager { } else if (!doubleHook || !thunderBottleChargedPattern.matches(event.message)) { val seaCreature = getSeaCreatureFromMessage(event.message) if (seaCreature != null) { - SeaCreatureFishEvent(seaCreature, event, doubleHook).postAndCatch() + SeaCreatureFishEvent(seaCreature, event, doubleHook).post() } doubleHook = false } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt index ebb8879647af..ee6a29aadcbe 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt @@ -1,18 +1,18 @@ package at.hannibal2.skyhanni.features.fishing import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.SeaCreatureFishEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraft.util.ChatComponentText -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule object SeaCreatureMessageShortener { private val config get() = SkyHanniMod.feature.fishing - @SubscribeEvent + @HandleEvent fun onSeaCreatureFish(event: SeaCreatureFishEvent) { if (!LorenzUtils.inSkyBlock) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt index 5904e1d7f61d..f13230446109 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.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.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent @@ -19,7 +20,7 @@ object SharkFishCounter { private var display = "" private var hasWaterRodInHand = false - @SubscribeEvent + @HandleEvent fun onSeaCreatureFish(event: SeaCreatureFishEvent) { if (!SkyHanniMod.feature.fishing.sharkFishCounter) return 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 0b8e2c3559e8..a24325370f7d 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 @@ -46,7 +46,7 @@ object SeaCreatureTracker { var amount: MutableMap = mutableMapOf() } - @SubscribeEvent + @HandleEvent fun onSeaCreatureFish(event: SeaCreatureFishEvent) { if (!isEnabled()) return @@ -76,7 +76,7 @@ object SeaCreatureTracker { return map } - @SubscribeEvent + @HandleEvent fun onProfileJoin(event: ProfileJoinEvent) { needMigration = true } 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 56b7b6b01e1d..66bd29a013a8 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 @@ -50,7 +50,7 @@ object TrophyFishDisplay { private var display = emptyList() - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { if (event.newIsland == IslandType.CRIMSON_ISLE) { DelayedRun.runDelayed(200.milliseconds) { @@ -68,7 +68,7 @@ object TrophyFishDisplay { } } - @SubscribeEvent + @HandleEvent fun onProfileJoin(event: ProfileJoinEvent) { display = emptyList() update() 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 9f4adefdd98f..8c8dcdd18fd0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt @@ -105,7 +105,7 @@ object FarmingFortuneDisplay { private val ZORROS_CAPE by lazy { "ZORROS_CAPE".toInternalName() } - @SubscribeEvent + @HandleEvent fun onTabListUpdate(event: TabListUpdateEvent) { if (!GardenAPI.inGarden()) return event.tabList.firstNotNullOfOrNull { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt index 9d790b5a8a93..d40334938f0b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.garden +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.GardenCropMilestones import at.hannibal2.skyhanni.data.GardenCropMilestones.getCounter import at.hannibal2.skyhanni.data.GardenCropMilestones.setCounter @@ -87,7 +88,7 @@ object GardenCropMilestoneFix { } } - @SubscribeEvent + @HandleEvent fun onTabListUpdate(event: WidgetUpdateEvent) { if (!event.isWidget(TabWidget.CROP_MILESTONE)) return tabListPattern.firstMatcher(event.lines) { 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 5177c0a1644b..ae52f170e566 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.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.data.ProfileStorageData import at.hannibal2.skyhanni.events.ConfigLoadEvent @@ -70,7 +71,7 @@ object GardenLevelDisplay { private var display = "" - @SubscribeEvent + @HandleEvent fun onProfileJoin(event: ProfileJoinEvent) { update() } 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 81ad4f2fe1f0..40162217e051 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigFileType import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.enums.OutsideSbFeature @@ -136,7 +137,7 @@ object GardenNextJacobContest { } } - @SubscribeEvent + @HandleEvent fun onTabListUpdate(event: TabListUpdateEvent) { var next = false val newList = mutableListOf() 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 e7ee8bdfb17a..281fb01447e4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenWarpCommands.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenWarpCommands.kt @@ -1,5 +1,6 @@ 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.features.misc.LockMouseLook @@ -30,7 +31,7 @@ object GardenWarpCommands { private var lastWarpTime = SimpleTimeMark.farPast() - @SubscribeEvent + @HandleEvent fun onMessageSendToServer(event: MessageSendToServerEvent) { if (!config.warpCommands) return if (!GardenAPI.inGarden()) return 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 f7514898954e..9c8dc43f64a1 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 @@ -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.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.data.IslandType @@ -53,7 +54,7 @@ object ComposterDisplay { } } - @SubscribeEvent + @HandleEvent fun onTabListUpdate(event: WidgetUpdateEvent) { if (!GardenAPI.inGarden()) return if (!event.isWidget(TabWidget.COMPOSTER)) return 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 371da6c80bc8..c26c562b30ce 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 @@ -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.RenderInventoryItemTipEvent import at.hannibal2.skyhanni.features.garden.GardenAPI @@ -34,7 +35,7 @@ object ComposterInventoryNumbers { "§7§7Compost Available: §a(?.*)", ) - @SubscribeEvent + @HandleEvent fun onRenderItemTip(event: RenderInventoryItemTipEvent) { if (!GardenAPI.inGarden()) return if (!GardenAPI.config.composters.inventoryNumbers) return 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 e354dcd7d565..3760c892ce5b 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 @@ -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.config.features.garden.composter.ComposterConfig import at.hannibal2.skyhanni.config.features.garden.composter.ComposterConfig.RetrieveFromEntry @@ -48,7 +49,6 @@ import at.hannibal2.skyhanni.utils.SoundUtils import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TimeUtils.format import at.hannibal2.skyhanni.utils.renderables.Renderable -import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.Collections import kotlin.math.ceil @@ -115,7 +115,7 @@ object ComposterOverlay { inInventory = false } - @SubscribeEvent(priority = EventPriority.LOW) + @HandleEvent(priority = HandleEvent.LOW) fun onTabListUpdate(event: TabListUpdateEvent) { if (!inInventory) return @@ -542,7 +542,7 @@ object ComposterOverlay { return price } - @SubscribeEvent + @HandleEvent fun onNeuRepoReload(event: NeuRepositoryReloadEvent) { updateOrganicMatterFactors() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestFFNeededDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestFFNeededDisplay.kt index 5d9b7f92f34e..9c1c99a8aaef 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestFFNeededDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestFFNeededDisplay.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.garden.contest +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.RenderItemTooltipEvent @@ -29,7 +30,7 @@ object JacobContestFFNeededDisplay { private var lastToolTipTime = SimpleTimeMark.farPast() private val cache = mutableMapOf>>() - @SubscribeEvent + @HandleEvent fun onRenderItemTooltip(event: RenderItemTooltipEvent) { if (!isEnabled()) return 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 631c6155d4aa..81ed91f01078 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 @@ -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.data.IslandType import at.hannibal2.skyhanni.data.jsonobjects.repo.ArmorDropInfo @@ -67,7 +68,7 @@ object ArmorDropTracker { FERMENTO("§6Fermento", "§6§lRARE CROP! §r§f§r§6Fermento §r§b(Armor Set Bonus)"), } - @SubscribeEvent + @HandleEvent fun onProfileJoin(event: ProfileJoinEvent) { hasArmor = false } @@ -108,7 +109,7 @@ object ArmorDropTracker { tracker.renderDisplay(config.pos) } - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { if (event.newIsland == IslandType.GARDEN) { tracker.firstUpdate() 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 ae01d2dd03fe..0c5b6e3f9331 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 @@ -65,7 +65,7 @@ object CropMoneyDisplay { private val SEEDS by lazy { "SEEDS".toInternalName() } private val ENCHANTED_SEEDS by lazy { "ENCHANTED_SEEDS".toInternalName() } - @SubscribeEvent + @HandleEvent fun onProfileJoin(event: ProfileJoinEvent) { display = emptyList() } 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 e8a998b2f44f..7e3eee6fe9da 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 @@ -65,7 +65,7 @@ object FarmingWeightDisplay { resetData() } - @SubscribeEvent + @HandleEvent fun onProfileJoin(event: ProfileJoinEvent) { display = emptyList() profileId = "" 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 f2179e39a648..887c0c8ed602 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 @@ -36,7 +36,6 @@ import at.hannibal2.skyhanni.utils.SoundUtils import at.hannibal2.skyhanni.utils.TimeUnit import at.hannibal2.skyhanni.utils.TimeUtils.format import at.hannibal2.skyhanni.utils.renderables.Renderable -import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds @@ -91,7 +90,7 @@ object GardenCropMilestoneDisplay { } } - @SubscribeEvent(priority = EventPriority.LOW) + @HandleEvent(priority = HandleEvent.LOW) fun onProfileJoin(event: ProfileJoinEvent) { GardenCropMilestones.cropCounter?.let { if (it.values.sum() == 0L) { @@ -107,7 +106,7 @@ object GardenCropMilestoneDisplay { update() } - @SubscribeEvent + @HandleEvent fun onOwnInventoryItemUpdate(event: OwnInventoryItemUpdateEvent) { if (!GardenAPI.inGarden()) return 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 dce5b90d771e..a30f40727276 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 @@ -57,7 +57,7 @@ object GardenCropSpeed { } } - @SubscribeEvent + @HandleEvent fun onProfileJoin(event: ProfileJoinEvent) { lastBrokenCrop = null } 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 79b9ee80da6c..492e2016c364 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 @@ -44,7 +44,7 @@ object GardenCropMilestoneInventory { average = -1.0 } - @SubscribeEvent + @HandleEvent fun onRenderItemTip(event: RenderInventoryItemTipEvent) { if (average == -1.0) return 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 6c061208b4d9..f48d5b4580a8 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 @@ -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.GardenCropMilestones import at.hannibal2.skyhanni.data.GardenCropMilestones.getCounter @@ -29,7 +30,7 @@ object GardenInventoryNumbers { "§7Current Tier: §[ea](?.*)§7/§a.*", ) - @SubscribeEvent + @HandleEvent fun onRenderItemTip(event: RenderItemTipEvent) { if (!GardenAPI.inGarden()) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/LogBookStats.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/LogBookStats.kt index 121397ce222b..b35ff8342ffd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/LogBookStats.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/LogBookStats.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.garden.inventory +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent @@ -103,7 +104,7 @@ object LogBookStats { } } - @SubscribeEvent + @HandleEvent fun onProfileChange(event: ProfileJoinEvent) { display = emptyList() loggedVisitors.clear() 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 effa6ba14dfb..129ec78e28f5 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 @@ -219,7 +219,7 @@ object PestAPI { updatePests() } - @SubscribeEvent + @HandleEvent fun onTabListUpdate(event: TabListUpdateEvent) { if (!GardenAPI.inGarden()) return for (line in event.tabList) { @@ -242,7 +242,7 @@ object PestAPI { } } - @SubscribeEvent + @HandleEvent fun onScoreboardChange(event: ScoreboardUpdateEvent) { if (!GardenAPI.inGarden()) return if (!firstScoreboardCheck) return 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 ca546a7af2c0..cdba3155f7b7 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 @@ -96,7 +96,7 @@ object PestFinder { } } - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { display = listOf() update() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestProfitTracker.kt index f7809f6ef5c2..5fb916d39fc7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestProfitTracker.kt @@ -145,7 +145,7 @@ object PestProfitTracker { tracker.renderDisplay(config.position) } - @SubscribeEvent + @HandleEvent fun onPurseChange(event: PurseChangeEvent) { if (!isEnabled()) return val coins = event.coins @@ -155,7 +155,7 @@ object PestProfitTracker { } } - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { if (event.newIsland == IslandType.GARDEN) { tracker.firstUpdate() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/SprayDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/SprayDisplay.kt index b7db28d37ca9..beb80312a70b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/SprayDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/SprayDisplay.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.garden.pests +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.IslandChangeEvent @@ -45,7 +46,7 @@ object SprayDisplay { } } - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { if (!LorenzUtils.inSkyBlock) return if (!config.expiryNotification || event.newIsland != IslandType.GARDEN) return 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 8b4735f61237..360768e560a2 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 @@ -113,7 +113,7 @@ object GardenVisitorDropStatistics { return newList } - @SubscribeEvent + @HandleEvent fun onProfileJoin(event: ProfileJoinEvent) { display = emptyList() } 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 fd740459a958..89b1577a5618 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 @@ -124,7 +124,7 @@ object GardenVisitorFeatures { private var lastFullPrice = 0.0 private val greenThumb = "GREEN_THUMB;1".toInternalName() - @SubscribeEvent + @HandleEvent fun onProfileJoin(event: ProfileJoinEvent) { display = emptyList() } @@ -344,7 +344,7 @@ object GardenVisitorFeatures { add(list) } - @SubscribeEvent + @HandleEvent fun onOwnInventoryItemUpdate(event: OwnInventoryItemUpdateEvent) { if (GardenAPI.onBarnPlot) { update() 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 98f3c906cc40..14ad314cfc8d 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 @@ -71,7 +71,7 @@ object GardenVisitorTimer { visitorJustArrived = true } - @SubscribeEvent + @HandleEvent fun onProfileJoin(event: ProfileJoinEvent) { display = null lastMillis = 0.seconds 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 f8612c0cd7b7..b35535524f8a 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 @@ -50,7 +50,7 @@ object VisitorListener { private val logger = LorenzLogger("garden/visitors/listener") - @SubscribeEvent + @HandleEvent fun onProfileJoin(event: ProfileJoinEvent) { VisitorAPI.reset() } @@ -68,7 +68,7 @@ object VisitorListener { lastClickedNpc = entityId } - @SubscribeEvent + @HandleEvent fun onTabListUpdate(event: WidgetUpdateEvent) { if (!GardenAPI.inGarden()) return if (!event.isWidget(TabWidget.VISITORS)) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/BeaconPower.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/BeaconPower.kt index 8c68dc2c100b..c8cb94dde07e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/BeaconPower.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/BeaconPower.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.gui import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryUpdatedEvent @@ -117,7 +118,7 @@ object BeaconPower { } } - @SubscribeEvent + @HandleEvent fun onProfileJoin(event: ProfileJoinEvent) { display = "" } diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/TabWidgetDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/TabWidgetDisplay.kt index da570741e109..efcc539d0d80 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/TabWidgetDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/TabWidgetDisplay.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.gui import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.core.config.Position import at.hannibal2.skyhanni.data.model.TabWidget import at.hannibal2.skyhanni.events.GuiRenderEvent @@ -61,7 +62,7 @@ enum class TabWidgetDisplay(private val configName: String?, vararg val widgets: } } - @SubscribeEvent + @HandleEvent fun onJoin(event: ProfileJoinEvent) { // Validation that the displayPositions in the config is correct val sizeDiff = TabWidgetDisplay.entries.size - config.displayPositions.size 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 054da32af67b..6df445836fc3 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 @@ -120,7 +120,7 @@ object CustomScoreboard { if (LorenzUtils.inSkyBlock && displayConfig.useCustomLines) UnknownLinesHandler.handleUnknownLines() } - @SubscribeEvent + @HandleEvent fun onScoreboardChange(event: ScoreboardUpdateEvent) { dirty = true } @@ -199,7 +199,7 @@ object CustomScoreboard { } } - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { if (event.newIsland != IslandType.NONE) updateIslandEntries() } 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 c80dfb965329..94b66b827a86 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 @@ -34,7 +34,7 @@ object QuiverDisplay { private var amount = QuiverAPI.currentAmount private var hideAmount = false - @SubscribeEvent + @HandleEvent fun onProfileJoin(event: ProfileJoinEvent) { display = emptyList() arrow = QuiverAPI.currentArrow 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 80ab64241696..904e3f62c72d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/CarnivalShopHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/CarnivalShopHelper.kt @@ -108,7 +108,7 @@ object CarnivalShopHelper { overviewInfoItemStack.let { event.replace(it) } } - @SubscribeEvent + @HandleEvent fun onNeuRepoReload(event: NeuRepositoryReloadEvent) { val repoTokenShops = event.readConstant("carnivalshops").carnivalTokenShops repoEventShops = repoTokenShops.map { (key, value) -> 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 acd18ab6add2..0000d72747e8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/EssenceShopHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/EssenceShopHelper.kt @@ -127,7 +127,7 @@ object EssenceShopHelper { } } - @SubscribeEvent + @HandleEvent fun onNeuRepoReload(event: NeuRepositoryReloadEvent) { val repoEssenceShops = event.readConstant>>("essenceshops") essenceShops = repoEssenceShops.map { (key, value) -> 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 cbef1b8c72a0..532267f11528 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt @@ -189,7 +189,7 @@ object HarpFeatures { } } - @SubscribeEvent + @HandleEvent fun onRenderItemTip(event: RenderItemTipEvent) { if (!LorenzUtils.inSkyBlock) return if (!config.showNumbers) return 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 5c3fde3ef3b2..e4ec55351758 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.inventory import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.api.CollectionAPI import at.hannibal2.skyhanni.api.SkillAPI +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.BESTIARY_LEVEL @@ -123,7 +124,7 @@ object ItemDisplayOverlayFeatures { "(?.*)k Enchanting Exp", ) - @SubscribeEvent + @HandleEvent fun onRenderItemTip(event: RenderItemTipEvent) { event.stackTip = getStackTip(event.stack) ?: return } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemPickupLog.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemPickupLog.kt index 9482ae5fbc7f..e4622f8767b2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemPickupLog.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemPickupLog.kt @@ -130,7 +130,7 @@ object ItemPickupLog { } } - @SubscribeEvent + @HandleEvent fun onPurseChange(event: PurseChangeEvent) { if (!isEnabled() || !config.coins || !worldChangeCooldown()) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt index b6efc117bd0b..6c5e69a2fe5b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.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.features.inventory.InventoryConfig.ItemNumberEntry.CRIMSON_ARMOR import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.events.RenderItemTipEvent @@ -47,7 +48,7 @@ object ItemStars { } } - @SubscribeEvent + @HandleEvent fun onRenderItemTip(event: RenderItemTipEvent) { if (!LorenzUtils.inSkyBlock) return if (!CRIMSON_ARMOR.isSelected()) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/PersonalCompactorOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/PersonalCompactorOverlay.kt index 075fb2e51e4d..66f145d17cee 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/PersonalCompactorOverlay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/PersonalCompactorOverlay.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.features.inventory.PersonalCompactorConfig import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryUpdatedEvent @@ -105,7 +106,7 @@ object PersonalCompactorOverlay { compactorEnabledMap.clear() } - @SubscribeEvent + @HandleEvent fun onRenderItemTip(event: RenderItemTipEvent) { if (!LorenzUtils.inSkyBlock) return if (!config.showToggle) return 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 fe026284aa8f..2d6916355451 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/RngMeterInventory.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/RngMeterInventory.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.RenderItemTipEvent @@ -21,7 +22,7 @@ object RngMeterInventory { private val config get() = SkyHanniMod.feature.inventory.rngMeter - @SubscribeEvent + @HandleEvent fun onRenderItemTip(event: RenderItemTipEvent) { val chestName = InventoryUtils.openInventoryName() 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 c2ad69db8bf2..935dc580bd90 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.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.MaxwellAPI import at.hannibal2.skyhanni.events.GuiContainerEvent @@ -32,7 +33,7 @@ object StatsTuning { "§7Stat has: §e(?\\d+) points?", ) - @SubscribeEvent + @HandleEvent fun onRenderItemTip(event: RenderInventoryItemTipEvent) { val inventoryName = event.inventoryName diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/UltimateEnchantStar.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/UltimateEnchantStar.kt index 315d9822b7ba..52de19cca816 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/UltimateEnchantStar.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/UltimateEnchantStar.kt @@ -1,20 +1,20 @@ package at.hannibal2.skyhanni.features.inventory import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.RenderItemTipEvent import at.hannibal2.skyhanni.events.RenderObject import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getEnchantments import net.minecraft.init.Items -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule object UltimateEnchantStar { private val config get() = SkyHanniMod.feature.inventory - @SubscribeEvent + @HandleEvent fun onRenderItemTip(event: RenderItemTipEvent) { if (!isEnabled()) return if (event.stack.item != Items.enchanted_book) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarOrderHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarOrderHelper.kt index ba643f7acf4d..76ea0507712b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarOrderHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarOrderHelper.kt @@ -23,14 +23,26 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule object BazaarOrderHelper { private val patternGroup = RepoPattern.group("bazaar.orderhelper") + + /** + * REGEX-TEST: §a§lBUY §fWheat + */ private val bazaarItemNamePattern by patternGroup.pattern( "itemname", "§.§l(?BUY|SELL) (?.*)", ) + + /** + * REGEX-TEST: §7Filled: §a200§7/200 §a§l100%! + */ private val filledPattern by patternGroup.pattern( "filled", "§7Filled: §[a6].*§7/.* §a§l100%!", ) + + /** + * REGEX-TEST: §7Price per unit: §63.1 coins + */ private val pricePattern by patternGroup.pattern( "price", "§7Price per unit: §6(?.*) coins", diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBlockOpen.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBlockOpen.kt index ab069e9b236f..4592d5262331 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBlockOpen.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBlockOpen.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.data.EntityMovementData import at.hannibal2.skyhanni.data.IslandGraphs import at.hannibal2.skyhanni.data.IslandType @@ -56,7 +57,7 @@ object ChocolateFactoryBlockOpen { if (checkIsBlocked()) event.cancel() } - @SubscribeEvent + @HandleEvent fun onCommandSend(event: MessageSendToServerEvent) { if (!LorenzUtils.inSkyBlock) return if (!commandPattern.matches(event.message)) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryCustomReminder.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryCustomReminder.kt index 8023de822cd1..4ea9b0ff4c67 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryCustomReminder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryCustomReminder.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.inventory.chocolatefactory +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.hypixel.chat.event.SystemMessageEvent import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.GuiRenderEvent @@ -71,7 +72,7 @@ object ChocolateFactoryCustomReminder { "§cYou must collect (.*) all-time Chocolate!", ) - @SubscribeEvent + @HandleEvent fun onChat(event: SystemMessageEvent) { if (!isEnabled()) return if (!ChocolateFactoryAPI.inChocolateFactory) 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 337a62cc5cb3..7ee90d1ea283 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 @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.inventory.chocolatefactory +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.RenderInventoryItemTipEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule @@ -83,7 +84,7 @@ object ChocolateFactoryInventory { } } - @SubscribeEvent + @HandleEvent fun onRenderItemTip(event: RenderInventoryItemTipEvent) { if (!ChocolateFactoryAPI.inChocolateFactory) return if (!config.showStackSizes) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayTimer.kt index 2c69162b441b..a4373133592b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayTimer.kt @@ -38,7 +38,7 @@ object ChocolateFactoryStrayTimer { lastTimerSubtraction = null } - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { timer = Duration.ZERO } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTimeTowerManager.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTimeTowerManager.kt index 6c5bdf2803ab..0babc16da964 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTimeTowerManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTimeTowerManager.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.inventory.chocolatefactory +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.features.fame.ReminderUtils @@ -25,7 +26,7 @@ object ChocolateFactoryTimeTowerManager { private var warnAboutNewCharge = false private var wasTimeTowerRecentlyActive = false - @SubscribeEvent + @HandleEvent fun onProfileJoin(event: ProfileJoinEvent) { wasTimeTowerRecentlyActive = false } @@ -152,7 +153,7 @@ object ChocolateFactoryTimeTowerManager { return endTime - currentTime } - @SubscribeEvent + @HandleEvent fun onProfileChange(event: ProfileJoinEvent) { lastTimeTowerWarning = SimpleTimeMark.farPast() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryUpgradeWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryUpgradeWarning.kt index 0ec9554495a2..39cbcf5e9f3e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryUpgradeWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryUpgradeWarning.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.inventory.chocolatefactory +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.features.fame.ReminderUtils @@ -52,7 +53,7 @@ object ChocolateFactoryUpgradeWarning { ) } - @SubscribeEvent + @HandleEvent fun onProfileChange(event: ProfileJoinEvent) { lastUpgradeWarning = SimpleTimeMark.farPast() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/ExperimentsProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/ExperimentsProfitTracker.kt index a59997b03436..6fb3c8624784 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/ExperimentsProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/ExperimentsProfitTracker.kt @@ -246,7 +246,7 @@ object ExperimentsProfitTracker { tracker.renderDisplay(config.position) } - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { if (event.newIsland == IslandType.PRIVATE_ISLAND) { tracker.firstUpdate() 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 5dfcd609021d..897d8bb03440 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 @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.inventory.tiarelay 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.PlaySoundEvent @@ -29,7 +30,7 @@ object TiaRelayHelper { private val resultDisplay = mutableMapOf() - @SubscribeEvent + @HandleEvent fun onPlaySound(event: PlaySoundEvent) { if (!LorenzUtils.inSkyBlock) return val soundName = event.soundName @@ -98,7 +99,7 @@ object TiaRelayHelper { } } - @SubscribeEvent + @HandleEvent fun onRenderItemTip(event: RenderInventoryItemTipEvent) { if (!LorenzUtils.inSkyBlock) return if (!config.soundHelper) return 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 86cca44ac7ec..943292379228 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 @@ -65,7 +65,7 @@ object ItemAbilityCooldown { private val TOTEM_OF_CORRUPTION = "TOTEM_OF_CORRUPTION".toInternalName() - @SubscribeEvent + @HandleEvent fun onPlaySound(event: PlaySoundEvent) { when { // Hyperion @@ -335,7 +335,7 @@ object ItemAbilityCooldown { } } - @SubscribeEvent + @HandleEvent fun onRenderItemTip(event: RenderItemTipEvent) { if (!isEnabled()) return @@ -357,7 +357,7 @@ object ItemAbilityCooldown { } } - @SubscribeEvent + @HandleEvent fun onRenderItem(event: RenderGuiItemOverlayEvent) { if (!isEnabled()) return if (!config.itemAbilityCooldownBackground) return 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 1ab0632a59b7..674d2f413bec 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsGuide.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsGuide.kt @@ -58,7 +58,7 @@ object DeepCavernsGuide { "§e\\[NPC] §bLift Operator§f: §rVenture down into the Lapis Quarry to unlock my Lift Menu!", ) - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { parkourHelper?.reset() show = false diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/FlowstateHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/FlowstateHelper.kt index 1592e06eefd3..3e85882627d0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/FlowstateHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/FlowstateHelper.kt @@ -123,7 +123,7 @@ object FlowstateHelper { hasFlowstate() } - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { streakEndTimer = SimpleTimeMark.farPast() attemptClearDisplay() 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 175eb75a2ccd..36027a17acf7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/HighlightMiningCommissionMobs.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/HighlightMiningCommissionMobs.kt @@ -72,7 +72,7 @@ object HighlightMiningCommissionMobs { } } - @SubscribeEvent + @HandleEvent fun onTabListUpdate(event: TabListUpdateEvent) { if (!isEnabled()) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/HotmFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/HotmFeatures.kt index 8f9f038e55ee..316a5a123d92 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/HotmFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/HotmFeatures.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.mining import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.HotmData import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.RenderItemTipEvent @@ -28,7 +29,7 @@ object HotmFeatures { } } - @SubscribeEvent + @HandleEvent fun onRenderTip(event: RenderItemTipEvent) { if (!isEnabled()) return handleLevelStackSize(event) diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/MineshaftPityDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/MineshaftPityDisplay.kt index 79d838f20c97..022ac0a06b90 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/MineshaftPityDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/MineshaftPityDisplay.kt @@ -257,7 +257,7 @@ object MineshaftPityDisplay { update() } - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { if (event.newIsland == IslandType.MINESHAFT || event.oldIsland == IslandType.MINESHAFT) { resetCounter() 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 16dedd8d35e5..4e3b6ed7e45a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/MiningCommissionsBlocksColor.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/MiningCommissionsBlocksColor.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.mining import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.MiningAPI.inCrystalHollows import at.hannibal2.skyhanni.data.MiningAPI.inDwarvenMines import at.hannibal2.skyhanni.data.MiningAPI.inGlacite @@ -66,7 +67,7 @@ object MiningCommissionsBlocksColor { private var replaceBlocksMapCache = mutableMapOf() // TODO Commission API - @SubscribeEvent + @HandleEvent fun onTabListUpdate(event: TabListUpdateEvent) { for (block in CommissionBlock.entries) { val tabList = " §r§f${block.commissionName}: " 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 0690ac432256..a8365a6eaaa8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/TunnelsMaps.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/TunnelsMaps.kt @@ -512,7 +512,7 @@ object TunnelsMaps { } } - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { if (closestNode == null) return // Value that must be none null if it was active closestNode = null 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 aa855d4df8f7..760a4f357b69 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 @@ -198,7 +198,7 @@ object MiningEventTracker { } } - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { if (apiError) { canRequestAt = SimpleTimeMark.now() diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ExcavatorProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ExcavatorProfitTracker.kt index c93e725879e3..a5b4fd3a508b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ExcavatorProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ExcavatorProfitTracker.kt @@ -225,7 +225,7 @@ object ExcavatorProfitTracker { tracker.renderDisplay(config.position) } - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { if (event.newIsland == IslandType.DWARVEN_MINES) { tracker.firstUpdate() diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/GlacitePowderFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/GlacitePowderFeatures.kt index d3c6de97715b..9cf5cf19655a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/GlacitePowderFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/GlacitePowderFeatures.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.mining.fossilexcavator import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.RenderItemTipEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.ItemUtils.cleanName @@ -8,7 +9,6 @@ import at.hannibal2.skyhanni.utils.NumberUtil.formatLong import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule object GlacitePowderFeatures { @@ -21,7 +21,7 @@ object GlacitePowderFeatures { "Glacite Powder x(?.*)" ) - @SubscribeEvent + @HandleEvent fun onRenderItemTip(event: RenderItemTipEvent) { if (!isEnabled()) return 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 75beba0569e2..85d3041c77fa 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 @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.mining.fossilexcavator.solver 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.data.IslandType import at.hannibal2.skyhanni.events.GuiContainerEvent @@ -177,7 +178,7 @@ object FossilSolverDisplay { } } - @SubscribeEvent + @HandleEvent fun onRenderItemTip(event: RenderInventoryItemTipEvent) { if (!isEnabled()) return if (!config.showPercentage) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/CorpseLocator.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/CorpseLocator.kt index 7382725374d1..6dc062f0c41e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/CorpseLocator.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/CorpseLocator.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.mining.glacitemineshaft import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.PartyAPI import at.hannibal2.skyhanni.data.hypixel.chat.event.PartyChatEvent @@ -101,12 +102,12 @@ object CorpseLocator { shareCorpse() } - @SubscribeEvent + @HandleEvent fun onPartyChat(event: PartyChatEvent) { handleChatEvent(event.author, event.message) } - @SubscribeEvent + @HandleEvent fun onAllChat(event: PlayerAllChatEvent) { handleChatEvent(event.author, event.message) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/CorpseTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/CorpseTracker.kt index c9cc422d9fc5..69b3e6235aa6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/CorpseTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/CorpseTracker.kt @@ -136,7 +136,7 @@ object CorpseTracker { tracker.renderDisplay(config.position) } - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { if (event.newIsland == IslandType.MINESHAFT || event.newIsland == IslandType.DWARVEN_MINES) { tracker.firstUpdate() 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 2c05e35251ae..4f8b11101581 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 @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.mining.glacitemineshaft import at.hannibal2.skyhanni.SkyHanniMod +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 @@ -34,7 +35,7 @@ object MineshaftWaypoints { waypoints.clear() } - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { if (event.newIsland != IslandType.MINESHAFT) 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 afa592f01abf..240464944fb0 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 @@ -287,7 +287,7 @@ object PowderTracker { } } - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { if (event.newIsland == IslandType.CRYSTAL_HOLLOWS) { tracker.firstUpdate() diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionCollectLogic.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionCollectLogic.kt index 92e0e27020ac..142836480352 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionCollectLogic.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionCollectLogic.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.minion +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.MinionOpenEvent import at.hannibal2.skyhanni.events.entity.ItemAddInInventoryEvent @@ -15,7 +16,7 @@ object MinionCollectLogic { private var oldMap = mapOf() - @SubscribeEvent + @HandleEvent fun onMinionOpen(event: MinionOpenEvent) { if (oldMap.isNotEmpty()) return oldMap = count() 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 d413f89b1ddb..15220a6515d5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt @@ -181,12 +181,12 @@ object MinionFeatures { event.inventoryItems[48]?.let { if (minionCollectItemPattern.matches(it.name)) { - MinionOpenEvent(event.inventoryName, event.inventoryItems).postAndCatch() + MinionOpenEvent(event.inventoryName, event.inventoryItems).post() return } } - MinionStorageOpenEvent(lastStorage, event.inventoryItems).postAndCatch() + MinionStorageOpenEvent(lastStorage, event.inventoryItems).post() minionStorageInventoryOpen = true } @@ -194,11 +194,11 @@ object MinionFeatures { fun onInventoryUpdated(event: InventoryUpdatedEvent) { if (!enableWithHub()) return if (minionInventoryOpen) { - MinionOpenEvent(event.inventoryName, event.inventoryItems).postAndCatch() + MinionOpenEvent(event.inventoryName, event.inventoryItems).post() } } - @SubscribeEvent + @HandleEvent fun onMinionOpen(event: MinionOpenEvent) { removeBuggedMinions() val minions = minions ?: return @@ -274,7 +274,7 @@ object MinionFeatures { minions[location]?.lastClicked = 0 } } - MinionCloseEvent().postAndCatch() + MinionCloseEvent().post() } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt index f756b8ac8125..181bc415f3bc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.minion import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.Perk import at.hannibal2.skyhanni.data.jsonobjects.repo.MinionXPJson import at.hannibal2.skyhanni.events.IslandChangeEvent @@ -50,7 +51,7 @@ object MinionXp { private fun toPrimitiveItemStack(itemStack: ItemStack) = PrimitiveItemStack(itemStack.getInternalName(), itemStack.stackSize) - @SubscribeEvent + @HandleEvent fun onMinionOpen(event: MinionOpenEvent) { if (!config.xpDisplay) return @@ -117,7 +118,7 @@ object MinionXp { return xpTotal } - @SubscribeEvent + @HandleEvent fun onMinionStorageOpen(event: MinionStorageOpenEvent) { if (!config.xpDisplay) return @@ -171,14 +172,14 @@ object MinionXp { } } - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { minionStorages.clear() xpItemMap.clear() collectItemXpList.clear() } - @SubscribeEvent + @HandleEvent fun onMinionClose(event: MinionCloseEvent) { xpItemMap.clear() collectItemXpList.clear() diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/BrewingStandOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/BrewingStandOverlay.kt index 193f1e2ec39a..823e1f9bcfcc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/BrewingStandOverlay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/BrewingStandOverlay.kt @@ -1,16 +1,16 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.RenderInventoryItemTipEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule object BrewingStandOverlay { - @SubscribeEvent + @HandleEvent fun onRenderItemTip(event: RenderInventoryItemTipEvent) { if (!LorenzUtils.inSkyBlock) return if (!SkyHanniMod.feature.misc.brewingStandOverlay) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/JoinCrystalHollows.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/JoinCrystalHollows.kt index ff5a5f7ac57d..df65deaed9bb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/JoinCrystalHollows.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/JoinCrystalHollows.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.data.IslandType import at.hannibal2.skyhanni.events.IslandChangeEvent import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -45,7 +46,7 @@ object JoinCrystalHollows { } } - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { if (!isEnabled()) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/MagicalPowerDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/MagicalPowerDisplay.kt index 48ac496fd862..ec49e3fa499c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/MagicalPowerDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/MagicalPowerDisplay.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.data.ProfileStorageData import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.RenderItemTipEvent @@ -74,7 +75,7 @@ object MagicalPowerDisplay { "Your contacts: (?\\d+)\\/\\d+", ) - @SubscribeEvent + @HandleEvent fun onRenderItemTip(event: RenderItemTipEvent) { if (!isEnabled()) return if (!acceptedInvPattern.matches(InventoryUtils.openInventoryName().removeColor())) return 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 3ece93a79af2..31efab14d9d4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt @@ -89,7 +89,7 @@ object NonGodPotEffectDisplay { ) private var totalEffectsCount = 0 - @SubscribeEvent + @HandleEvent fun onProfileJoin(event: ProfileJoinEvent) { effectDuration.clear() display = emptyList() diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ReplaceRomanNumerals.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ReplaceRomanNumerals.kt index 6d3123f61f3c..a25cc348577d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ReplaceRomanNumerals.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ReplaceRomanNumerals.kt @@ -55,7 +55,7 @@ object ReplaceRomanNumerals { GuiChatHook.replaceOnlyHoverEvent(hoverEvent) } - @SubscribeEvent + @HandleEvent fun onSystemMessage(event: SystemMessageEvent) { if (!isEnabled() || event.message.isSelectOption()) return event.applyIfPossible { it.transformLine() } 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 fb2054f25126..816bb7699d79 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 @@ -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.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule @@ -105,7 +106,7 @@ object TabListReader { combineColumnsToRender(columns, renderColumn) } - @SubscribeEvent + @HandleEvent fun onTabListUpdate(event: TabListUpdateEvent) { updateTablistData(event.tabList) } 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 6fa91f7bf7f0..4d9ae1762704 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 @@ -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.events.GuiRenderEvent import at.hannibal2.skyhanni.events.SkipTabListLineEvent @@ -139,7 +140,7 @@ object TabListRenderer { if (tabLine.type == TabStringType.SUB_TITLE) { lastSubTitle = tabLine } - !SkipTabListLineEvent(tabLine, lastSubTitle, lastTitle).postAndCatch() + !SkipTabListLineEvent(tabLine, lastSubTitle, lastTitle).post() }.let(::RenderColumn) Gui.drawRect( @@ -212,7 +213,7 @@ object TabListRenderer { "§.§lFire Sales: §r§f\\([0-9]+\\)" ) - @SubscribeEvent + @HandleEvent fun onSkipTablistLine(event: SkipTabListLineEvent) { if (config.hideFiresales && event.lastSubTitle != null && fireSalePattern.matches(event.lastSubTitle.text)) { event.cancel() 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 7fae6ea1e80b..6b9721e12754 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 @@ -51,7 +51,7 @@ object EstimatedItemValue { fun isCurrentlyShowing() = currentlyShowing && Minecraft.getMinecraft().currentScreen != null - @SubscribeEvent + @HandleEvent fun onNeuRepoReload(event: NeuRepositoryReloadEvent) { gemstoneUnlockCosts = event.readConstant>>>("gemstonecosts") @@ -155,7 +155,7 @@ object EstimatedItemValue { } } - @SubscribeEvent + @HandleEvent fun onRenderItemTooltip(event: RenderItemTooltipEvent) { if (!LorenzUtils.inSkyBlock) return if (!config.enabled) return 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 3a825174673e..787140aab65c 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 @@ -56,10 +56,10 @@ object LimboTimeTracker { } } - @SubscribeEvent + @HandleEvent fun onMessageSendToServer(event: MessageSendToServerEvent) { if (event.message.startsWith("/playtime") && inLimbo) { - event.isCanceled + event.cancel() printStats(true) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadInventoryNumber.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadInventoryNumber.kt index 1154bf472503..bcf713857e4d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadInventoryNumber.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadInventoryNumber.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc.teleportpad import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.RenderInventoryItemTipEvent @@ -75,7 +76,7 @@ object TeleportPadInventoryNumber { event.inventoryName == "Set Destination" && SkyHanniMod.feature.misc.teleportPad.inventoryNumbers } - @SubscribeEvent + @HandleEvent fun onRenderItemTip(event: RenderInventoryItemTipEvent) { if (!IslandType.PRIVATE_ISLAND.isInIsland()) return if (!inTeleportPad) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/VolcanoExplosivityDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/VolcanoExplosivityDisplay.kt index 441dac11bbea..bd2c4361f230 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/VolcanoExplosivityDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/VolcanoExplosivityDisplay.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.model.TabWidget import at.hannibal2.skyhanni.events.GuiRenderEvent @@ -27,7 +28,7 @@ object VolcanoExplosivityDisplay { ) private var display = "" - @SubscribeEvent + @HandleEvent fun onTabListUpdate(event: WidgetUpdateEvent) { if (!isEnabled()) return if (!event.isWidget(TabWidget.VOLCANO)) return 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 5ca8dfa18743..af85ffaa1d2c 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 @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.storage.ProfileSpecificStorage import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.SackAPI.getAmountInSacksOrNull @@ -105,7 +106,7 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) { } } - @SubscribeEvent + @HandleEvent fun onTabListUpdate(event: WidgetUpdateEvent) { if (!event.isWidget(TabWidget.FACTION_QUESTS)) return if (!isEnabled()) return 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 16b1aecef5a8..88e7a371f4ec 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 @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.rift.area.dreadfarm +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzTickEvent @@ -107,7 +108,7 @@ object RiftWiltedBerberisHelper { } } - @SubscribeEvent + @HandleEvent fun onPlaySound(event: PlaySoundEvent) { if (!isMuteOthersSoundsEnabled()) return val soundName = event.soundName 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 1913a8fbcf4d..311aa0b20ab3 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 @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.rift.area.livingcave +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent @@ -104,7 +105,7 @@ object LivingCaveDefenseBlocks { else -> false } - @SubscribeEvent + @HandleEvent fun onBlockChange(event: ServerBlockChangeEvent) { if (!isEnabled()) return val location = event.location diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveLivingMetalHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveLivingMetalHelper.kt index 3aeb4af3d04f..e4f251d7b739 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveLivingMetalHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveLivingMetalHelper.kt @@ -35,7 +35,7 @@ object LivingCaveLivingMetalHelper { } } - @SubscribeEvent + @HandleEvent fun onBlockChange(event: ServerBlockChangeEvent) { if (!isEnabled()) return val location = event.location @@ -91,7 +91,7 @@ object LivingCaveLivingMetalHelper { } } - @SubscribeEvent + @HandleEvent fun onTitleReceived(event: TitleReceivedEvent) { if (!isEnabled()) return if (event.title.contains("Living Metal")) { 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 f571d2b42630..2645ae0a790a 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 @@ -114,7 +114,7 @@ object DanceRoomHelper { } } - @SubscribeEvent + @HandleEvent fun onPlaySound(event: PlaySoundEvent) { if (!isEnabled() || !inRoom) return if ((event.soundName == "random.burp" && event.volume == 0.8f) || @@ -132,7 +132,7 @@ object DanceRoomHelper { } } - @SubscribeEvent + @HandleEvent fun onTitleReceived(event: TitleReceivedEvent) { if (!isEnabled()) return if (config.hideOriginalTitle && inRoom) event.cancel() 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 3cab8d831b23..dc1ee79ac35c 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 @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.rift.area.stillgorechateau +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.jsonobjects.repo.RiftEffigiesJson import at.hannibal2.skyhanni.events.DebugDataCollectEvent @@ -79,7 +80,7 @@ object RiftBloodEffigies { locations = newLocations } - @SubscribeEvent + @HandleEvent fun onScoreboardChange(event: RawScoreboardUpdateEvent) { if (!isEnabled()) return 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 a19607633734..0c8529f4b256 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 @@ -56,7 +56,7 @@ object RiftGunthersRace { "§3§lRIFT RACING §r§cRace cancelled!.*" ) - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { parkourHelper?.reset() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminTracker.kt index 8172ccfa50cb..5d2d9efc7d4d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminTracker.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.rift.area.westvillage +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent @@ -190,7 +191,7 @@ object VerminTracker { tracker.renderDisplay(config.position) } - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { if (event.newIsland == IslandType.THE_RIFT) { tracker.firstUpdate() 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 00ac5caf040f..5610e97a2cff 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 @@ -127,8 +127,8 @@ object PunchcardHighlight { } } - @SubscribeEvent - fun onWorldSwitch(event: IslandChangeEvent) { + @HandleEvent + fun onIslandChange(event: IslandChangeEvent) { DelayedRun.runDelayed(1500.milliseconds) { if (playerList.isEmpty()) return@runDelayed if (event.newIsland != IslandType.THE_RIFT) return@runDelayed diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/MotesSession.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/MotesSession.kt index b62b61bb2956..be89172ec798 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/MotesSession.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/MotesSession.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.rift.everywhere.motes import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.model.TabWidget import at.hannibal2.skyhanni.events.IslandChangeEvent @@ -15,7 +16,6 @@ import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.TimeUtils.format import at.hannibal2.skyhanni.utils.inPartialHours import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule object MotesSession { @@ -36,7 +36,7 @@ object MotesSession { "\\s+Lifetime Motes: §r§d(?[\\d,.]+)", ) - @SubscribeEvent + @HandleEvent fun onWidgetUpdate(event: WidgetUpdateEvent) { if (!event.isWidget(TabWidget.RIFT_INFO)) return lifetimeMotesPattern.firstMatcher(event.widget.lines) { @@ -50,7 +50,7 @@ object MotesSession { } } - @SubscribeEvent + @HandleEvent fun onIslandChange(event: IslandChangeEvent) { if (event.oldIsland == IslandType.THE_RIFT) { sendMotesInfo() 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 d73f92fce180..9cffee3156f6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt @@ -135,7 +135,7 @@ object SkillProgress { config.barPosition.renderRenderables(listOf(progress), posLabel = "Skill Progress Bar") } - @SubscribeEvent + @HandleEvent fun onProfileJoin(event: ProfileJoinEvent) { display = emptyList() allDisplay = emptyList() @@ -157,7 +157,7 @@ object SkillProgress { } } - @SubscribeEvent + @HandleEvent fun onLevelUp(event: SkillOverflowLevelUpEvent) { if (!isEnabled()) return if (!config.overflowConfig.enableInChat) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerBossSpawnSoon.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerBossSpawnSoon.kt index 2d949c6e4787..a75126fe4aa1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerBossSpawnSoon.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerBossSpawnSoon.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.slayer import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.SlayerAPI import at.hannibal2.skyhanni.events.SlayerProgressChangeEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule @@ -10,7 +11,6 @@ import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.SoundUtils import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds @SkyHanniModule @@ -26,7 +26,7 @@ object SlayerBossSpawnSoon { private var lastCompletion = 0.0 private var warned = false - @SubscribeEvent + @HandleEvent fun onSlayerProgressChange(event: SlayerProgressChangeEvent) { if (!isEnabled()) return if (!SlayerAPI.isInCorrectArea) return 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 d069cf7e33bc..5e3eae25fbd9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt @@ -103,7 +103,7 @@ object SlayerProfitTracker { allowedItems = event.getConstant("SlayerProfitTrackerItems").slayers } - @SubscribeEvent + @HandleEvent fun onPurseChange(event: PurseChangeEvent) { if (!isEnabled()) return val coins = event.coins @@ -123,7 +123,7 @@ object SlayerProfitTracker { } } - @SubscribeEvent + @HandleEvent fun onSlayerChange(event: SlayerChangeEvent) { val newSlayer = event.newSlayer itemLogCategory = newSlayer.removeColor() diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt index bd46e416b952..daf9a9259610 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt @@ -21,7 +21,6 @@ import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.getLorenzVec import net.minecraft.entity.EntityLivingBase -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds @@ -42,7 +41,7 @@ object SlayerQuestWarning { var lastSlayerType: SlayerType? = null } - @SubscribeEvent + @HandleEvent fun onScoreboardChange(event: ScoreboardUpdateEvent) { val slayerType = event.full.nextAfter("Slayer Quest") val slayerProgress = event.full.nextAfter("Slayer Quest", skip = 2) ?: "no slayer" diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt index cd6e7b2dbf5b..5427013c9506 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.slayer import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.storage.ProfileSpecificStorage import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.data.SlayerAPI @@ -80,7 +81,7 @@ object SlayerRngMeterDisplay { } } - @SubscribeEvent + @HandleEvent fun onSlayerChange(event: SlayerChangeEvent) { update() } @@ -195,7 +196,7 @@ object SlayerRngMeterDisplay { update() } - @SubscribeEvent + @HandleEvent fun onNeuRepoReload(event: NeuRepositoryReloadEvent) { rngScore = event.readConstant("rngscore").slayer } 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 6957e02b2a03..b32cc19ec1e8 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 @@ -179,11 +179,10 @@ object BlazeSlayerDaggerHelper { return null } - @SubscribeEvent + @HandleEvent fun onTitleReceived(event: TitleReceivedEvent) { if (!isEnabled()) return - for (shield in HellionShield.entries) { if (shield.formattedName + "§r" == event.title) { for (dagger in Dagger.entries.filter { shield in it.shields }) { @@ -218,12 +217,12 @@ object BlazeSlayerDaggerHelper { TWILIGHT( listOf("Twilight Dagger", "Mawdredge Dagger", "Deathripper Dagger"), HellionShield.SPIRIT, - HellionShield.CRYSTAL + HellionShield.CRYSTAL, ), FIREDUST( listOf("Firedust Dagger", "Kindlebane Dagger", "Pyrochaos Dagger"), HellionShield.ASHEN, - HellionShield.AURIC + HellionShield.AURIC, ), ; 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 7cae7db35eda..f5bf6d707522 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 @@ -212,7 +212,7 @@ object EndermanSlayerFeatures { } } - @SubscribeEvent + @HandleEvent fun onBlockChange(event: ServerBlockChangeEvent) { if (!IslandType.THE_END.isInIsland()) return if (!showBeacon()) return diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiPlayerTabOverlayHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiPlayerTabOverlayHook.kt index 3496441fe089..d9dc6aacb027 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiPlayerTabOverlayHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiPlayerTabOverlayHook.kt @@ -22,7 +22,7 @@ fun getPlayerName(original: String, cir: CallbackInfoReturnable) { if (tabListGuard) return val event = TabListLineRenderEvent(original) - event.postAndCatch() + event.post() val newText = event.text if (original != newText) { cir.returnValue = newText diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiScreenHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiScreenHook.kt index 3c3c7fd70507..e30a98a05b70 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiScreenHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiScreenHook.kt @@ -4,5 +4,5 @@ import at.hannibal2.skyhanni.events.RenderItemTooltipEvent import net.minecraft.item.ItemStack fun renderToolTip(stack: ItemStack) { - RenderItemTooltipEvent(stack).postAndCatch() + RenderItemTooltipEvent(stack).post() } diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderItemHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderItemHook.kt index fc324f9bcbd5..9ce3b2896403 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderItemHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderItemHook.kt @@ -25,5 +25,5 @@ fun renderItemOverlayPost( fun renderItemReturn(stack: ItemStack, x: Int, y: Int) { if (!SkyHanniDebugsAndTests.globalRender) return - RenderGuiItemOverlayEvent(stack, x, y).postAndCatch() + RenderGuiItemOverlayEvent(stack, x, y).post() } 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 6caac98ad067..9940f01c1469 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinNEUOverlay.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinNEUOverlay.java @@ -1,6 +1,6 @@ package at.hannibal2.skyhanni.mixins.transformers; -import at.hannibal2.skyhanni.api.enoughupdates.NEURenderEvent; +import at.hannibal2.skyhanni.events.NEURenderEvent; import io.github.moulberry.notenoughupdates.NEUOverlay; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Pseudo; diff --git a/src/main/java/at/hannibal2/skyhanni/test/TestShowSlotNumber.kt b/src/main/java/at/hannibal2/skyhanni/test/TestShowSlotNumber.kt index 8c8acb12b10a..c6783c0a1ad2 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/TestShowSlotNumber.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/TestShowSlotNumber.kt @@ -1,15 +1,15 @@ package at.hannibal2.skyhanni.test import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.RenderInventoryItemTipEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule object TestShowSlotNumber { - @SubscribeEvent + @HandleEvent fun onRenderItemTip(event: RenderInventoryItemTipEvent) { if (SkyHanniMod.feature.dev.showSlotNumberKey.isKeyHeld()) { val slotIndex = event.slot.slotIndex diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/TrackSoundsCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/TrackSoundsCommand.kt index c038d8098699..bf90915b3cec 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/TrackSoundsCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/TrackSoundsCommand.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.test.command import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzTickEvent @@ -92,7 +93,7 @@ object TrackSoundsCommand { isRecording = false } - @SubscribeEvent + @HandleEvent fun onPlaySound(event: PlaySoundEvent) { if (cutOffTime.isInPast()) return if (event.soundName == "game.player.hurt" && event.pitch == 0f && event.volume == 0f) return // remove random useless sound diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ComputerTimeOffset.kt b/src/main/java/at/hannibal2/skyhanni/utils/ComputerTimeOffset.kt index 2770fc5fc0f4..7e61c03c3751 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ComputerTimeOffset.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ComputerTimeOffset.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.utils import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.DebugDataCollectEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule @@ -87,7 +88,7 @@ object ComputerTimeOffset { } } - @SubscribeEvent + @HandleEvent fun onProfileJoin(event: ProfileJoinEvent) { DelayedRun.runDelayed(5.seconds) { checkOffset() diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EssenceItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/EssenceItemUtils.kt index ab97c2e3d8c5..42c3ddd0d00c 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/EssenceItemUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/EssenceItemUtils.kt @@ -1,18 +1,18 @@ package at.hannibal2.skyhanni.utils +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.jsonobjects.repo.neu.NeuEssenceCostJson import at.hannibal2.skyhanni.events.NeuRepositoryReloadEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.toInternalName -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule object EssenceItemUtils { var itemPrices = mapOf>() - @SubscribeEvent + @HandleEvent fun onNeuRepoReload(event: NeuRepositoryReloadEvent) { val unformattedData = event.getConstant>("essencecosts", NeuEssenceCostJson.TYPE) this.itemPrices = reformatData(unformattedData) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt index a3c8ae1bdd4a..00d79bb535fb 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.utils +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.data.jsonobjects.repo.MultiFilterJson import at.hannibal2.skyhanni.events.NeuRepositoryReloadEvent @@ -65,7 +66,7 @@ object NEUItems { ignoreItemsFilter.load(ignoredItems) } - @SubscribeEvent + @HandleEvent fun onNeuRepoReload(event: NeuRepositoryReloadEvent) { allItemsCache = readAllNeuItems() } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt b/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt index a9f12c78c664..accc7168fcf8 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt @@ -147,7 +147,7 @@ object TabListData { val tabList = readTabList() ?: return if (tablistCache != tabList) { tablistCache = tabList - TabListUpdateEvent(getTabList()).postAndCatch() + TabListUpdateEvent(getTabList()).post() if (!LorenzUtils.onHypixel) { workaroundDelayedTabListUpdateAgain() } @@ -158,7 +158,7 @@ object TabListData { val tabFooter = tabListOverlay.footer_skyhanni?.formattedText.orEmpty() if (tabFooter != footer && tabFooter != "") { - TablistFooterUpdateEvent(tabFooter).postAndCatch() + TablistFooterUpdateEvent(tabFooter).post() } footer = tabFooter } @@ -167,7 +167,7 @@ object TabListData { DelayedRun.runDelayed(2.seconds) { if (LorenzUtils.onHypixel) { println("workaroundDelayedTabListUpdateAgain") - TabListUpdateEvent(getTabList()).postAndCatch() + TabListUpdateEvent(getTabList()).post() } } } diff --git a/versions/1.8.9/detekt/baseline.xml b/versions/1.8.9/detekt/baseline.xml index 7c698661cd00..0584a2711af6 100644 --- a/versions/1.8.9/detekt/baseline.xml +++ b/versions/1.8.9/detekt/baseline.xml @@ -91,9 +91,6 @@ RepoPatternRegexTest:BasketWaypoints.kt$BasketWaypoints$by patternGroup.pattern( "main.scoreboard.basket", "^Baskets Found: §a\\d+§f/§a\\d+\$" ) RepoPatternRegexTest:BasketWaypoints.kt$BasketWaypoints$by patternGroup.pattern( "main.scoreboard.halloween", "^§6Halloween \\d+$" ) RepoPatternRegexTest:BazaarCancelledBuyOrderClipboard.kt$BazaarCancelledBuyOrderClipboard$by patternGroup.pattern( "cancelledmessage", "§6\\[Bazaar] §r§7§r§cCancelled! §r§7Refunded §r§6(?<coins>.*) coins §r§7from cancelling Buy Order!", ) - RepoPatternRegexTest:BazaarOrderHelper.kt$BazaarOrderHelper$by patternGroup.pattern( "filled", "§7Filled: §[a6].*§7/.* §a§l100%!", ) - RepoPatternRegexTest:BazaarOrderHelper.kt$BazaarOrderHelper$by patternGroup.pattern( "itemname", "§.§l(?<type>BUY|SELL) (?<name>.*)", ) - RepoPatternRegexTest:BazaarOrderHelper.kt$BazaarOrderHelper$by patternGroup.pattern( "price", "§7Price per unit: §6(?<number>.*) coins", ) RepoPatternRegexTest:BeaconPower.kt$BeaconPower$by group.pattern( "stat", "§7Current Stat: (?<stat>.+)", ) RepoPatternRegexTest:BeaconPower.kt$BeaconPower$by group.pattern( "time", "§7Power Remaining: §e(?<time>.+)", ) RepoPatternRegexTest:BingoAPI.kt$BingoAPI$by RepoPattern.pattern( "bingo.detection.scoreboard", " §.Ⓑ §.Bingo" )