Skip to content

Commit

Permalink
change some LorenzEvents without parameters to SkyHanniEvents and mak…
Browse files Browse the repository at this point in the history
…e them objects
  • Loading branch information
ItsEmpa committed Oct 16, 2024
1 parent 0dc5c9a commit dce7dd8
Show file tree
Hide file tree
Showing 21 changed files with 41 additions and 24 deletions.
4 changes: 2 additions & 2 deletions src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ object CollectionAPI {
val internalName = incorrectCollectionNames[name] ?: NEUInternalName.fromItemName(name)
collectionValue[internalName] = counter
}
CollectionUpdateEvent().postAndCatch()
CollectionUpdateEvent.post()
}

if (inventoryName.endsWith(" Collections")) {
Expand All @@ -83,7 +83,7 @@ object CollectionAPI {
collectionValue[internalName] = counter
}
}
CollectionUpdateEvent().postAndCatch()
CollectionUpdateEvent.post()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ object EntityMovementData {
if (!LorenzUtils.inSkyBlock) return
if (!warpingPattern.matches(event.message)) return
DelayedRun.runNextTick {
LorenzWarpEvent().postAndCatch()
LorenzWarpEvent.post()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ object GardenCropMilestones {
crop.setCounter(amount)
}
}
CropMilestoneUpdateEvent().postAndCatch()
CropMilestoneUpdateEvent.post()
GardenCropMilestonesCommunityFix.openInventory(event.inventoryItems)
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ object SackAPI {
ProfileStorageData.sackProfiles?.sackContents = sackData
SkyHanniMod.configManager.saveConfig(ConfigFileType.SACKS, "saving-data")

SackDataUpdateEvent().postAndCatch()
SackDataUpdateEvent.post()
}

data class SackGemstone(
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ object SlayerAPI {
}

if (event.message == " §r§a§lSLAYER QUEST COMPLETE!") {
SlayerQuestCompleteEvent().postAndCatch()
SlayerQuestCompleteEvent.post()
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package at.hannibal2.skyhanni.events

class CollectionUpdateEvent : LorenzEvent()
import at.hannibal2.skyhanni.api.event.SkyHanniEvent

object CollectionUpdateEvent : SkyHanniEvent()
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package at.hannibal2.skyhanni.events

class CropMilestoneUpdateEvent : LorenzEvent()
import at.hannibal2.skyhanni.api.event.SkyHanniEvent

object CropMilestoneUpdateEvent : SkyHanniEvent()
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package at.hannibal2.skyhanni.events

class DungeonBossRoomEnterEvent : LorenzEvent()
import at.hannibal2.skyhanni.api.event.SkyHanniEvent

object DungeonBossRoomEnterEvent : SkyHanniEvent()
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package at.hannibal2.skyhanni.events

class LorenzWarpEvent : LorenzEvent()
import at.hannibal2.skyhanni.api.event.SkyHanniEvent

object LorenzWarpEvent : SkyHanniEvent()
5 changes: 2 additions & 3 deletions src/main/java/at/hannibal2/skyhanni/events/NEURenderEvent.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package at.hannibal2.skyhanni.events

import net.minecraftforge.fml.common.eventhandler.Cancelable
import at.hannibal2.skyhanni.api.event.SkyHanniEvent

@Cancelable
class NEURenderEvent : LorenzEvent()
class NEURenderEvent : SkyHanniEvent(), SkyHanniEvent.Cancellable
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package at.hannibal2.skyhanni.events

class SackDataUpdateEvent : LorenzEvent()
import at.hannibal2.skyhanni.api.event.SkyHanniEvent

object SackDataUpdateEvent : SkyHanniEvent()
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package at.hannibal2.skyhanni.events

class SlayerQuestCompleteEvent : LorenzEvent()
import at.hannibal2.skyhanni.api.event.SkyHanniEvent

object SlayerQuestCompleteEvent : SkyHanniEvent()
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ object DungeonAPI {
val message = rawMessage.removeColor()
val bossName = message.substringAfter("[BOSS] ").substringBefore(":").trim()
if ((bossName != "The Watcher") && dungeonFloor != null && checkBossName(bossName) && !inBossRoom) {
DungeonBossRoomEnterEvent().postAndCatch()
DungeonBossRoomEnterEvent.post()
inBossRoom = true
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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.CheckRenderEntityEvent
import at.hannibal2.skyhanni.events.DungeonBossRoomEnterEvent
Expand Down Expand Up @@ -133,7 +134,7 @@ object DungeonCopilot {
searchForKey = true
}

@SubscribeEvent
@HandleEvent
fun onDungeonBossRoomEnter(event: DungeonBossRoomEnterEvent) {
changeNextStep("Defeat the boss! Good luck :)")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package at.hannibal2.skyhanni.features.garden.farming

import at.hannibal2.skyhanni.api.event.HandleEvent
import at.hannibal2.skyhanni.data.GardenCropMilestones.getCounter
import at.hannibal2.skyhanni.events.CropClickEvent
import at.hannibal2.skyhanni.events.CropMilestoneUpdateEvent
Expand Down Expand Up @@ -76,7 +77,7 @@ object CropSpeedMeter {
return list
}

@SubscribeEvent
@HandleEvent
fun onCropMilestoneUpdate(event: CropMilestoneUpdateEvent) {
if (!isEnabled()) return
val counters = mutableMapOf<CropType, Long>()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package at.hannibal2.skyhanni.features.garden.farming

import at.hannibal2.skyhanni.api.event.HandleEvent
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.config.features.garden.cropmilestones.CropMilestonesConfig.MilestoneTextEntry
import at.hannibal2.skyhanni.config.features.garden.cropmilestones.CropMilestonesConfig.TimeFormatEntry
Expand Down Expand Up @@ -99,7 +100,7 @@ object GardenCropMilestoneDisplay {
}
}

@SubscribeEvent
@HandleEvent
fun onCropMilestoneUpdate(event: CropMilestoneUpdateEvent) {
needsInventory = false
GardenBestCropTime.updateTimeTillNextCrop()
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -24,7 +25,7 @@ object GardenCropMilestoneInventory {
private var average = -1.0
private val config get() = GardenAPI.config

@SubscribeEvent
@HandleEvent
fun onCropMilestoneUpdate(event: CropMilestoneUpdateEvent) {
if (!config.number.averageCropMilestone) return

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package at.hannibal2.skyhanni.features.garden.visitor

import at.hannibal2.skyhanni.api.event.HandleEvent
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.config.features.garden.visitor.VisitorConfig.HighlightMode
import at.hannibal2.skyhanni.data.IslandType
Expand Down Expand Up @@ -336,7 +337,7 @@ object GardenVisitorFeatures {
}
}

@SubscribeEvent
@HandleEvent
fun onSackUpdate(event: SackDataUpdateEvent) {
update()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ object TunnelsMaps {
}
}

@SubscribeEvent
@HandleEvent
fun onLorenzWarp(event: LorenzWarpEvent) {
if (!isEnabled()) return
if (goal != null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.config.storage.ProfileSpecificStorage
import at.hannibal2.skyhanni.data.ItemAddManager
Expand Down Expand Up @@ -143,7 +144,7 @@ object SlayerProfitTracker {
}
}

@SubscribeEvent
@HandleEvent
fun onQuestComplete(event: SlayerQuestCompleteEvent) {
getTracker()?.modify {
it.slayerCompletedCount++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class MixinNEUOverlay {

@Inject(method = "render", at = @At("HEAD"), cancellable = true, remap = false)
private void render(boolean hoverInv, CallbackInfo ci) {
if (new NEURenderEvent().postAndCatch()) {
if (new NEURenderEvent().post()) {
ci.cancel();
}
}
Expand Down

0 comments on commit dce7dd8

Please sign in to comment.