diff options
| author | Walker Selby <git@walkerselby.com> | 2023-10-15 12:50:14 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-15 13:50:14 +0200 |
| commit | 0bdfaab9e486f0c6adc576e3a939838ef1827c80 (patch) | |
| tree | 9bb2f1bd50b62590220440b94f2cad0fda7f9e9b /src/main/java/at/hannibal2/skyhanni/features | |
| parent | 202759b6752741e32c3b2d3e022ea8d71400188f (diff) | |
| download | skyhanni-0bdfaab9e486f0c6adc576e3a939838ef1827c80.tar.gz skyhanni-0bdfaab9e486f0c6adc576e3a939838ef1827c80.tar.bz2 skyhanni-0bdfaab9e486f0c6adc576e3a939838ef1827c80.zip | |
Internal Change: Config deprecations (#542)
migrate the config, removed id system entirely #542
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
58 files changed, 826 insertions, 298 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt index cbe4d4f56..6772e67cf 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.chat import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.matchRegex @@ -9,7 +10,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.trimWhiteSpaceAndResets import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class ChatFilter { - private val config get() = SkyHanniMod.feature.chat + private val config get() = SkyHanniMod.feature.chat.filterType @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { @@ -348,4 +349,18 @@ class ChatFilter { else -> false } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(3, "chat.hypixelHub", "chat.filterType.hypixelHub") + event.move(3, "chat.empty", "chat.filterType.empty") + event.move(3, "chat.warping", "chat.filterType.warping") + event.move(3, "chat.guildExp", "chat.filterType.guildExp") + event.move(3, "chat.friendJoinLeft", "chat.filterType.friendJoinLeft") + event.move(3, "chat.winterGift", "chat.filterType.winterGift") + event.move(3, "chat.powderMining", "chat.filterType.powderMining") + event.move(3, "chat.killCombo", "chat.filterType.killCombo") + event.move(3, "chat.profileJoin", "chat.filterType.profileJoin") + event.move(3, "chat.others", "chat.filterType.others") + } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt index 099d52067..739eaa123 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.chat import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.ChatManager import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.utils.LorenzUtils @@ -15,7 +16,7 @@ class WatchdogHider { @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { - if (!LorenzUtils.onHypixel || !SkyHanniMod.feature.chat.watchDog) return + if (!LorenzUtils.onHypixel || !SkyHanniMod.feature.chat.filterType.watchDog) return when (event.message) { watchdogStartLine -> { @@ -48,6 +49,11 @@ class WatchdogHider { private const val watchdogAnnouncementLine = "§4[WATCHDOG ANNOUNCEMENT]" private const val watchdogEndLine = "§c" } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(3, "chat.watchDog", "chat.filterType.watchDog") + } } 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 e63c925df..60ed955a3 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.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.features.dungeon.DungeonMilestonesDisplay import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager @@ -10,6 +11,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class PlayerChatModifier { + private val config get() = SkyHanniMod.feature.chat.playerMessage private val patterns = mutableListOf<Regex>() init { @@ -58,7 +60,7 @@ class PlayerChatModifier { private fun cutMessage(input: String): String { var string = input - if (SkyHanniMod.feature.chat.playerRankHider) { + if (config.playerRankHider) { for (pattern in patterns) { string = string.replace(pattern, "§b$1") } @@ -72,7 +74,7 @@ class PlayerChatModifier { } } - if (SkyHanniMod.feature.chat.chatFilter && string.contains("§r§f: ") && PlayerChatFilter.shouldChatFilter(string)) { + if (config.chatFilter && string.contains("§r§f: ") && PlayerChatFilter.shouldChatFilter(string)) { string = string.replace("§r§f: ", "§r§7: ") } @@ -84,4 +86,12 @@ class PlayerChatModifier { return string } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(3, "chat.playerRankHider", "chat.playerMessage.playerRankHider") + event.move(3, "chat.chatFilter", "chat.playerMessage.chatFilter") + } + + } diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt index b8fa406b9..f9f84f9f7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt @@ -455,7 +455,7 @@ class DamageIndicatorManager { entity.setHellionShield(null) } - if (!SkyHanniMod.feature.slayer.blazePhaseDisplay) return "" + if (!SkyHanniMod.feature.slayer.blazes.phaseDisplay) return "" var calcHealth = health val calcMaxHealth: Int @@ -610,7 +610,7 @@ class DamageIndicatorManager { calcHealth.toLong(), calcMaxHealth.toLong() ).getChatColor() + NumberUtil.format(calcHealth) - if (!SkyHanniMod.feature.slayer.endermanPhaseDisplay) { + if (!SkyHanniMod.feature.slayer.endermen.phaseDisplay) { result = "" entityData.namePrefix = "" } @@ -854,6 +854,8 @@ class DamageIndicatorManager { @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "damageIndicator", "combat.damageIndicator") + event.move(3,"slayer.endermanPhaseDisplay", "slayer.endermen.phaseDisplay") + event.move(3, "slayer.blazePhaseDisplay", "slayer.blazes.phaseDisplay") } fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled 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 6d0afd651..31e8c611e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.dungeon import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.DamageIndicatorFinalBossEvent import at.hannibal2.skyhanni.events.EntityHealthUpdateEvent @@ -18,6 +19,8 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class DungeonCleanEnd { + private val config get() = SkyHanniMod.feature.dungeon.cleanEnd + private var bossDone = false private var chestsSpawned = false private var lastBossId: Int = -1 @@ -25,7 +28,7 @@ class DungeonCleanEnd { @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { if (!LorenzUtils.inDungeons) return - if (!SkyHanniMod.feature.dungeon.cleanEndToggle) return + if (!config.toggle) return val message = event.message @@ -36,7 +39,7 @@ class DungeonCleanEnd { private fun shouldBlock(): Boolean { if (!LorenzUtils.inDungeons) return false - if (!SkyHanniMod.feature.dungeon.cleanEndToggle) return false + if (!config.toggle) return false if (!bossDone) return false @@ -63,7 +66,7 @@ class DungeonCleanEnd { @SubscribeEvent fun onEntityHealthUpdate(event: EntityHealthUpdateEvent) { if (!LorenzUtils.inDungeons) return - if (!SkyHanniMod.feature.dungeon.cleanEndToggle) return + if (!config.toggle) return if (bossDone) return if (lastBossId == -1) return if (event.entity.entityId != lastBossId) return @@ -83,7 +86,7 @@ class DungeonCleanEnd { if (entity == Minecraft.getMinecraft().thePlayer) return - if (SkyHanniMod.feature.dungeon.cleanEndF3IgnoreGuardians + if (config.F3IgnoreGuardians && DungeonAPI.isOneOf("F3", "M3") && entity is EntityGuardian && entity.entityId != lastBossId @@ -111,4 +114,11 @@ class DungeonCleanEnd { event.isCanceled = true } } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(3, "dungeon.cleanEndToggle", "dungeon.cleanEnd.toggle") + event.move(3, "dungeon.cleanEndF3IgnoreGuardians", "dungeon.cleanEnd.F3IgnoreGuardians") + } + }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt index 7b423af28..ddfd622a7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.dungeon import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.DungeonBossRoomEnterEvent import at.hannibal2.skyhanni.events.DungeonEnterEvent @@ -64,7 +65,7 @@ class DungeonCopilot { foundKeyOrDoor = true } - if (foundKeyOrDoor && SkyHanniMod.feature.dungeon.messageFilterKeysAndDoors) { + if (foundKeyOrDoor && SkyHanniMod.feature.dungeon.messageFilter.keysAndDoors) { event.blockedReason = "dungeon_keys_and_doors" } @@ -125,13 +126,20 @@ class DungeonCopilot { } private fun isEnabled(): Boolean { - return LorenzUtils.inDungeons && SkyHanniMod.feature.dungeon.copilotEnabled + return LorenzUtils.inDungeons && SkyHanniMod.feature.dungeon.dungeonCopilot.enabled } @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { if (!isEnabled()) return - SkyHanniMod.feature.dungeon.copilotPos.renderString(nextStep, posLabel = "Dungeon Copilot") + SkyHanniMod.feature.dungeon.dungeonCopilot.pos.renderString(nextStep, posLabel = "Dungeon Copilot") + } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3, "dungeon.messageFilterKeysAndDoors", "dungeon.messageFilter.keysAndDoors") + event.move(3,"dungeon.copilotEnabled", "dungeon.dungeonCopilot.enabled") + event.move(3,"dungeon.copilotPos", "dungeon.dungeonCopilot.pos") } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt index 1428a120a..dd086cf2f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.dungeon import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.EntityMovementData import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.EntityMoveEvent @@ -21,6 +22,8 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class DungeonHideItems { + private val config get() = SkyHanniMod.feature.dungeon.objectHider + private val hideParticles = mutableMapOf<EntityArmorStand, Long>() private val movingSkeletonSkulls = mutableMapOf<EntityArmorStand, Long>() @@ -61,18 +64,18 @@ class DungeonHideItems { if (entity is EntityItem) { val stack = entity.entityItem - if (SkyHanniMod.feature.dungeon.hideReviveStone && stack.cleanName() == "Revive Stone") { + if (config.hideReviveStone && stack.cleanName() == "Revive Stone") { event.isCanceled = true } - if (SkyHanniMod.feature.dungeon.hideJournalEntry && stack.cleanName() == "Journal Entry") { + if (config.hideJournalEntry && stack.cleanName() == "Journal Entry") { event.isCanceled = true } } if (entity !is EntityArmorStand) return - if (SkyHanniMod.feature.dungeon.hideSuperboomTNT) { + if (config.hideSuperboomTNT) { if (entity.name.startsWith("§9Superboom TNT")) { event.isCanceled = true } @@ -84,7 +87,7 @@ class DungeonHideItems { } } - if (SkyHanniMod.feature.dungeon.hideBlessing) { + if (config.hideBlessing) { if (entity.name.startsWith("§dBlessing of ")) { event.isCanceled = true } @@ -95,7 +98,7 @@ class DungeonHideItems { } } - if (SkyHanniMod.feature.dungeon.hideReviveStone) { + if (config.hideReviveStone) { if (entity.name == "§6Revive Stone") { event.isCanceled = true } @@ -107,7 +110,7 @@ class DungeonHideItems { } } - if (SkyHanniMod.feature.dungeon.hidePremiumFlesh) { + if (config.hidePremiumFlesh) { if (entity.name == "§9Premium Flesh") { event.isCanceled = true hideParticles[entity] = System.currentTimeMillis() @@ -121,7 +124,7 @@ class DungeonHideItems { if (isSkeletonSkull(entity)) { EntityMovementData.addToTrack(entity) - if (SkyHanniMod.feature.dungeon.hideSkeletonSkull) { + if (config.hideSkeletonSkull) { val lastMove = movingSkeletonSkulls.getOrDefault(entity, 0) if (lastMove + 100 > System.currentTimeMillis()) { return @@ -130,7 +133,7 @@ class DungeonHideItems { } } - if (SkyHanniMod.feature.dungeon.hideHealerOrbs) { + if (config.hideHealerOrbs) { when { entity.name.startsWith("§c§lDAMAGE §e") -> event.isCanceled = true entity.name.startsWith("§c§lABILITY DAMAGE §e") -> event.isCanceled = true @@ -152,7 +155,7 @@ class DungeonHideItems { } } - if (SkyHanniMod.feature.dungeon.hideHealerFairy) { + if (config.hideHealerFairy) { val itemStack = entity.inventory[0] if (itemStack != null && itemStack.getSkullTexture() == healerFairyTexture) { event.isCanceled = true @@ -164,7 +167,7 @@ class DungeonHideItems { @SubscribeEvent fun onReceivePacket(event: ReceiveParticleEvent) { if (!LorenzUtils.inDungeons) return - if (!SkyHanniMod.feature.dungeon.hideSuperboomTNT && !SkyHanniMod.feature.dungeon.hideReviveStone) return + |
