diff options
| author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-17 09:21:11 +0200 |
|---|---|---|
| committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-17 09:21:11 +0200 |
| commit | 86031f42f3f904e295c8e4a402777d747cf0dfe8 (patch) | |
| tree | e46e1ad784317e69fd45e826ed94f21c8f8d20c4 /src/main/java/at/hannibal2/skyhanni/features | |
| parent | dcc0a269be6ab53099574d79dda92f1516dfa539 (diff) | |
| download | skyhanni-86031f42f3f904e295c8e4a402777d747cf0dfe8.tar.gz skyhanni-86031f42f3f904e295c8e4a402777d747cf0dfe8.tar.bz2 skyhanni-86031f42f3f904e295c8e4a402777d747cf0dfe8.zip | |
migrate diana and bingo config into events
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
12 files changed, 40 insertions, 27 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt index c2610d930..fcbc46e45 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.bingo import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent @@ -33,7 +34,7 @@ class BingoCardDisplay { private const val MAX_PERSONAL_GOALS = 20 private const val MAX_COMMUNITY_GOALS = 5 - private val config get() = SkyHanniMod.feature.bingo.bingoCard + private val config get() = SkyHanniMod.feature.event.bingo.bingoCard private var displayMode = 0 val personalGoals = mutableListOf<PersonalGoal>() private val communityGoals = mutableListOf<CommunityGoal>() @@ -182,4 +183,9 @@ class BingoCardDisplay { fun onConfigLoad(event: ConfigLoadEvent) { config.hideCommunityGoals.onToggle { update() } } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(2, "bingo", "event.bingo") + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardTips.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardTips.kt index 769872409..a112616a3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardTips.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardTips.kt @@ -66,7 +66,7 @@ class BingoCardTips { } } - fun isEnabled() = LorenzUtils.inSkyBlock && SkyHanniMod.feature.bingo.bingoCard.bingoSplashGuide + fun isEnabled() = LorenzUtils.inSkyBlock && SkyHanniMod.feature.event.bingo.bingoCard.bingoSplashGuide enum class Difficulty(rawName: String, val color: LorenzColor) { EASY("Easy", LorenzColor.GREEN), diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt index 53a240128..357763e2c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt @@ -17,7 +17,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class BingoNextStepHelper { - private val config get() = SkyHanniMod.feature.bingo.bingoCard + private val config get() = SkyHanniMod.feature.event.bingo.bingoCard private var dirty = true private val crystalObtainedPattern = " *§r§e(?<crystalName>Topaz|Sapphire|Jade|Amethyst|Amber) Crystal".toPattern() diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/CompactBingoChat.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/CompactBingoChat.kt index be4838ee9..7beff8920 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/CompactBingoChat.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/CompactBingoChat.kt @@ -8,7 +8,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class CompactBingoChat { - private val config get() = SkyHanniMod.feature.bingo.compactChat + private val config get() = SkyHanniMod.feature.event.bingo.compactChat private var inSkillLevelUp = false private var inSkyBlockLevelUp = false diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt index 4ebdc1ffa..bb324a984 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt @@ -19,6 +19,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class MinionCraftHelper { + private val config get() = SkyHanniMod.feature.event.bingo private var minionNamePattern = "(?<name>.*) Minion (?<number>.*)".toPattern() private var display = emptyList<String>() private var hasMinionInInventory = false @@ -36,7 +37,7 @@ class MinionCraftHelper { @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!LorenzUtils.isBingoProfile) return - if (!SkyHanniMod.feature.bingo.minionCraftHelperEnabled) return + if (!config.minionCraftHelperEnabled) return if (event.isMod(10)) { val mainInventory = Minecraft.getMinecraft()?.thePlayer?.inventory?.mainInventory ?: return @@ -241,9 +242,9 @@ class MinionCraftHelper { @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { if (!LorenzUtils.isBingoProfile) return - if (!SkyHanniMod.feature.bingo.minionCraftHelperEnabled) return + if (!config.minionCraftHelperEnabled) return - SkyHanniMod.feature.bingo.minionCraftHelperPos.renderStrings(display, posLabel = "Minion Craft Helper") + config.minionCraftHelperPos.renderStrings(display, posLabel = "Minion Craft Helper") } private fun notify(minionName: String) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/anniversary/ActivePlayerTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/event/anniversary/Year300RaffleEvent.kt index a83def532..948d04269 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/anniversary/ActivePlayerTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/anniversary/Year300RaffleEvent.kt @@ -20,7 +20,8 @@ import java.time.Instant import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.seconds -object ActivePlayerTimer { +object Year300RaffleEvent { + private val config get() = SkyHanniMod.feature.event.century val displayItem by lazy { NEUItems.getItemStackOrNull("EPOCH_CAKE_ORANGE") ?: ItemStack(Items.clock) } private var lastTimerReceived = TimeMark.never() @@ -35,16 +36,14 @@ object ActivePlayerTimer { } } - fun isEnabled(): Boolean { - return SkyHanniMod.feature.misc.century.enableActiveTimer && - Instant.now().isBefore(SkyBlockTime(301).toInstant()) && - LorenzUtils.inSkyBlock - } + fun isEnabled() = config.enableActiveTimer && + Instant.now().isBefore(SkyBlockTime(301).toInstant()) && + LorenzUtils.inSkyBlock @SubscribeEvent fun onRender(event: GuiRenderEvent.GameOverlayRenderEvent) { - SkyHanniMod.feature.misc.century.activeTimerPosition.renderSingleLineWithItems( + config.activeTimerPosition.renderSingleLineWithItems( overlay ?: return, posLabel = "300þ Anniversary Active Timer" ) @@ -62,7 +61,7 @@ object ActivePlayerTimer { } else { 20.minutes - p } - if (p.isFinite() && timeLeft < 1.seconds && lastTimeAlerted.passedTime() > 5.minutes && SkyHanniMod.feature.misc.century.enableActiveAlert) { + if (p.isFinite() && timeLeft < 1.seconds && lastTimeAlerted.passedTime() > 5.minutes && config.enableActiveAlert) { SoundUtils.centuryActiveTimerAlert.playSound() lastTimeAlerted = TimeMark.now() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt index fe9efd09a..f96c6d260 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt @@ -12,7 +12,6 @@ import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent import org.lwjgl.input.Keyboard class BurrowWarpHelper { - private val config get() = SkyHanniMod.feature.diana private var lastWarpTime = 0L private var lastWarp: WarpPoint? = null @@ -58,6 +57,7 @@ class BurrowWarpHelper { } companion object { + private val config get() = SkyHanniMod.feature.event.diana var currentWarp: WarpPoint? = null fun shouldUseWarps(target: LorenzVec) { @@ -93,10 +93,10 @@ class BurrowWarpHelper { ) { HUB("Hub", LorenzVec(-3, 70, -70), 2), CASTLE("Castle", LorenzVec(-250, 130, 45), 10), - CRYPT("Crypt", LorenzVec(-190, 74, -88), 15, { SkyHanniMod.feature.diana.ignoredWarps.crypt }), + CRYPT("Crypt", LorenzVec(-190, 74, -88), 15, { config.ignoredWarps.crypt }), DA("Dark Auction", LorenzVec(91, 74, 173), 2), MUSEUM("Museum", LorenzVec(-75, 76, 81), 2), - WIZARD("Wizard", LorenzVec(42.5, 122.0, 69.0), 5, { SkyHanniMod.feature.diana.ignoredWarps.wizard }), + WIZARD("Wizard", LorenzVec(42.5, 122.0, 69.0), 5, { config.ignoredWarps.wizard }), ; fun distance(other: LorenzVec): Double = other.distance(location) + extraBlocks diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt index d3c6038f2..1a6750d85 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.event.diana import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.EntityMovementData import at.hannibal2.skyhanni.events.* import at.hannibal2.skyhanni.utils.* @@ -18,7 +19,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds object GriffinBurrowHelper { - private val config get() = SkyHanniMod.feature.diana + private val config get() = SkyHanniMod.feature.event.diana private var guessLocation: LorenzVec? = null private var targetLocation: LorenzVec? = null @@ -137,7 +138,7 @@ object GriffinBurrowHelper { sendTip(event) val playerLocation = LocationUtils.playerLocation() - if (SkyHanniMod.feature.diana.inquisitorSharing.enabled) { + if (config.inquisitorSharing.enabled) { for (inquis in InquisitorWaypointShare.waypoints.values) { val playerName = inquis.fromPlayer val location = inquis.location @@ -163,7 +164,7 @@ object GriffinBurrowHelper { } if (InquisitorWaypointShare.waypoints.isNotEmpty()) { - if (SkyHanniMod.feature.diana.inquisitorSharing.focusInquisitor) { + if (config.inquisitorSharing.focusInquisitor) { return } } @@ -192,6 +193,11 @@ object GriffinBurrowHelper { } } + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(2, "diana", "event.diana") + } + private fun sendTip(event: RenderWorldLastEvent) { teleportedLocation?.let { teleportedLocation = null diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt index 31571b30b..b16df2c70 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt @@ -15,6 +15,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class GriffinBurrowParticleFinder { + private val config get() = SkyHanniMod.feature.event.diana private val recentlyDugParticleBurrows = mutableListOf<LorenzVec>() private val burrows = mutableMapOf<LorenzVec, Burrow>() @@ -78,7 +79,7 @@ class GriffinBurrowParticleFinder { @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) fun onChatPacket(event: PacketEvent.ReceiveEvent) { if (!LorenzUtils.inSkyBlock) return - if (!SkyHanniMod.feature.diana.burrowsSoopyGuess) return + if (!config.burrowsSoopyGuess) return if (LorenzUtils.skyBlockIsland != IslandType.HUB) return val packet = event.packet @@ -149,7 +150,7 @@ class GriffinBurrowParticleFinder { @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { - if (!SkyHanniMod.feature.diana.burrowsSoopyGuess) return + if (!config.burrowsSoopyGuess) return if (LorenzUtils.skyBlockIsland != IslandType.HUB) return val message = event.message if (message.startsWith("§eYou dug out a Griffin Burrow!") || @@ -171,7 +172,7 @@ class GriffinBurrowParticleFinder { @SubscribeEvent fun onBlockClick(event: BlockClickEvent) { if (!LorenzUtils.inSkyBlock) return - if (!SkyHanniMod.feature.diana.burrowsSoopyGuess) return + if (!config.burrowsSoopyGuess) return if (LorenzUtils.skyBlockIsland != IslandType.HUB) return val pos = event.position 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 5a578590f..679c493ca 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 @@ -17,7 +17,7 @@ class GriffinPetWarning { fun onTick(event: LorenzTickEvent) { if (!event.isMod(20)) return if (!IslandType.HUB.isInIsland()) return - if (!SkyHanniMod.feature.diana.petWarning) return + if (!SkyHanniMod.feature.event.diana.petWarning) return if (!DianaAPI.isRitualActive()) return if (!DianaAPI.hasSpadeInHand()) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt index 7a8ea5d2b..14f4305ab 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt @@ -20,7 +20,7 @@ import org.lwjgl.input.Keyboard import kotlin.time.Duration.Companion.seconds object InquisitorWaypointShare { - private val config get() = SkyHanniMod.feature.diana.inquisitorSharing + private val config get() = SkyHanniMod.feature.event.diana.inquisitorSharing private val partyPattern = "§9Party §8> (?<playerName>.*)§f: §rx: (?<x>-?[0-9]{1,4}), y: (?<y>-?[0-9]{1,4}), z: (?<z>-?[0-9]{1,4})\\b".toPattern() private val diedPattern = "§9Party §8> (?<playerName>.*)§f: §rInquisitor dead!".toPattern() 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 079d6cecf..0ca67ad8e 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 @@ -276,6 +276,6 @@ class SoopyGuessBurrow { } private fun isEnabled(): Boolean { - return LorenzUtils.inSkyBlock && LorenzUtils.skyBlockIsland == IslandType.HUB && SkyHanniMod.feature.diana.burrowsSoopyGuess + return LorenzUtils.inSkyBlock && LorenzUtils.skyBlockIsland == IslandType.HUB && SkyHanniMod.feature.event.diana.burrowsSoopyGuess } }
\ No newline at end of file |
