Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/more-112-stuff' into more-112-stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
CalMWolfs committed Dec 10, 2024
2 parents cc1c863 + 75d4cff commit a359913
Show file tree
Hide file tree
Showing 251 changed files with 492 additions and 434 deletions.
2 changes: 1 addition & 1 deletion src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ object CollectionAPI {
"Mushroom" to "RED_MUSHROOM".toInternalName(),
)

@SubscribeEvent
@HandleEvent
fun onProfileJoin(event: ProfileJoinEvent) {
collectionValue.clear()
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/at/hannibal2/skyhanni/api/DataWatcherAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.api

import at.hannibal2.skyhanni.api.event.HandleEvent
import at.hannibal2.skyhanni.events.DataWatcherUpdatedEvent
import at.hannibal2.skyhanni.events.EntityCustomNameUpdateEvent
import at.hannibal2.skyhanni.events.entity.EntityCustomNameUpdateEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import net.minecraft.entity.Entity

Expand Down
7 changes: 4 additions & 3 deletions src/main/java/at/hannibal2/skyhanni/api/GetFromSackAPI.kt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -124,15 +125,15 @@ object GetFromSackAPI {
}
}

@SubscribeEvent
@HandleEvent
fun onMessageToServer(event: MessageSendToServerEvent) {
if (!LorenzUtils.inSkyBlock) return
if (!config.queuedGFS && !config.bazaarGFS) return
if (!event.isCommand(commandsWithSlash)) return
val replacedEvent = GetFromSacksTabComplete.handleUnderlineReplace(event)
queuedHandler(replacedEvent)
bazaarHandler(replacedEvent)
if (replacedEvent.isCanceled) {
if (replacedEvent.isCancelled) {
event.cancel()
return
}
Expand All @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/at/hannibal2/skyhanni/api/ReforgeAPI.kt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 {
Expand Down Expand Up @@ -151,7 +151,7 @@ object ReforgeAPI {
override fun toString(): String = "Reforge $name"
}

@SubscribeEvent
@HandleEvent
fun onNeuRepoReload(event: NeuRepositoryReloadEvent) {
val reforgeStoneData = event.readConstant<Map<String, NeuReforgeJson>>("reforgestones", reforgeGson).values
val reforgeData = event.readConstant<Map<String, NeuReforgeJson>>("reforges", reforgeGson).values
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -139,7 +139,7 @@ object SkillAPI {
}
}

@SubscribeEvent
@HandleEvent
fun onNEURepoReload(event: NeuRepositoryReloadEvent) {
val data = event.readConstant<NeuSkillLevelJson>("leveling")

Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -71,6 +73,6 @@ object NeuEventWrappers {

@SubscribeEvent
fun onNeuRepoReload(event: RepositoryReloadEvent) {
NeuRepositoryReloadEvent().postAndCatch()
NeuRepositoryReloadEvent.post()
}
}
3 changes: 2 additions & 1 deletion src/main/java/at/hannibal2/skyhanni/data/BitsAPI.kt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -187,7 +188,7 @@ object BitsAPI {
"^§aCommunity Shop|§eFame Rank$",
)

@SubscribeEvent
@HandleEvent
fun onScoreboardChange(event: ScoreboardUpdateEvent) {
if (!isEnabled()) return
for (line in event.added) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/at/hannibal2/skyhanni/data/BlockData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ object ChatManager {
trimmedMessage,
trimmedMessage.split(" "),
originatingModContainer
).postAndCatch()
).post()
) {
event.cancel()
messageHistory[IdentityCharacteristics(component)] = result.copy(actionKind = ActionKind.OUTGOING_BLOCKED)
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/at/hannibal2/skyhanni/data/EntityData.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package at.hannibal2.skyhanni.data

import at.hannibal2.skyhanni.api.event.HandleEvent
import at.hannibal2.skyhanni.events.EntityHealthUpdateEvent
import at.hannibal2.skyhanni.events.EntityMaxHealthUpdateEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.events.entity.EntityDisplayNameEvent
import at.hannibal2.skyhanni.events.entity.EntityHealthDisplayEvent
import at.hannibal2.skyhanni.events.entity.EntityHealthUpdateEvent
import at.hannibal2.skyhanni.events.entity.EntityLeaveWorldEvent
import at.hannibal2.skyhanni.events.entity.EntityMaxHealthUpdateEvent
import at.hannibal2.skyhanni.events.minecraft.packet.PacketReceivedEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.EntityUtils
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package at.hannibal2.skyhanni.data

import at.hannibal2.skyhanni.api.event.HandleEvent
import at.hannibal2.skyhanni.events.EntityMoveEvent
import at.hannibal2.skyhanni.events.IslandChangeEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.events.SkyHanniWarpEvent
import at.hannibal2.skyhanni.events.entity.EntityMoveEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.DelayedRun
import at.hannibal2.skyhanni.utils.LorenzUtils
Expand Down Expand Up @@ -54,7 +54,7 @@ object EntityMovementData {
}
}

@SubscribeEvent
@HandleEvent
fun onIslandChange(event: IslandChangeEvent) {
val nextData = nextTeleport ?: return
if (nextData.island != event.newIsland) return
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/at/hannibal2/skyhanni/data/GuiData.kt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/at/hannibal2/skyhanni/data/HotmData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -690,7 +691,7 @@ enum class HotmData(
}
}

@SubscribeEvent
@HandleEvent
fun onScoreboardUpdate(event: ScoreboardUpdateEvent) {
if (!LorenzUtils.inSkyBlock) return

Expand Down Expand Up @@ -726,7 +727,7 @@ enum class HotmData(
}
}

@SubscribeEvent
@HandleEvent
fun onWidgetUpdate(event: WidgetUpdateEvent) {
if (!event.isWidget(TabWidget.POWDER)) return
event.lines.forEach {
Expand Down Expand Up @@ -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) {
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ object HypixelData {
hasScoreboardUpdated = false
}

@SubscribeEvent
@HandleEvent
fun onScoreboardUpdate(event: ScoreboardUpdateEvent) {
hasScoreboardUpdated = true
}
Expand All @@ -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()
}
}

Expand All @@ -387,7 +387,7 @@ object HypixelData {
if (RiftAPI.inRift()) newProfile = newProfile.reversed()
if (profileName == newProfile) return
profileName = newProfile
ProfileJoinEvent(newProfile).postAndCatch()
ProfileJoinEvent(newProfile).post()
}
}

Expand Down Expand Up @@ -444,7 +444,7 @@ object HypixelData {
}
}

@SubscribeEvent
@HandleEvent
fun onTabListUpdate(event: WidgetUpdateEvent) {
when (event.widget) {
TabWidget.AREA -> checkIsland(event)
Expand All @@ -458,7 +458,7 @@ object HypixelData {

UtilsPatterns.tabListProfilePattern.firstMatcher(TabListData.getTabList()) {
profileName = group("profile").lowercase()
ProfileJoinEvent(profileName).postAndCatch()
ProfileJoinEvent(profileName).post()
}
}

Expand Down Expand Up @@ -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'")
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/at/hannibal2/skyhanni/data/IslandGraphs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import at.hannibal2.skyhanni.api.event.HandleEvent
import at.hannibal2.skyhanni.data.model.Graph
import at.hannibal2.skyhanni.data.model.GraphNode
import at.hannibal2.skyhanni.data.repo.RepoUtils
import at.hannibal2.skyhanni.events.EntityMoveEvent
import at.hannibal2.skyhanni.events.IslandChangeEvent
import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.events.entity.EntityMoveEvent
import at.hannibal2.skyhanni.events.skyblock.ScoreboardAreaChangeEvent
import at.hannibal2.skyhanni.features.misc.IslandAreas
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package at.hannibal2.skyhanni.data

import at.hannibal2.skyhanni.api.event.HandleEvent
import at.hannibal2.skyhanni.events.BlockClickEvent
import at.hannibal2.skyhanni.events.EntityClickEvent
import at.hannibal2.skyhanni.events.ItemClickEvent
import at.hannibal2.skyhanni.events.entity.EntityClickEvent
import at.hannibal2.skyhanni.events.minecraft.packet.PacketSentEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.InventoryUtils
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
Loading

0 comments on commit a359913

Please sign in to comment.