Skip to content

Commit

Permalink
how much more do i need?
Browse files Browse the repository at this point in the history
  • Loading branch information
CalMWolfs committed Dec 9, 2024
1 parent 847dccb commit 983f9a8
Show file tree
Hide file tree
Showing 76 changed files with 150 additions and 119 deletions.
4 changes: 2 additions & 2 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 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
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/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
3 changes: 2 additions & 1 deletion 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
2 changes: 1 addition & 1 deletion 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 Down
4 changes: 2 additions & 2 deletions src/main/java/at/hannibal2/skyhanni/data/MiningAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ object MiningAPI {

fun inColdIsland() = inAnyIsland(IslandType.DWARVEN_MINES, IslandType.MINESHAFT)

@SubscribeEvent
@HandleEvent
fun onScoreboardChange(event: ScoreboardUpdateEvent) {
if (!inCustomMiningIsland()) return

Expand Down Expand Up @@ -300,7 +300,7 @@ object MiningAPI {
}
}

@SubscribeEvent
@HandleEvent
fun onBlockChange(event: ServerBlockChangeEvent) {
if (!inCustomMiningIsland()) return
val oldState = event.oldState
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt
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.InventoryCloseEvent
import at.hannibal2.skyhanni.events.PurseChangeCause
import at.hannibal2.skyhanni.events.PurseChangeEvent
Expand Down Expand Up @@ -44,15 +45,15 @@ object PurseAPI {
inventoryCloseTime = SimpleTimeMark.now()
}

@SubscribeEvent
@HandleEvent
fun onScoreboardChange(event: ScoreboardUpdateEvent) {
coinsPattern.firstMatcher(event.added) {
val newPurse = group("coins").formatDouble()
val diff = newPurse - currentPurse
if (diff == 0.0) return
currentPurse = newPurse

PurseChangeEvent(diff, currentPurse, getCause(diff)).postAndCatch()
PurseChangeEvent(diff, currentPurse, getCause(diff)).post()
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ object ScoreboardData {
val semiFormatted = list.map { cleanSB(it) }
if (semiFormatted != sidebarLines) {
sidebarLines = semiFormatted
RawScoreboardUpdateEvent(semiFormatted).postAndCatch()
RawScoreboardUpdateEvent(semiFormatted).post()
}

sidebarLinesRaw = list
val new = formatLines(list)
if (new != sidebarLinesFormatted) {
val old = sidebarLinesFormatted
sidebarLinesFormatted = new
ScoreboardUpdateEvent(new, old).postAndCatch()
ScoreboardUpdateEvent(new, old).post()
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/at/hannibal2/skyhanni/data/TitleData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/at/hannibal2/skyhanni/data/model/TabWidget.kt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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()) {
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/at/hannibal2/skyhanni/events/MinionOpenEvent.kt
Original file line number Diff line number Diff line change
@@ -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<Int, ItemStack>) : LorenzEvent()
class MinionCloseEvent : LorenzEvent()
class MinionStorageOpenEvent(val position: LorenzVec?, val inventoryItems: Map<Int, ItemStack>) : LorenzEvent()
class MinionOpenEvent(val inventoryName: String, val inventoryItems: Map<Int, ItemStack>) : SkyHanniEvent()
class MinionCloseEvent : SkyHanniEvent()
class MinionStorageOpenEvent(val position: LorenzVec?, val inventoryItems: Map<Int, ItemStack>) : SkyHanniEvent()
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package at.hannibal2.skyhanni.api.enoughupdates
package at.hannibal2.skyhanni.events

import at.hannibal2.skyhanni.api.event.CancellableSkyHanniEvent

Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package at.hannibal2.skyhanni.events

class RawScoreboardUpdateEvent(val rawScoreboard: List<String>) : LorenzEvent()
import at.hannibal2.skyhanni.api.event.SkyHanniEvent

class RawScoreboardUpdateEvent(val rawScoreboard: List<String>) : SkyHanniEvent()

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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()
Original file line number Diff line number Diff line change
@@ -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()
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package at.hannibal2.skyhanni.events

import at.hannibal2.skyhanni.api.event.SkyHanniEvent

class ScoreboardUpdateEvent(
val full: List<String>,
val old: List<String>,
) : LorenzEvent() {
) : SkyHanniEvent() {

val added: List<String> = full - old.toSet()
val removed: List<String> = old - full.toSet()
Expand Down
Original file line number Diff line number Diff line change
@@ -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()
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
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
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() }
Expand Down
Original file line number Diff line number Diff line change
@@ -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()
Original file line number Diff line number Diff line change
@@ -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()
Original file line number Diff line number Diff line change
@@ -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()
Original file line number Diff line number Diff line change
@@ -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()
Original file line number Diff line number Diff line change
@@ -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()
Original file line number Diff line number Diff line change
@@ -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()
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package at.hannibal2.skyhanni.events

class TabListUpdateEvent(val tabList: List<String>) : LorenzEvent()
import at.hannibal2.skyhanni.api.event.SkyHanniEvent

class TabListUpdateEvent(val tabList: List<String>) : SkyHanniEvent()
Original file line number Diff line number Diff line change
@@ -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()
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.CancellableSkyHanniEvent

@Cancelable
class TitleReceivedEvent(val title: String) : LorenzEvent()
class TitleReceivedEvent(val title: String) : CancellableSkyHanniEvent()
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -208,7 +208,7 @@ object GhostTracker {
}
}

@SubscribeEvent
@HandleEvent
fun onPurseChange(event: PurseChangeEvent) {
if (!isEnabled()) return
if (event.reason != PurseChangeCause.GAIN_MOB_KILL) return
Expand Down
Loading

0 comments on commit 983f9a8

Please sign in to comment.