From 37a06d12289f76ee01903454bf47d4a2b9538934 Mon Sep 17 00:00:00 2001 From: Empa <42304516+ItsEmpa@users.noreply.github.com> Date: Sat, 12 Oct 2024 21:27:39 +0200 Subject: [PATCH 1/7] Backend fix: Module Inspection (#2728) Co-authored-by: Empa --- .live-plugins/module/plugin.kts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.live-plugins/module/plugin.kts b/.live-plugins/module/plugin.kts index c0a65d3f431b..f7471e9fd98c 100644 --- a/.live-plugins/module/plugin.kts +++ b/.live-plugins/module/plugin.kts @@ -18,6 +18,7 @@ val forgeEvent = "SubscribeEvent" val handleEvent = "HandleEvent" val skyHanniModule = "SkyHanniModule" +val skyhanniPath = "at.hannibal2.skyhanni" val patternGroup = "at.hannibal2.skyhanni.utils.repopatterns.RepoPatternGroup" val pattern = "java.util.regex.Pattern" @@ -36,12 +37,17 @@ fun isRepoPattern(property: KtProperty): Boolean { return false } +fun isFromSkyhanni(declaration: KtNamedDeclaration): Boolean { + return declaration.fqName?.asString()?.startsWith(skyhanniPath) ?: false +} + class ModuleInspectionKotlin : AbstractKotlinInspection() { override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor { val visitor = object : KtVisitorVoid() { override fun visitClass(klass: KtClass) { + if (!isFromSkyhanni(klass)) return val hasAnnotation = klass.annotationEntries.any { it.shortName?.asString() == skyHanniModule } if (hasAnnotation) { @@ -54,6 +60,7 @@ class ModuleInspectionKotlin : AbstractKotlinInspection() { } override fun visitObjectDeclaration(declaration: KtObjectDeclaration) { + if (!isFromSkyhanni(declaration)) return val hasAnnotation = declaration.annotationEntries.any { it.shortName?.asString() == skyHanniModule } if (hasAnnotation) return From 486231d369a8e2e8cf54f079d6105dac99dec6aa Mon Sep 17 00:00:00 2001 From: Empa <42304516+ItsEmpa@users.noreply.github.com> Date: Sun, 13 Oct 2024 12:08:11 +0200 Subject: [PATCH 2/7] Improvement + Fix: Ashfang Features with Mob Detection (#2112) Co-authored-by: Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Co-authored-by: ItsEmpa --- .../at/hannibal2/skyhanni/data/EntityData.kt | 56 ++++---- .../at/hannibal2/skyhanni/data/mob/Mob.kt | 4 +- .../at/hannibal2/skyhanni/data/mob/MobData.kt | 5 - .../skyhanni/data/mob/MobDetection.kt | 16 ++- .../at/hannibal2/skyhanni/events/MobEvent.kt | 2 - .../events/entity/EntityLeaveWorldEvent.kt | 6 + .../features/nether/ashfang/AshfangBlazes.kt | 124 ------------------ .../nether/ashfang/AshfangBlazingSouls.kt | 71 ---------- .../nether/ashfang/AshfangFreezeCooldown.kt | 45 ++----- .../nether/ashfang/AshfangGravityOrbs.kt | 75 ----------- .../ashfang/AshfangHideDamageIndicator.kt | 34 ----- .../nether/ashfang/AshfangHideParticles.kt | 60 --------- .../features/nether/ashfang/AshfangHider.kt | 46 +++++++ .../nether/ashfang/AshfangHighlights.kt | 106 +++++++++++++++ .../features/nether/ashfang/AshfangManager.kt | 93 +++++++++++++ .../ashfang/AshfangNextResetCooldown.kt | 53 ++------ .../mixins/transformers/MixinWorld.java | 25 ++++ .../at/hannibal2/skyhanni/utils/ColorUtils.kt | 7 +- .../skyhanni/utils/ExtendedChatColor.kt | 2 +- .../hannibal2/skyhanni/utils/RenderUtils.kt | 9 ++ 20 files changed, 355 insertions(+), 484 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/events/entity/EntityLeaveWorldEvent.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazingSouls.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideDamageIndicator.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHider.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHighlights.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangManager.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinWorld.java diff --git a/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt b/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt index d2f81a6d8191..04147ce7794c 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt @@ -5,9 +5,9 @@ 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.SecondPassedEvent import at.hannibal2.skyhanni.events.entity.EntityDisplayNameEvent import at.hannibal2.skyhanni.events.entity.EntityHealthDisplayEvent +import at.hannibal2.skyhanni.events.entity.EntityLeaveWorldEvent import at.hannibal2.skyhanni.events.minecraft.packet.PacketReceivedEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.EntityUtils @@ -31,27 +31,35 @@ import kotlin.time.Duration.Companion.milliseconds @SkyHanniModule object EntityData { - private val maxHealthMap = mutableMapOf() + private val maxHealthMap = mutableMapOf() private val nametagCache = TimeLimitedCache(50.milliseconds) private val healthDisplayCache = TimeLimitedCache(50.milliseconds) + private val ignoredEntities = setOf( + EntityArmorStand::class.java, + EntityXPOrb::class.java, + EntityItem::class.java, + EntityItemFrame::class.java, + EntityOtherPlayerMP::class.java, + EntityPlayerSP::class.java, + ) + @SubscribeEvent fun onTick(event: LorenzTickEvent) { - for (entity in EntityUtils.getEntities()) { + for (entity in EntityUtils.getEntities()) { // this completely ignores the ignored entities list? val maxHealth = entity.baseMaxHealth - val oldMaxHealth = maxHealthMap.getOrDefault(entity, -1) + val id = entity.entityId + val oldMaxHealth = maxHealthMap.getOrDefault(id, -1) if (oldMaxHealth != maxHealth) { - maxHealthMap[entity] = maxHealth + maxHealthMap[id] = maxHealth EntityMaxHealthUpdateEvent(entity, maxHealth.derpy()).postAndCatch() } } } - @SubscribeEvent - fun onSecondPassed(event: SecondPassedEvent) { - if (event.repeatSeconds(30)) { - maxHealthMap.keys.removeIf { it.isDead } - } + @HandleEvent + fun onEntityLeaveWorld(event: EntityLeaveWorldEvent) { + maxHealthMap -= event.entity.entityId } @SubscribeEvent @@ -69,26 +77,11 @@ object EntityData { val entityId = packet.entityId val entity = EntityUtils.getEntityByID(entityId) ?: return - if (entity is EntityArmorStand) return - if (entity is EntityXPOrb) return - if (entity is EntityItem) return - if (entity is EntityItemFrame) return - - if (entity is EntityOtherPlayerMP) return - if (entity is EntityPlayerSP) return - - for (watchableObject in watchableObjects) { - - val dataValueId = watchableObject.dataValueId - val any = watchableObject.`object` - if (dataValueId != 6) continue - - val health = (any as Float).toInt() - - if (entity is EntityWither && health == 300 && entityId < 0) { - return - } + if (entity.javaClass in ignoredEntities) return + watchableObjects.find { it.dataValueId == 6 }?.let { + val health = (it.`object` as Float).toInt() + if (entity is EntityWither && health == 300 && entityId < 0) return if (entity is EntityLivingBase) { EntityHealthUpdateEvent(entity, health.derpy()).postAndCatch() } @@ -100,6 +93,11 @@ object EntityData { return postRenderNametag(entity, oldValue) } + @JvmStatic + fun despawnEntity(entity: Entity) { + EntityLeaveWorldEvent(entity).post() + } + private fun postRenderNametag(entity: Entity, chatComponent: ChatComponentText) = nametagCache.getOrPut(entity) { val event = EntityDisplayNameEvent(entity, chatComponent) event.postAndCatch() diff --git a/src/main/java/at/hannibal2/skyhanni/data/mob/Mob.kt b/src/main/java/at/hannibal2/skyhanni/data/mob/Mob.kt index e9eb6729de43..062acc4b3d6d 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/mob/Mob.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/mob/Mob.kt @@ -8,6 +8,7 @@ import at.hannibal2.skyhanni.utils.CollectionUtils.toSingletonListOrEmpty import at.hannibal2.skyhanni.utils.ColorUtils.addAlpha import at.hannibal2.skyhanni.utils.EntityUtils.canBeSeen import at.hannibal2.skyhanni.utils.EntityUtils.cleanName +import at.hannibal2.skyhanni.utils.EntityUtils.getArmorInventory import at.hannibal2.skyhanni.utils.EntityUtils.isCorrupted import at.hannibal2.skyhanni.utils.EntityUtils.isRunic import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer @@ -17,6 +18,7 @@ import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.item.EntityArmorStand import net.minecraft.entity.monster.EntityZombie +import net.minecraft.entity.player.EntityPlayer import net.minecraft.util.AxisAlignedBB import java.awt.Color import java.util.UUID @@ -111,7 +113,7 @@ class Mob( fun canBeSeen() = baseEntity.canBeSeen() - fun isInvisible() = if (baseEntity !is EntityZombie) baseEntity.isInvisible else false + fun isInvisible() = baseEntity !is EntityZombie && baseEntity.isInvisible && baseEntity.inventory.isNullOrEmpty() private var highlightColor: Color? = null diff --git a/src/main/java/at/hannibal2/skyhanni/data/mob/MobData.kt b/src/main/java/at/hannibal2/skyhanni/data/mob/MobData.kt index f955384c5f4e..2363945d21df 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/mob/MobData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/mob/MobData.kt @@ -103,11 +103,6 @@ object MobData { notSeenMobs.remove(event.mob) } - @SubscribeEvent - fun onMobFirstSeen(event: MobEvent.FirstSeen) { - notSeenMobs.remove(event.mob) - } - @SubscribeEvent fun onSkyblockMobSpawnEvent(event: MobEvent.Spawn.SkyblockMob) { skyblockMobs.add(event.mob) diff --git a/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt b/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt index 014e0a846613..b075ab312070 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt @@ -159,13 +159,15 @@ object MobDetection { private fun canBeSeen(mob: Mob): Boolean { val isVisible = !mob.isInvisible() && mob.canBeSeen() - if (isVisible) when (mob.mobType) { - Mob.Type.PLAYER -> MobEvent.FirstSeen.Player(mob) - Mob.Type.SUMMON -> MobEvent.FirstSeen.Summon(mob) - Mob.Type.SPECIAL -> MobEvent.FirstSeen.Special(mob) - Mob.Type.PROJECTILE -> MobEvent.FirstSeen.Projectile(mob) - Mob.Type.DISPLAY_NPC -> MobEvent.FirstSeen.DisplayNPC(mob) - Mob.Type.BASIC, Mob.Type.DUNGEON, Mob.Type.BOSS, Mob.Type.SLAYER -> MobEvent.FirstSeen.SkyblockMob(mob) + if (isVisible) { + when (mob.mobType) { + Mob.Type.PLAYER -> MobEvent.FirstSeen.Player(mob) + Mob.Type.SUMMON -> MobEvent.FirstSeen.Summon(mob) + Mob.Type.SPECIAL -> MobEvent.FirstSeen.Special(mob) + Mob.Type.PROJECTILE -> MobEvent.FirstSeen.Projectile(mob) + Mob.Type.DISPLAY_NPC -> MobEvent.FirstSeen.DisplayNPC(mob) + Mob.Type.BASIC, Mob.Type.DUNGEON, Mob.Type.BOSS, Mob.Type.SLAYER -> MobEvent.FirstSeen.SkyblockMob(mob) + }.postAndCatch() } return isVisible } diff --git a/src/main/java/at/hannibal2/skyhanni/events/MobEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/MobEvent.kt index 10172cb5fcd8..07990ff222c5 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/MobEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/MobEvent.kt @@ -21,8 +21,6 @@ open class MobEvent(val mob: Mob) : LorenzEvent() { class Projectile(mob: Mob) : DeSpawn(mob) } - // TODO replace with "isFirstTime" parameter in the Spawn event. Also create an actual "player sees the mob for the first time" event - @Deprecated("Old. Will get replaced soon.") open class FirstSeen(mob: Mob) : MobEvent(mob) { class SkyblockMob(mob: Mob) : FirstSeen(mob) class Summon(mob: Mob) : FirstSeen(mob) diff --git a/src/main/java/at/hannibal2/skyhanni/events/entity/EntityLeaveWorldEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/entity/EntityLeaveWorldEvent.kt new file mode 100644 index 000000000000..74d885e1190e --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/events/entity/EntityLeaveWorldEvent.kt @@ -0,0 +1,6 @@ +package at.hannibal2.skyhanni.events.entity + +import at.hannibal2.skyhanni.api.event.GenericSkyHanniEvent +import net.minecraft.entity.Entity + +class EntityLeaveWorldEvent(val entity: T) : GenericSkyHanniEvent(entity.javaClass) diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt deleted file mode 100644 index 9c152e1432dd..000000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt +++ /dev/null @@ -1,124 +0,0 @@ -package at.hannibal2.skyhanni.features.nether.ashfang - -import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator -import at.hannibal2.skyhanni.data.IslandType -import at.hannibal2.skyhanni.events.EntityHealthUpdateEvent -import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent -import at.hannibal2.skyhanni.events.SecondPassedEvent -import at.hannibal2.skyhanni.events.SkyHanniRenderEntityEvent -import at.hannibal2.skyhanni.features.combat.damageindicator.BossType -import at.hannibal2.skyhanni.features.combat.damageindicator.DamageIndicatorManager -import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper -import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule -import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy -import at.hannibal2.skyhanni.utils.ColorUtils.withAlpha -import at.hannibal2.skyhanni.utils.EntityUtils -import at.hannibal2.skyhanni.utils.EntityUtils.getAllNameTagsWith -import at.hannibal2.skyhanni.utils.LorenzColor -import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland -import net.minecraft.entity.EntityLivingBase -import net.minecraft.entity.item.EntityArmorStand -import net.minecraft.entity.monster.EntityBlaze -import net.minecraftforge.fml.common.eventhandler.EventPriority -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent - -@SkyHanniModule -object AshfangBlazes { - - private val config get() = SkyHanniMod.feature.crimsonIsle.ashfang - - private val blazeColor = mutableMapOf() - private var blazeArmorStand = mapOf() - - private var nearAshfang = false - - @SubscribeEvent - fun onSecondPassed(event: SecondPassedEvent) { - if (!isEnabled()) return - - checkNearAshfang() - - if (nearAshfang) { - for (entity in EntityUtils.getEntities() - .filter { it !in blazeColor.keys }) { - val list = entity.getAllNameTagsWith(2, "Ashfang") - if (list.size == 1) { - val armorStand = list[0] - val color = when { - armorStand.name.contains("Ashfang Follower") -> LorenzColor.DARK_GRAY - armorStand.name.contains("Ashfang Underling") -> LorenzColor.RED - armorStand.name.contains("Ashfang Acolyte") -> LorenzColor.BLUE - else -> { - blazeArmorStand = blazeArmorStand.editCopy { - remove(entity) - } - continue - } - } - blazeArmorStand = blazeArmorStand.editCopy { - this[entity] = armorStand - } - entity setBlazeColor color - } - } - } - } - - @SubscribeEvent - fun onEntityHealthUpdate(event: EntityHealthUpdateEvent) { - if (!isEnabled()) return - - val entityId = event.entity.entityId - if (entityId !in blazeArmorStand.keys.map { it.entityId }) return - - if (event.health % 10_000_000 != 0) { - blazeArmorStand = blazeArmorStand.editCopy { - keys.removeIf { it.entityId == entityId } - } - } - } - - private fun checkNearAshfang() { - nearAshfang = EntityUtils.getEntities().any { it.name.contains("Ashfang") } - } - - @SubscribeEvent(priority = EventPriority.HIGH) - fun onRenderLiving(event: SkyHanniRenderEntityEvent.Specials.Pre) { - if (!isEnabled()) return - if (!config.hide.fullNames) return - - val entity = event.entity - if (entity !is EntityArmorStand) return - if (!entity.hasCustomName()) return - if (entity.isDead) return - if (entity in blazeArmorStand.values) { - event.cancel() - } - } - - @SubscribeEvent - fun onWorldChange(event: LorenzWorldChangeEvent) { - blazeColor.clear() - blazeArmorStand = emptyMap() - } - - @SubscribeEvent - fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { - event.move(2, "ashfang.nextResetCooldown", "crimsonIsle.ashfang.nextResetCooldown") - event.move(2, "ashfang.highlightBlazes", "crimsonIsle.ashfang.highlightBlazes") - event.move(2, "ashfang.hideNames", "crimsonIsle.ashfang.hide.fullNames") - } - - private fun isEnabled(): Boolean { - return IslandType.CRIMSON_ISLE.isInIsland() && DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG) - } - - private infix fun EntityBlaze.setBlazeColor(color: LorenzColor) { - blazeColor[this] = color - RenderLivingEntityHelper.setEntityColorWithNoHurtTime( - this, - color.toColor().withAlpha(40), - ) { isEnabled() && config.highlightBlazes } - } -} diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazingSouls.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazingSouls.kt deleted file mode 100644 index de4db8f833da..000000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazingSouls.kt +++ /dev/null @@ -1,71 +0,0 @@ -package at.hannibal2.skyhanni.features.nether.ashfang - -import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator -import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent -import at.hannibal2.skyhanni.events.LorenzTickEvent -import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent -import at.hannibal2.skyhanni.features.combat.damageindicator.BossType -import at.hannibal2.skyhanni.features.combat.damageindicator.DamageIndicatorManager -import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule -import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor -import at.hannibal2.skyhanni.utils.EntityUtils -import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture -import at.hannibal2.skyhanni.utils.LocationUtils -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.RenderUtils.drawString -import at.hannibal2.skyhanni.utils.RenderUtils.drawWaypointFilled -import at.hannibal2.skyhanni.utils.getLorenzVec -import net.minecraft.entity.item.EntityArmorStand -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent - -@SkyHanniModule -object AshfangBlazingSouls { - - private val config get() = SkyHanniMod.feature.crimsonIsle.ashfang.blazingSouls - - private const val TEXTURE = - "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvODI4N2IzOTdkYWY5NTE2YTBiZDc2ZjVmMWI3YmY5Nzk1MTVkZjNkNWQ4MzNlMDYzNWZhNjhiMzdlZTA4MjIxMiJ9fX0=" - private val souls = mutableListOf() - - @SubscribeEvent - fun onTick(event: LorenzTickEvent) { - if (!isEnabled()) return - - EntityUtils.getEntities() - .filter { it !in souls && it.hasSkullTexture(TEXTURE) } - .forEach { souls.add(it) } - } - - @SubscribeEvent - fun onRenderWorld(event: LorenzRenderWorldEvent) { - if (!isEnabled()) return - - val color = config.color.toChromaColor() - - val playerLocation = LocationUtils.playerLocation() - for (orb in souls) { - if (orb.isDead) continue - val orbLocation = orb.getLorenzVec() - event.drawWaypointFilled(orbLocation.add(-0.5, 1.25, -0.5), color, extraSize = -0.15) - if (orbLocation.distance(playerLocation) < 10) { - // TODO find way to dynamically change color - event.drawString(orbLocation.up(2.5), "§bBlazing Soul") - } - } - } - - @SubscribeEvent - fun onWorldChange(event: LorenzWorldChangeEvent) { - souls.clear() - } - - @SubscribeEvent - fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { - event.move(2, "ashfang.blazingSouls", "crimsonIsle.ashfang.blazingSouls.enabled") - event.move(2, "ashfang.blazingSoulsColor", "crimsonIsle.ashfang.blazingSouls.color") - } - - private fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled && - DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG) -} diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt index 68684ef49ece..07cf723fa6f4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt @@ -1,14 +1,10 @@ package at.hannibal2.skyhanni.features.nether.ashfang -import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.features.combat.damageindicator.BossType -import at.hannibal2.skyhanni.features.combat.damageindicator.DamageIndicatorManager import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher +import at.hannibal2.skyhanni.utils.RegexUtils.matches import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.TimeUtils.format @@ -19,47 +15,35 @@ import kotlin.time.Duration.Companion.seconds @SkyHanniModule object AshfangFreezeCooldown { - private val config get() = SkyHanniMod.feature.crimsonIsle.ashfang + private val config get() = AshfangManager.config private val cryogenicBlastPattern by RepoPattern.pattern( "ashfang.freeze.cryogenic", - "§cAshfang Follower's Cryogenic Blast hit you for .* damage!" + "§cAshfang Follower's Cryogenic Blast hit you for .* damage!", ) - private var lastHit = SimpleTimeMark.farPast() + private var unfrozenTime = SimpleTimeMark.farPast() + private val duration = 3.seconds @SubscribeEvent fun onChat(event: LorenzChatEvent) { if (!isEnabled()) return - - val message = event.message - cryogenicBlastPattern.matchMatcher(message) { - lastHit = SimpleTimeMark.now() - } + if (cryogenicBlastPattern.matches(event.message)) unfrozenTime = SimpleTimeMark.now() + duration } @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { if (!isEnabled()) return + if (!isCurrentlyFrozen()) return - val passedSince = lastHit.passedSince() - val maxDuration = 3.seconds - val duration = maxDuration - passedSince - if (duration > 0.seconds) { - val format = duration.format(showMilliSeconds = true) - config.freezeCooldownPos.renderString( - "§cAshfang Freeze: §a$format", - posLabel = "Ashfang Freeze Cooldown" - ) - } + val format = unfrozenTime.timeUntil().format(showMilliSeconds = true) + config.freezeCooldownPos.renderString( + "§cAshfang Freeze: §a$format", + posLabel = "Ashfang Freeze Cooldown", + ) } - fun isCurrentlyFrozen(): Boolean { - val passedSince = lastHit.passedSince() - val maxDuration = 3.seconds - val duration = maxDuration - passedSince - return duration > 0.seconds - } + fun isCurrentlyFrozen() = unfrozenTime.isInFuture() @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { @@ -67,6 +51,5 @@ object AshfangFreezeCooldown { event.move(2, "ashfang.freezeCooldownPos", "crimsonIsle.ashfang.freezeCooldownPos") } - private fun isEnabled() = LorenzUtils.inSkyBlock && config.freezeCooldown && - DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG) + private fun isEnabled() = AshfangManager.active && config.freezeCooldown } diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt deleted file mode 100644 index 1eaa1dd5e921..000000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt +++ /dev/null @@ -1,75 +0,0 @@ -package at.hannibal2.skyhanni.features.nether.ashfang - -import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator -import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent -import at.hannibal2.skyhanni.events.LorenzTickEvent -import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent -import at.hannibal2.skyhanni.features.combat.damageindicator.BossType -import at.hannibal2.skyhanni.features.combat.damageindicator.DamageIndicatorManager -import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule -import at.hannibal2.skyhanni.utils.EntityUtils -import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture -import at.hannibal2.skyhanni.utils.LocationUtils -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.RenderUtils -import at.hannibal2.skyhanni.utils.RenderUtils.drawString -import at.hannibal2.skyhanni.utils.SpecialColor -import at.hannibal2.skyhanni.utils.getLorenzVec -import net.minecraft.entity.item.EntityArmorStand -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import java.awt.Color - -@SkyHanniModule -object AshfangGravityOrbs { - - private val config get() = SkyHanniMod.feature.crimsonIsle.ashfang.gravityOrbs - - private const val TEXTURE = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV" + - "0L3RleHR1cmUvMWE2OWNjZjdhZDkwNGM5YTg1MmVhMmZmM2Y1YjRlMjNhZGViZjcyZWQxMmQ1ZjI0Yjc4Y2UyZDQ0YjRhMiJ9fX0=" - private val orbs = mutableListOf() - - @SubscribeEvent - fun onTick(event: LorenzTickEvent) { - if (!isEnabled()) return - - EntityUtils.getEntities() - .filter { it !in orbs && it.hasSkullTexture(TEXTURE) } - .forEach { orbs.add(it) } - } - - @SubscribeEvent - fun onRenderWorld(event: LorenzRenderWorldEvent) { - if (!isEnabled()) return - - val color = Color(SpecialColor.specialToChromaRGB(config.color), true) - val playerLocation = LocationUtils.playerLocation() - for (orb in orbs) { - if (orb.isDead) continue - val orbLocation = orb.getLorenzVec() - val center = orbLocation.add(-0.5, -2.0, -0.5) - RenderUtils.drawCylinderInWorld(color, center.x, center.y, center.z, 3.5f, 4.5f, event.partialTicks) - - if (orbLocation.distance(playerLocation) < 15) { - // TODO find way to dynamically change color - event.drawString(orbLocation.up(2.5), "§cGravity Orb") - } - } - } - - @SubscribeEvent - fun onWorldChange(event: LorenzWorldChangeEvent) { - orbs.clear() - } - - @SubscribeEvent - fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { - event.move(1, "ashfang.gravityOrbs", "ashfang.gravityOrbs.enabled") - event.move(1, "ashfang.gravityOrbsColor", "ashfang.gravityOrbs.color") - - event.move(2, "ashfang.gravityOrbs", "crimsonIsle.ashfang.gravityOrbs") - } - - private fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled && - DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG) -} diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideDamageIndicator.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideDamageIndicator.kt deleted file mode 100644 index 606f7d17f8bc..000000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideDamageIndicator.kt +++ /dev/null @@ -1,34 +0,0 @@ -package at.hannibal2.skyhanni.features.nether.ashfang - -import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator -import at.hannibal2.skyhanni.events.SkyHanniRenderEntityEvent -import at.hannibal2.skyhanni.features.combat.damageindicator.BossType -import at.hannibal2.skyhanni.features.combat.damageindicator.DamageIndicatorManager -import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule -import at.hannibal2.skyhanni.utils.LorenzUtils -import net.minecraft.entity.EntityLivingBase -import net.minecraftforge.fml.common.eventhandler.EventPriority -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent - -@SkyHanniModule -object AshfangHideDamageIndicator { - - @SubscribeEvent(priority = EventPriority.HIGH) - fun onRenderLiving(event: SkyHanniRenderEntityEvent.Specials.Pre) { - if (!isEnabled()) return - - if (DamageIndicatorManager.isDamageSplash(event.entity)) { - event.cancel() - } - } - - @SubscribeEvent - fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { - event.move(2, "ashfang.hideDamageSplash", "crimsonIsle.ashfang.hide.damageSplash") - } - - private fun isEnabled() = - LorenzUtils.inSkyBlock && SkyHanniMod.feature.crimsonIsle.ashfang.hide.damageSplash && - DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG) -} diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt deleted file mode 100644 index 4c228a436f66..000000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt +++ /dev/null @@ -1,60 +0,0 @@ -package at.hannibal2.skyhanni.features.nether.ashfang - -import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator -import at.hannibal2.skyhanni.events.CheckRenderEntityEvent -import at.hannibal2.skyhanni.events.ReceiveParticleEvent -import at.hannibal2.skyhanni.events.SecondPassedEvent -import at.hannibal2.skyhanni.features.combat.damageindicator.BossType -import at.hannibal2.skyhanni.features.combat.damageindicator.DamageIndicatorManager -import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule -import at.hannibal2.skyhanni.utils.ItemUtils.name -import at.hannibal2.skyhanni.utils.LorenzUtils -import net.minecraft.entity.item.EntityArmorStand -import net.minecraftforge.fml.common.eventhandler.EventPriority -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent - -@SkyHanniModule -object AshfangHideParticles { - - private var nearAshfang = false - - @SubscribeEvent - fun onSecondPassed(event: SecondPassedEvent) { - if (!LorenzUtils.inSkyBlock) return - - nearAshfang = DamageIndicatorManager.getDistanceTo(BossType.NETHER_ASHFANG) < 40 - } - - @SubscribeEvent - fun onReceiveParticle(event: ReceiveParticleEvent) { - if (isEnabled()) { - event.cancel() - } - } - - @SubscribeEvent(priority = EventPriority.HIGH) - fun onCheckRender(event: CheckRenderEntityEvent<*>) { - if (!isEnabled()) return - - val entity = event.entity - if (entity is EntityArmorStand) { - for (stack in entity.inventory) { - if (stack == null) continue - val name = stack.name - if (name == "§aFairy Souls") continue - if (name == "Glowstone") { - event.cancel() - } - } - } - } - - @SubscribeEvent - fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { - event.move(2, "ashfang.hideParticles", "crimsonIsle.ashfang.hide.particles") - } - - private fun isEnabled() = - LorenzUtils.inSkyBlock && SkyHanniMod.feature.crimsonIsle.ashfang.hide.particles && nearAshfang -} diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHider.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHider.kt new file mode 100644 index 000000000000..4e40ed77cc64 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHider.kt @@ -0,0 +1,46 @@ +package at.hannibal2.skyhanni.features.nether.ashfang + +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.events.CheckRenderEntityEvent +import at.hannibal2.skyhanni.events.ReceiveParticleEvent +import at.hannibal2.skyhanni.events.SkyHanniRenderEntityEvent +import at.hannibal2.skyhanni.features.combat.damageindicator.DamageIndicatorManager +import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule +import at.hannibal2.skyhanni.utils.ItemUtils.name +import net.minecraft.entity.item.EntityArmorStand +import net.minecraftforge.fml.common.eventhandler.EventPriority +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +@SkyHanniModule +object AshfangHider { + + private val config get() = AshfangManager.config.hide + + @SubscribeEvent(priority = EventPriority.HIGH) + fun onRenderLiving(event: SkyHanniRenderEntityEvent.Specials.Pre) { + if (!AshfangManager.active || !config.damageSplash) return + + if (DamageIndicatorManager.isDamageSplash(event.entity)) { + event.cancel() + } + } + + @SubscribeEvent + fun onReceiveParticle(event: ReceiveParticleEvent) { + if (!AshfangManager.active || !config.particles) return + event.cancel() + } + + @SubscribeEvent(priority = EventPriority.HIGH) + fun onCheckRender(event: CheckRenderEntityEvent<*>) { + if (!AshfangManager.active || !config.particles) return + val entity = event.entity as? EntityArmorStand ?: return + if (entity.inventory.any { it?.name == "Glowstone" }) event.cancel() + } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(2, "ashfang.hideDamageSplash", "crimsonIsle.ashfang.hide.damageSplash") + event.move(2, "ashfang.hideParticles", "crimsonIsle.ashfang.hide.particles") + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHighlights.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHighlights.kt new file mode 100644 index 000000000000..312cfc469cfb --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHighlights.kt @@ -0,0 +1,106 @@ +package at.hannibal2.skyhanni.features.nether.ashfang + +import at.hannibal2.skyhanni.api.event.HandleEvent +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent +import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.events.entity.EntityEnterWorldEvent +import at.hannibal2.skyhanni.events.entity.EntityLeaveWorldEvent +import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule +import at.hannibal2.skyhanni.utils.ColorUtils +import at.hannibal2.skyhanni.utils.ColorUtils.getExtendedColorCode +import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor +import at.hannibal2.skyhanni.utils.DelayedRun +import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture +import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer +import at.hannibal2.skyhanni.utils.LorenzColor +import at.hannibal2.skyhanni.utils.LorenzVec +import at.hannibal2.skyhanni.utils.RenderUtils.drawCylinderInWorld +import at.hannibal2.skyhanni.utils.RenderUtils.drawString +import at.hannibal2.skyhanni.utils.RenderUtils.drawWaypointFilled +import at.hannibal2.skyhanni.utils.RenderUtils.exactLocation +import net.minecraft.entity.item.EntityArmorStand +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +@SkyHanniModule +object AshfangHighlights { + + private val config get() = AshfangManager.config + + private const val BLAZING_SOUL = + "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvODI4N2IzOTdkYWY5NTE2YTBiZDc2ZjVmMWI3YmY5Nzk1MTVkZjNkNWQ4MzNlMDYzNWZhNjhiMzdlZTA4MjIxMiJ9fX0=" + private const val GRAVITY_ORB = + "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMWE2OWNjZjdhZDkwNGM5YTg1MmVhMmZmM2Y1YjRlMjNhZGViZjcyZWQxMmQ1ZjI0Yjc4Y2UyZDQ0YjRhMiJ9fX0=" + private val blazingSouls = mutableSetOf() + private val gravityOrbs = mutableSetOf() + private const val MAX_DISTANCE = 15.0 + + @HandleEvent(onlyOnSkyblock = true, onlyOnIsland = IslandType.CRIMSON_ISLE) + fun onEntityJoin(event: EntityEnterWorldEvent) { + if (!AshfangManager.active) return + val entity = event.entity + DelayedRun.runNextTick { + when { + entity.hasSkullTexture(BLAZING_SOUL) -> blazingSouls += entity + entity.hasSkullTexture(GRAVITY_ORB) -> gravityOrbs += entity + } + } + } + + @HandleEvent(onlyOnSkyblock = true, onlyOnIsland = IslandType.CRIMSON_ISLE) + fun onEntityLeave(event: EntityLeaveWorldEvent) { + blazingSouls -= event.entity + gravityOrbs -= event.entity + } + + @SubscribeEvent + fun onRenderWorld(event: LorenzRenderWorldEvent) { + if (!AshfangManager.active) return + + if (config.blazingSouls.enabled) { + val color = config.blazingSouls.color.toChromaColor() + blazingSouls.forEach { + val location = event.exactLocation(it) + event.drawWaypointFilled(location.add(-0.5, 1.25, -0.5), color, extraSize = -0.15) + event.drawBlendedColorString(location, "Blazing Soul") + } + } + + if (config.gravityOrbs.enabled) { + val color = config.gravityOrbs.color.toChromaColor() + gravityOrbs.forEach { + val location = event.exactLocation(it) + event.drawCylinderInWorld(color, location.add(-0.5, -2.0, -0.5), 3.5f, 4.5f) + event.drawBlendedColorString(location, "Gravity Orb") + } + } + } + + @SubscribeEvent + fun onWorldChange(event: LorenzWorldChangeEvent) { + blazingSouls.clear() + gravityOrbs.clear() + } + + private fun LorenzRenderWorldEvent.drawBlendedColorString(location: LorenzVec, text: String) { + val distance = location.distanceToPlayer() + if (distance < MAX_DISTANCE) { + val colorCode = getColorCode(distance) + drawString(location.add(y = 2.5), colorCode + text) + } + } + + private fun getColorCode(distance: Double): String = + ColorUtils.blendRGB(LorenzColor.GREEN.toColor(), LorenzColor.RED.toColor(), distance / MAX_DISTANCE).getExtendedColorCode() + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(2, "ashfang.blazingSouls", "crimsonIsle.ashfang.blazingSouls.enabled") + event.move(2, "ashfang.blazingSoulsColor", "crimsonIsle.ashfang.blazingSouls.color") + + event.move(1, "ashfang.gravityOrbs", "ashfang.gravityOrbs.enabled") + event.move(1, "ashfang.gravityOrbsColor", "ashfang.gravityOrbs.color") + event.move(2, "ashfang.gravityOrbs", "crimsonIsle.ashfang.gravityOrbs") + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangManager.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangManager.kt new file mode 100644 index 000000000000..edf7dbd6489d --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangManager.kt @@ -0,0 +1,93 @@ +package at.hannibal2.skyhanni.features.nether.ashfang + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.features.crimsonisle.ashfang.AshfangConfig +import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.data.mob.Mob +import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.events.MobEvent +import at.hannibal2.skyhanni.events.SkyHanniRenderEntityEvent +import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.ColorUtils.addAlpha +import at.hannibal2.skyhanni.utils.EntityUtils.isAtFullHealth +import at.hannibal2.skyhanni.utils.LorenzColor +import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland +import at.hannibal2.skyhanni.utils.MobUtils.mob +import at.hannibal2.skyhanni.utils.SimpleTimeMark +import net.minecraft.entity.item.EntityArmorStand +import net.minecraftforge.fml.common.eventhandler.EventPriority +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.time.Duration.Companion.seconds + +@SkyHanniModule +object AshfangManager { + + val config: AshfangConfig get() = SkyHanniMod.feature.crimsonIsle.ashfang + + private val ashfangMobs = mutableSetOf() + var ashfang: Mob? = null + private set + var lastSpawnTime = SimpleTimeMark.farPast() + private set + + val active get() = ashfang != null + + @SubscribeEvent + fun onMobSpawn(event: MobEvent.Spawn.SkyblockMob) { + if (!IslandType.CRIMSON_ISLE.isInIsland()) return + val mob = event.mob + val color = when (mob.name) { + "Ashfang Follower" -> LorenzColor.DARK_GRAY + "Ashfang Underling" -> LorenzColor.RED + "Ashfang Acolyte" -> LorenzColor.BLUE + "Ashfang" -> { + ashfang = mob + return + } + + else -> return + } + ashfangMobs += mob + if (config.highlightBlazes) mob.highlight(color.toColor().addAlpha(40)) + } + + @SubscribeEvent + fun onMobFirstSeen(event: MobEvent.FirstSeen.SkyblockMob) { + if (!IslandType.CRIMSON_ISLE.isInIsland()) return + if (!event.mob.name.contains("Ashfang ")) return + if (lastSpawnTime.passedSince() < 10.seconds) return + lastSpawnTime = SimpleTimeMark.now() + } + + @SubscribeEvent + fun onMobDeSpawn(event: MobEvent.DeSpawn.SkyblockMob) { + val mob = event.mob + ashfangMobs -= mob + if (ashfang == mob) { + ashfang = null + if (mob.isInRender()) lastSpawnTime = SimpleTimeMark.farPast() + } + } + + @SubscribeEvent(priority = EventPriority.HIGH) + fun onRenderLiving(event: SkyHanniRenderEntityEvent.Specials.Pre) { + if (!active || !config.hide.fullNames) return + val mob = event.entity.mob ?: return + if (mob !in ashfangMobs) return + if (mob.baseEntity.isAtFullHealth()) event.cancel() + } + + @SubscribeEvent + fun onWorldChange(event: LorenzWorldChangeEvent) { + lastSpawnTime = SimpleTimeMark.farPast() + } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(2, "ashfang.nextResetCooldown", "crimsonIsle.ashfang.nextResetCooldown") + event.move(2, "ashfang.highlightBlazes", "crimsonIsle.ashfang.highlightBlazes") + event.move(2, "ashfang.hideNames", "crimsonIsle.ashfang.hide.fullNames") + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt index c555ec6d29f3..b77301edc06d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt @@ -1,61 +1,33 @@ package at.hannibal2.skyhanni.features.nether.ashfang -import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiRenderEvent -import at.hannibal2.skyhanni.events.LorenzTickEvent -import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent -import at.hannibal2.skyhanni.features.combat.damageindicator.BossType -import at.hannibal2.skyhanni.features.combat.damageindicator.DamageIndicatorManager import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule -import at.hannibal2.skyhanni.utils.EntityUtils -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.renderString -import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.TimeUnit import at.hannibal2.skyhanni.utils.TimeUtils.format -import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds @SkyHanniModule object AshfangNextResetCooldown { - private val config get() = SkyHanniMod.feature.crimsonIsle.ashfang - private var spawnTime = SimpleTimeMark.farPast() - - @SubscribeEvent - fun onTick(event: LorenzTickEvent) { - if (!isEnabled()) return - - if (EntityUtils.getEntities().any { - it.posY > 145 && (it.name.contains("§c§9Ashfang Acolyte§r") || it.name.contains("§c§cAshfang Underling§r")) - } - ) { - spawnTime = SimpleTimeMark.now() - } - } + private val config get() = AshfangManager.config + private val ashfangResetTime = 46.1.seconds @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { if (!isEnabled()) return - if (spawnTime.isFarPast()) return + if (AshfangManager.lastSpawnTime.isFarPast()) return + val nextSpawn = AshfangManager.lastSpawnTime + ashfangResetTime - val passedSince = spawnTime.passedSince() - if (passedSince < 46.1.seconds) { - val format = passedSince.format(TimeUnit.SECOND, showMilliSeconds = true) - config.nextResetCooldownPos.renderString( - "§cAshfang next reset in: §a$format", - posLabel = "Ashfang Reset Cooldown" - ) - } else { - spawnTime = SimpleTimeMark.farPast() - } - } + val format = if (nextSpawn.isInPast()) "§aNow!" + else "§b${nextSpawn.timeUntil().format(TimeUnit.SECOND, showMilliSeconds = true)}" - @SubscribeEvent - fun onWorldChange(event: LorenzWorldChangeEvent) { - spawnTime = SimpleTimeMark.farPast() + config.nextResetCooldownPos.renderString( + "§cAshfang next reset in: $format", + posLabel = "Ashfang Reset Cooldown", + ) } @SubscribeEvent @@ -64,8 +36,5 @@ object AshfangNextResetCooldown { event.move(2, "ashfang.nextResetCooldownPos", "crimsonIsle.ashfang.nextResetCooldownPos") } - private fun isEnabled(): Boolean { - return LorenzUtils.inSkyBlock && config.nextResetCooldown && - DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG) - } + private fun isEnabled() = AshfangManager.active && config.nextResetCooldown } diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinWorld.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinWorld.java new file mode 100644 index 000000000000..1569416d4e20 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinWorld.java @@ -0,0 +1,25 @@ +package at.hannibal2.skyhanni.mixins.transformers; + +import at.hannibal2.skyhanni.data.EntityData; +import net.minecraft.entity.Entity; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import java.util.Collection; + +@Mixin(World.class) +public class MixinWorld { + + @Inject(method = "unloadEntities", at = @At("HEAD")) + private void unloadEntities(Collection entityCollection, CallbackInfo ci) { + for (Entity entity : entityCollection) EntityData.despawnEntity(entity); + } + + @Inject(method = "onEntityRemoved", at = @At("HEAD")) + private void onEntityRemoved(Entity entityIn, CallbackInfo ci) { + EntityData.despawnEntity(entityIn); + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ColorUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ColorUtils.kt index 7b941aebedc3..52b1eb68da40 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ColorUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ColorUtils.kt @@ -8,7 +8,7 @@ object ColorUtils { fun String.toChromaColor() = Color(toChromaColorInt(), true) fun String.toChromaColorInt() = SpecialColor.specialToChromaRGB(this) - fun String.getFirstColorCode() = this.takeIf { it.firstOrNull() == '§' }?.getOrNull(1) + fun String.getFirstColorCode() = takeIf { it.firstOrNull() == '§' }?.getOrNull(1) fun getRed(color: Int) = color shr 16 and 0xFF @@ -24,6 +24,8 @@ object ColorUtils { (start.blue * (1 - percent) + end.blue * percent).toInt(), ) + fun Color.getExtendedColorCode(hasAlpha: Boolean = false): String = ExtendedChatColor(rgb, hasAlpha).toString() + /** Darkens a color by a [factor]. The lower the [factor], the darker the color. */ fun Color.darker(factor: Double = 0.7) = Color( (red * factor).toInt().coerceIn(0, 255), @@ -34,7 +36,8 @@ object ColorUtils { val TRANSPARENT_COLOR = Color(0, 0, 0, 0) - fun Color.withAlpha(alpha: Int): Int = (alpha.coerceIn(0, 255) shl 24) or (this.rgb and 0x00ffffff) + @Deprecated("Don't use int colors", ReplaceWith("this.addAlpha()")) + fun Color.withAlpha(alpha: Int): Int = (alpha.coerceIn(0, 255) shl 24) or (rgb and 0x00ffffff) fun Color.addAlpha(alpha: Int): Color = Color(red, green, blue, alpha) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ExtendedChatColor.kt b/src/main/java/at/hannibal2/skyhanni/utils/ExtendedChatColor.kt index f4a64017d55b..e4cb2f448161 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ExtendedChatColor.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ExtendedChatColor.kt @@ -4,7 +4,7 @@ import java.awt.Color class ExtendedChatColor( val rgb: Int, - val hasAlpha: Boolean, + val hasAlpha: Boolean = false, ) { override fun toString(): String { val stringBuilder = StringBuilder() diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt index 14241f314a32..47bdb3976441 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt @@ -768,6 +768,15 @@ object RenderUtils { GlStateManager.popMatrix() } + fun LorenzRenderWorldEvent.drawCylinderInWorld( + color: Color, + location: LorenzVec, + radius: Float, + height: Float, + ) { + drawCylinderInWorld(color, location.x, location.y, location.z, radius, height, partialTicks) + } + fun drawCylinderInWorld( color: Color, x: Double, From 6f52ce2e3e42ac794c28a8a6eb7f0ae04553b1f6 Mon Sep 17 00:00:00 2001 From: Stella Date: Sun, 13 Oct 2024 03:43:48 -0700 Subject: [PATCH 3/7] Feature: Terminal Waypoints (#2719) Co-authored-by: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Co-authored-by: Empa Co-authored-by: Empa <42304516+ItsEmpa@users.noreply.github.com> Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../skyhanni/config/commands/Commands.kt | 5 ++ .../features/dungeon/DungeonConfig.java | 6 ++ .../features/dungeon/DungeonBossAPI.kt | 5 +- .../features/dungeon/floor7/TerminalInfo.kt | 52 +++++++++++++++++ .../dungeon/floor7/TerminalWaypoints.kt | 56 +++++++++++++++++++ 5 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/dungeon/floor7/TerminalInfo.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/dungeon/floor7/TerminalWaypoints.kt diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index bd94a16587f1..c5a28679e394 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -25,6 +25,7 @@ import at.hannibal2.skyhanni.features.commands.PartyChatCommands import at.hannibal2.skyhanni.features.commands.PartyCommands import at.hannibal2.skyhanni.features.commands.WikiManager import at.hannibal2.skyhanni.features.dungeon.CroesusChestTracker +import at.hannibal2.skyhanni.features.dungeon.floor7.TerminalInfo import at.hannibal2.skyhanni.features.event.diana.AllBurrowsList import at.hannibal2.skyhanni.features.event.diana.BurrowWarpHelper import at.hannibal2.skyhanni.features.event.diana.DianaProfitTracker @@ -501,6 +502,10 @@ object Commands { "shdebugscoreboard", "Monitors the scoreboard changes: Prints the raw scoreboard lines in the console after each update, with time since last update.", ) { ScoreboardData.toggleMonitor() } + registerCommand( + "shresetterminal", + "Resets terminal highlights in F7.", + ) { TerminalInfo.resetTerminals() } } @Suppress("LongMethod") diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/DungeonConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/DungeonConfig.java index ec2bc0c4b0f9..0be6c1e853f0 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/DungeonConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/DungeonConfig.java @@ -138,6 +138,12 @@ public class DungeonConfig { @FeatureToggle public boolean shadowAssassinJumpNotifier = false; + @Expose + @ConfigOption(name = "Terminal Waypoints", desc = "Displays Waypoints in the F7/M7 Goldor Phase.") + @ConfigEditorBoolean + @FeatureToggle + public boolean terminalWaypoints = false; + @Expose @ConfigOption(name = "Dungeon Races Guide", desc = "") @Accordion diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossAPI.kt index 5a7d0ff313a8..d30553a28581 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossAPI.kt @@ -29,6 +29,9 @@ object DungeonBossAPI { F7_GOLDOR_5, F7_NECRON, M7_WITHER_KING, + ; + + fun isCurrent(): Boolean = bossPhase == this } private val patternGroup = RepoPattern.group("dungeon.boss.message") @@ -86,7 +89,7 @@ object DungeonBossAPI { * REGEX-TEST: §bmartimavocado§r§a completed a device! (§r§c3§r§a/8) * REGEX-TEST: §bmartimavocado§r§a activated a terminal! (§r§c4§r§a/7) */ - private val goldorTerminalPattern by patternGroup.pattern( + val goldorTerminalPattern by patternGroup.pattern( "f7.goldor.terminalcomplete", "§.(?\\w+)§r§a (?:activated|completed) a (?lever|terminal|device)! \\(§r§c(?\\d)§r§a/(?\\d)\\)", ) diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/floor7/TerminalInfo.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/floor7/TerminalInfo.kt new file mode 100644 index 000000000000..bd7b8a4ee7a6 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/floor7/TerminalInfo.kt @@ -0,0 +1,52 @@ +package at.hannibal2.skyhanni.features.dungeon.floor7 + +import at.hannibal2.skyhanni.features.dungeon.DungeonBossAPI +import at.hannibal2.skyhanni.utils.LorenzVec + +private typealias BossPhase = DungeonBossAPI.DungeonBossPhase + +enum class TerminalInfo(val location: LorenzVec, val phase: BossPhase, val text: String) { + P1_TERMINAL_1(LorenzVec(111, 113, 73), BossPhase.F7_GOLDOR_1, "Terminal"), + P1_TERMINAL_2(LorenzVec(111, 119, 79), BossPhase.F7_GOLDOR_1, "Terminal"), + P1_TERMINAL_3(LorenzVec(89, 112, 92), BossPhase.F7_GOLDOR_1, "Terminal"), + P1_TERMINAL_4(LorenzVec(89, 122, 101), BossPhase.F7_GOLDOR_1, "Terminal"), + P1_LEVER_1(LorenzVec(106, 124, 113), BossPhase.F7_GOLDOR_1, "Lever"), + P1_LEVER_2(LorenzVec(94, 124, 113), BossPhase.F7_GOLDOR_1, "Lever"), + P1_DEVICE(LorenzVec(110, 119, 93), BossPhase.F7_GOLDOR_1, "Device"), + + P2_TERMINAL_1(LorenzVec(68, 109, 121), BossPhase.F7_GOLDOR_2, "Terminal"), + P2_TERMINAL_2(LorenzVec(59, 120, 122), BossPhase.F7_GOLDOR_2, "Terminal"), + P2_TERMINAL_3(LorenzVec(47, 109, 121), BossPhase.F7_GOLDOR_2, "Terminal"), + P2_TERMINAL_4(LorenzVec(40, 124, 122), BossPhase.F7_GOLDOR_2, "Terminal"), + P2_TERMINAL_5(LorenzVec(39, 108, 143), BossPhase.F7_GOLDOR_2, "Terminal"), + P2_LEVER_1(LorenzVec(23, 132, 138), BossPhase.F7_GOLDOR_2, "Lever"), + P2_LEVER_2(LorenzVec(27, 124, 127), BossPhase.F7_GOLDOR_2, "Lever"), + P2_DEVICE(LorenzVec(60, 131, 142), BossPhase.F7_GOLDOR_2, "Device"), + + P3_TERMINAL_1(LorenzVec(-3, 109, 112), BossPhase.F7_GOLDOR_3, "Terminal"), + P3_TERMINAL_2(LorenzVec(-3, 119, 93), BossPhase.F7_GOLDOR_3, "Terminal"), + P3_TERMINAL_3(LorenzVec(19, 123, 93), BossPhase.F7_GOLDOR_3, "Terminal"), + P3_TERMINAL_4(LorenzVec(-3, 109, 77), BossPhase.F7_GOLDOR_3, "Terminal"), + P3_LEVER_1(LorenzVec(14, 122, 55), BossPhase.F7_GOLDOR_3, "Lever"), + P3_LEVER_2(LorenzVec(2, 122, 55), BossPhase.F7_GOLDOR_3, "Lever"), + P3_DEVICE(LorenzVec(-2, 119, 77), BossPhase.F7_GOLDOR_3, "Device"), + + P4_TERMINAL_1(LorenzVec(41, 109, 29), BossPhase.F7_GOLDOR_4, "Terminal"), + P4_TERMINAL_2(LorenzVec(44, 121, 29), BossPhase.F7_GOLDOR_4, "Terminal"), + P4_TERMINAL_3(LorenzVec(67, 109, 29), BossPhase.F7_GOLDOR_4, "Terminal"), + P4_TERMINAL_4(LorenzVec(72, 115, 48), BossPhase.F7_GOLDOR_4, "Terminal"), + P4_LEVER_1(LorenzVec(84, 121, 34), BossPhase.F7_GOLDOR_4, "Lever"), + P4_LEVER_2(LorenzVec(86, 128, 46), BossPhase.F7_GOLDOR_4, "Lever"), + P4_DEVICE(LorenzVec(63, 126, 35), BossPhase.F7_GOLDOR_4, "Device"), + ; + + var highlight: Boolean = true + + companion object { + fun resetTerminals() = entries.forEach { it.highlight = true } + + fun getClosestTerminal(input: LorenzVec): TerminalInfo? { + return entries.filter { it.highlight }.minByOrNull { it.location.distance(input) } + } + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/floor7/TerminalWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/floor7/TerminalWaypoints.kt new file mode 100644 index 000000000000..f8479507a402 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/floor7/TerminalWaypoints.kt @@ -0,0 +1,56 @@ +package at.hannibal2.skyhanni.features.dungeon.floor7 + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent +import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.features.dungeon.DungeonAPI +import at.hannibal2.skyhanni.features.dungeon.DungeonBossAPI +import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule +import at.hannibal2.skyhanni.utils.EntityUtils +import at.hannibal2.skyhanni.utils.LorenzColor +import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher +import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText +import at.hannibal2.skyhanni.utils.RenderUtils.drawWaypointFilled +import at.hannibal2.skyhanni.utils.getLorenzVec +import net.minecraft.entity.player.EntityPlayerMP +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +@SkyHanniModule +object TerminalWaypoints { + + private val config get() = SkyHanniMod.feature.dungeon + + @SubscribeEvent + fun onRenderWorld(event: LorenzRenderWorldEvent) { + if (!isEnabled()) return + + for (term in TerminalInfo.entries) { + if (!term.highlight || !term.phase.isCurrent()) continue + event.drawWaypointFilled(term.location, LorenzColor.GREEN.toColor(), seeThroughBlocks = true) + event.drawDynamicText(term.location, term.text, 1.0) + } + } + + @SubscribeEvent + fun onWorldChange(event: LorenzWorldChangeEvent) { + TerminalInfo.resetTerminals() + } + + @SubscribeEvent + fun onChat(event: LorenzChatEvent) { + if (!inBoss()) return + + val playerName = DungeonBossAPI.goldorTerminalPattern.matchMatcher(event.message) { + group("playerName") + } ?: return + + val playerEntity = EntityUtils.getEntities().find { it.name == playerName } ?: return + val terminal = TerminalInfo.getClosestTerminal(playerEntity.getLorenzVec()) + terminal?.highlight = false + } + + private fun inBoss() = DungeonAPI.inBossRoom && DungeonAPI.isOneOf("F7", "M7") + + private fun isEnabled() = inBoss() && config.terminalWaypoints +} From d8bb53773ba3f1e36e8822e58f3175c2847f7b61 Mon Sep 17 00:00:00 2001 From: David Cole <40234707+DavidArthurCole@users.noreply.github.com> Date: Sun, 13 Oct 2024 06:45:06 -0400 Subject: [PATCH 4/7] Fix: Farming Weight Overlay (#2731) --- .../features/garden/farming/FarmingWeightDisplay.kt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt index 3da9945b59d9..640661bd9797 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt @@ -360,12 +360,9 @@ object FarmingWeightDisplay { ) } - private fun isEnabled() = ( - config.display && ( - OutsideSbFeature.FARMING_WEIGHT.isSelected() && !LorenzUtils.inSkyBlock - ) || - (LorenzUtils.inSkyBlock && (GardenAPI.inGarden() || config.showOutsideGarden)) - ) + private fun isEnabled() = config.display && (outsideEnabled() || inGardenEnabled()) + private fun outsideEnabled() = OutsideSbFeature.FARMING_WEIGHT.isSelected() && !LorenzUtils.inSkyBlock + private fun inGardenEnabled() = (LorenzUtils.inSkyBlock && GardenAPI.inGarden()) || config.showOutsideGarden private fun isEtaEnabled() = config.overtakeETA From 113389a86c769d4d3a547fac5b7440fa8f29bc6f Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Sun, 13 Oct 2024 15:47:00 +0200 Subject: [PATCH 5/7] Backend: Command Register Event (#2642) Co-authored-by: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Co-authored-by: Cal Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../java/at/hannibal2/skyhanni/SkyHanniMod.kt | 4 +- .../skyhanni/config/ConfigGuiManager.kt | 13 + .../config/commands/CommandBuilder.kt | 20 + .../config/commands/CommandCategory.kt | 44 + .../skyhanni/config/commands/Commands.kt | 1297 +++++++++-------- .../config/commands/RegisterCommandsEvent.kt | 16 + .../skyhanni/config/commands/SimpleCommand.kt | 45 +- .../features/garden/FarmingFortuneConfig.java | 4 +- .../features/gui/ModifyWordsConfig.java | 4 +- .../skyhanni/features/commands/HelpCommand.kt | 8 +- .../features/dungeon/CroesusChestTracker.kt | 2 +- .../event/hoppity/HoppityCollectionStats.kt | 4 +- .../skyhanni/features/garden/GardenAPI.kt | 18 +- .../garden/fortuneguide/CaptureFarmingGear.kt | 7 + .../garden/fortuneguide/FFGuideGUI.kt | 11 + .../features/misc/update/UpdateManager.kt | 24 + .../misc/visualwords/VisualWordGui.kt | 12 + .../rift/everywhere/PunchcardHighlight.kt | 2 +- .../features/slayer/SlayerProfitTracker.kt | 2 +- .../skyhanni/test/SkyHanniDebugsAndTests.kt | 4 +- 20 files changed, 886 insertions(+), 655 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/config/commands/CommandBuilder.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/config/commands/CommandCategory.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/config/commands/RegisterCommandsEvent.kt diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 45d02f5445f6..3aa57db320e0 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -5,7 +5,7 @@ import at.hannibal2.skyhanni.config.ConfigFileType import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.config.Features import at.hannibal2.skyhanni.config.SackData -import at.hannibal2.skyhanni.config.commands.Commands +import at.hannibal2.skyhanni.config.commands.RegisterCommandsEvent import at.hannibal2.skyhanni.data.OtherInventoryData import at.hannibal2.skyhanni.data.jsonobjects.local.FriendsJson import at.hannibal2.skyhanni.data.jsonobjects.local.JacobContestsJson @@ -59,7 +59,7 @@ class SkyHanniMod { SkyHanniEvents.init(modules) - Commands.init() + RegisterCommandsEvent.post() PreInitFinishedEvent().post() } diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiManager.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiManager.kt index ffb3b7256bfc..2aad75a40e3e 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiManager.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.GuiEditManager import io.github.notenoughupdates.moulconfig.gui.GuiScreenElementWrapper import io.github.notenoughupdates.moulconfig.gui.MoulConfigEditor @@ -18,4 +19,16 @@ object ConfigGuiManager { } SkyHanniMod.screenToOpen = GuiScreenElementWrapper(editor) } + + fun onCommand(args: Array) { + if (args.isNotEmpty()) { + if (args[0].lowercase() == "gui") { + GuiEditManager.openGuiPositionEditor(hotkeyReminder = true) + } else { + openConfigGui(args.joinToString(" ")) + } + } else { + openConfigGui() + } + } } diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/CommandBuilder.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/CommandBuilder.kt new file mode 100644 index 000000000000..98227fc8ccb4 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/CommandBuilder.kt @@ -0,0 +1,20 @@ +package at.hannibal2.skyhanni.config.commands + +class CommandBuilder(val name: String) { + var description: String = "" + var category: CommandCategory = CommandCategory.MAIN + var aliases: List = emptyList() + private var autoComplete: ((Array) -> List) = { listOf() } + private var callback: (Array) -> Unit = {} + + fun callback(callback: (Array) -> Unit) { + this.callback = callback + } + + fun autoComplete(autoComplete: (Array) -> List) { + this.autoComplete = autoComplete + } + + fun toSimpleCommand() = SimpleCommand(name.lowercase(), aliases, callback, autoComplete) +} + diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/CommandCategory.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/CommandCategory.kt new file mode 100644 index 000000000000..b0474ae47797 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/CommandCategory.kt @@ -0,0 +1,44 @@ +package at.hannibal2.skyhanni.config.commands + +enum class CommandCategory(val color: String, val categoryName: String, val description: String) { + MAIN( + "§6", + "Main Command", + "Most useful commands of SkyHanni", + ), + USERS_ACTIVE( + "§e", + "Normal Command", + "Normal Command for everyone to use", + ), + USERS_RESET( + "§e", + "Normal Reset Command", + "Normal Command that resents some data", + ), + USERS_BUG_FIX( + "§f", + "User Bug Fix", + "A Command to fix small bugs", + ), + DEVELOPER_TEST( + "§5", + "Developer Test Commands", + "A Command to edit/test/change some features. §cIntended for developers only!", + ), + DEVELOPER_DEBUG( + "§9", + "Developer Debug Commands", + "A Command to debug/read/copy/monitor features. §cIntended for developers only!", + ), + INTERNAL( + "§8", + "Internal Command", + "A Command that should §cnever §7be called manually!", + ), + SHORTENED_COMMANDS( + "§b", + "Shortened Commands", + "Commands that shorten or improve existing Hypixel commands!", + ) +} diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index c5a28679e394..208beafe4966 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -2,12 +2,11 @@ package at.hannibal2.skyhanni.config.commands import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.api.SkillAPI +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigFileType import at.hannibal2.skyhanni.config.ConfigGuiManager -import at.hannibal2.skyhanni.config.features.About.UpdateStream import at.hannibal2.skyhanni.data.ChatManager import at.hannibal2.skyhanni.data.GardenCropMilestonesCommunityFix -import at.hannibal2.skyhanni.data.GuiEditManager import at.hannibal2.skyhanni.data.PartyAPI import at.hannibal2.skyhanni.data.SackAPI import at.hannibal2.skyhanni.data.ScoreboardData @@ -80,6 +79,7 @@ import at.hannibal2.skyhanni.features.misc.visualwords.VisualWordGui import at.hannibal2.skyhanni.features.rift.area.westvillage.VerminTracker import at.hannibal2.skyhanni.features.rift.everywhere.PunchcardHighlight import at.hannibal2.skyhanni.features.slayer.SlayerProfitTracker +import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.test.DebugCommand import at.hannibal2.skyhanni.test.PacketTest import at.hannibal2.skyhanni.test.SkyBlockIslandTest @@ -97,638 +97,735 @@ import at.hannibal2.skyhanni.test.command.TrackParticlesCommand import at.hannibal2.skyhanni.test.command.TrackSoundsCommand import at.hannibal2.skyhanni.test.graph.GraphEditor import at.hannibal2.skyhanni.utils.APIUtils -import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ExtendedChatColor import at.hannibal2.skyhanni.utils.ItemPriceUtils -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.SoundUtils import at.hannibal2.skyhanni.utils.TabListData import at.hannibal2.skyhanni.utils.chat.ChatClickActionManager import at.hannibal2.skyhanni.utils.repopatterns.RepoPatternGui -import net.minecraft.command.ICommandSender -import net.minecraft.util.BlockPos -import net.minecraftforge.client.ClientCommandHandler +@SkyHanniModule object Commands { - private val openMainMenu: (Array) -> Unit = { - if (it.isNotEmpty()) { - if (it[0].lowercase() == "gui") { - GuiEditManager.openGuiPositionEditor(hotkeyReminder = true) - } else { - ConfigGuiManager.openConfigGui(it.joinToString(" ")) - } - } else { - ConfigGuiManager.openConfigGui() - } - } - - // command -> description - private val commands = mutableListOf() - - enum class CommandCategory(val color: String, val categoryName: String, val description: String) { - MAIN("§6", "Main Command", "Most useful commands of SkyHanni"), - USERS_NORMAL("§e", "Normal Command", "Normal Command for everyone to use"), - USERS_BUG_FIX("§f", "User Bug Fix", "A Command to fix small bugs"), - DEVELOPER_CODING_HELP( - "§5", - "Developer Coding Help", - "A Command that can help with developing new features. §cIntended for developers only!", - ), - DEVELOPER_DEBUG_FEATURES( - "§9", - "Developer Debug Features", - "A Command that is useful for monitoring/debugging existing features. §cIntended for developers only!", - ), - INTERNAL("§8", "Internal Command", "A Command that should §cnever §7be called manually!"), - SHORTENED_COMMANDS("§b", "Shortened Commands", "Commands that shorten or improve existing Hypixel commands!") - } - - class CommandInfo(val name: String, val description: String, val category: CommandCategory) - - private var currentCategory = CommandCategory.MAIN - - fun init() { - currentCategory = CommandCategory.MAIN - usersMain() - - currentCategory = CommandCategory.USERS_NORMAL - usersNormal() - - currentCategory = CommandCategory.USERS_BUG_FIX - usersBugFix() - - currentCategory = CommandCategory.DEVELOPER_CODING_HELP - developersCodingHelp() - - currentCategory = CommandCategory.DEVELOPER_DEBUG_FEATURES - developersDebugFeatures() - - currentCategory = CommandCategory.INTERNAL - internalCommands() - - currentCategory = CommandCategory.SHORTENED_COMMANDS - shortenedCommands() - } - - private fun usersMain() { - registerCommand("sh", "Opens the main SkyHanni config", openMainMenu) - registerCommand("skyhanni", "Opens the main SkyHanni config", openMainMenu) - registerCommand("ff", "Opens the Farming Fortune Guide") { openFortuneGuide() } - registerCommand("shcommands", "Shows this list") { HelpCommand.onCommand(it, commands) } - registerCommand0( - "shdefaultoptions", - "Select default options", - { DefaultConfigFeatures.onCommand(it) }, - DefaultConfigFeatures::onComplete, - ) - registerCommand("shremind", "Set a reminder for yourself") { ReminderManager.command(it) } - registerCommand("shwords", "Opens the config list for modifying visual words") { openVisualWords() } - registerCommand("shnavigate", "Using path finder to go to locatons") { NavigationHelper.onCommand(it) } - } - - @Suppress("LongMethod") - private fun usersNormal() { - registerCommand( - "shmarkplayer", - "Add a highlight effect to a player for better visibility", - ) { MarkedPlayerManager.command(it) } - registerCommand("shtrackcollection", "Tracks your collection gain over time") { CollectionTracker.command(it) } - registerCommand( - "shcroptime", - "Calculates with your current crop per second speed how long you need to farm a crop to collect this amount of items", - ) { GardenCropTimeCommand.onCommand(it) } - registerCommand( - "shcropsin", - "Calculates with your current crop per second how many items you can collect in this amount of time", - ) { GardenCropsInCommand.onCommand(it) } - registerCommand( - "shrpcstart", - "Manually starts the Discord Rich Presence feature", - ) { DiscordRPCManager.startCommand() } - registerCommand( - "shcropstartlocation", - "Manually sets the crop start location", - ) { GardenStartLocation.setLocationCommand() } - registerCommand( - "shclearslayerprofits", - "Clearing the total slayer profit for the current slayer type", - ) { SlayerProfitTracker.clearProfitCommand(it) } - registerCommand( - "shimportghostcounterdata", - "Manually importing the ghost counter data from GhostCounterV3", - ) { GhostUtil.importCTGhostCounterData() } - registerCommand( - "shclearfarmingitems", - "Clear farming items saved for the Farming Fortune Guide", - ) { clearFarmingItems() } - registerCommand("shresetghostcounter", "Resets the ghost counter") { GhostUtil.reset() } - registerCommand("shresetpowdertracker", "Resets the Powder Tracker") { PowderTracker.resetCommand() } - registerCommand("shresetdicertracker", "Resets the Dicer Drop Tracker") { DicerRngDropTracker.resetCommand() } - registerCommand("shresetcorpsetracker", "Resets the Glacite Mineshaft Corpse Tracker") { CorpseTracker.resetCommand() } - registerCommand( - "shresetendernodetracker", - "Resets the Ender Node Tracker", - ) { EnderNodeTracker.resetCommand() } - registerCommand( - "shresetarmordroptracker", - "Resets the Armor Drop Tracker", - ) { ArmorDropTracker.resetCommand() } - registerCommand( - "shresetfrozentreasuretracker", - "Resets the Frozen Treasure Tracker", - ) { FrozenTreasureTracker.resetCommand() } - registerCommand( - "shresetfishingtracker", - "Resets the Fishing Profit Tracker", - ) { FishingProfitTracker.resetCommand() } - registerCommand( - "shresetvisitordrops", - "Reset the Visitors Drop Statistics", - ) { GardenVisitorDropStatistics.resetCommand() } - registerCommand("shbingotoggle", "Toggle the bingo card display mode") { BingoCardDisplay.toggleCommand() } - registerCommand( - "shfarmingprofile", - "Look up the farming profile from yourself or another player on elitebot.dev", - ) { FarmingWeightDisplay.lookUpCommand(it) } - registerCommand( - "shcopytranslation", - "Copy the translation of a message in another language to your clipboard.\n" + "Uses a language code that can be found at the end of a translation message.", - ) { Translator.fromNativeLanguage(it) } - registerCommand( - "shtranslate", - "Translate a message in another language to your language.", - ) { Translator.toNativeLanguage(it) } - registerCommand( - "shmouselock", - "Lock/Unlock the mouse so it will no longer rotate the player (for farming)", - ) { LockMouseLook.toggleLock() } - registerCommand( - "shsensreduce", - "Lowers the mouse sensitivity for easier small adjustments (for farming)", - ) { SensitivityReducer.manualToggle() } - registerCommand( - "shresetvermintracker", - "Resets the Vermin Tracker", - ) { VerminTracker.resetCommand() } - registerCommand( - "shresetdianaprofittracker", - "Resets the Diana Profit Tracker", - ) { DianaProfitTracker.resetCommand() } - registerCommand( - "shresetpestprofittracker", - "Resets the Pest Profit Tracker", - ) { PestProfitTracker.resetCommand() } - registerCommand( - "shresetexperimentsprofittracker", - "Resets the Experiments Profit Tracker", - ) { ExperimentsProfitTracker.resetCommand() } - registerCommand( - "shresetmythologicalcreaturetracker", - "Resets the Mythological Creature Tracker", - ) { MythologicalCreatureTracker.resetCommand() } - registerCommand( - "shresetseacreaturetracker", - "Resets the Sea Creature Tracker", - ) { SeaCreatureTracker.resetCommand() } - registerCommand( - "shresetstrayrabbittracker", - "Resets the Stray Rabbit Tracker", - ) { ChocolateFactoryStrayTracker.resetCommand() } - registerCommand( - "shresetexcavatortracker", - "Resets the Fossil Excavator Profit Tracker", - ) { ExcavatorProfitTracker.resetCommand() } - registerCommand( - "shfandomwiki", - "Searches the fandom wiki with SkyHanni's own method.", - ) { WikiManager.otherWikiCommands(it, true) } - registerCommand( - "shfandomwikithis", - "Searches the fandom wiki with SkyHanni's own method.", - ) { WikiManager.otherWikiCommands(it, true, true) } - registerCommand( - "shofficialwiki", - "Searches the official wiki with SkyHanni's own method.", - ) { WikiManager.otherWikiCommands(it, false) } - registerCommand( - "shofficialwikithis", - "Searches the official wiki with SkyHanni's own method.", - ) { WikiManager.otherWikiCommands(it, false, true) } - registerCommand0( - "shcalccrop", - "Calculate how many crops need to be farmed between different crop milestones.", - { - FarmingMilestoneCommand.onCommand(it.getOrNull(0), it.getOrNull(1), it.getOrNull(2), false) - }, - FarmingMilestoneCommand::onComplete, - ) - registerCommand0( - "shcalccroptime", - "Calculate how long you need to farm crops between different crop milestones.", - { - FarmingMilestoneCommand.onCommand(it.getOrNull(0), it.getOrNull(1), it.getOrNull(2), true) - }, - FarmingMilestoneCommand::onComplete, - ) - registerCommand0( - "shcropgoal", - "Define a custom milestone goal for a crop.", - { FarmingMilestoneCommand.setGoal(it) }, - FarmingMilestoneCommand::onComplete, - ) - registerCommand0( - "shskills", - "Skills XP/Level related command", - { SkillAPI.onCommand(it) }, - SkillAPI::onComplete, - ) - registerCommand( - "shlimbostats", - "Prints your Limbo Stats.\n §7This includes your Personal Best, Playtime, and §aSkyHanni User Luck§7!", - ) { LimboTimeTracker.printStats() } - registerCommand( - "shlanedetection", - "Detect a farming lane in the Garden", - ) { FarmingLaneCreator.commandLaneDetection() } - registerCommand( - "shignore", - "Add/Remove a user from your", - ) { PartyChatCommands.blacklist(it) } - registerCommand( - "shtpinfested", - "Teleports you to the nearest infested plot", - ) { PestFinder.teleportNearestInfestedPlot() } - registerCommand( - "shhoppitystats", - "Look up stats for a Hoppity's Event (by SkyBlock year).\nRun standalone for a list of years that have stats.", - ) { HoppityEventSummary.sendStatsMessage(it) } - registerCommand( - "shcolors", - "Prints a list of all Minecraft color & formatting codes in chat.", - ) { ColorFormattingHelper.printColorCodeList() } - registerCommand( - "shtps", - "Informs in chat about the server ticks per second (TPS).", - ) { TpsCounter.tpsCommand() } - registerCommand( - "shcarry", - "Keep track of carries you do.", - ) { CarryTracker.onCommand(it) } - } + val commands = mutableListOf() - private fun usersBugFix() { - registerCommand("shupdaterepo", "Download the SkyHanni repo again") { SkyHanniMod.repo.updateRepo() } - registerCommand( - "shresetburrowwarps", - "Manually resetting disabled diana burrow warp points", - ) { BurrowWarpHelper.resetDisabledWarps() } - registerCommand( - "shtogglehypixelapierrors", - "Show/hide hypixel api error messages in chat", - ) { APIUtils.toggleApiErrorMessages() } - registerCommand( - "shclearcropspeed", - "Reset garden crop speed data and best crop time data", - ) { GardenAPI.clearCropSpeed() } - registerCommand( - "shclearminiondata", - "Removed bugged minion locations from your private island", - ) { MinionFeatures.removeBuggedMinions(isCommand = true) } - registerCommand( - "shwhereami", - "Print current island in chat", - ) { SkyHanniDebugsAndTests.whereAmI() } - registerCommand( - "shclearcontestdata", - "Resets Jacob's Contest Data", - ) { SkyHanniDebugsAndTests.clearContestData() } - registerCommand( - "shconfig", - "Search or reset config elements §c(warning, dangerous!)", - ) { SkyHanniConfigSearchResetCommand.command(it) } - registerCommand( - "shdebug", - "Copies SkyHanni debug data in the clipboard.", - ) { DebugCommand.command(it) } - registerCommand( - "shversion", - "Prints the SkyHanni version in the chat", - ) { SkyHanniDebugsAndTests.debugVersion() } - registerCommand( - "shrendertoggle", - "Disables/enables the rendering of all skyhanni guis.", - ) { SkyHanniDebugsAndTests.toggleRender() } - registerCommand( - "shcarrolyn", - "Toggles if the specified crops effect is active from carrolyn", - ) { - CaptureFarmingGear.handelCarrolyn(it) - } - registerCommand( - "shrepostatus", - "Shows the status of all the mods constants", - ) { SkyHanniMod.repo.displayRepoStatus(false) } - registerCommand( - "shclearkismet", - "Clears the saved values of the applied kismet feathers in Croesus", - ) { CroesusChestTracker.resetChest() } - registerCommand( - "shkingfix", - "Resets the local King Talisman Helper offset.", - ) { KingTalismanHelper.kingFix() } - registerCommand( - "shupdate", - "Updates the mod to the specified update stream.", - ) { forceUpdate(it) } - registerCommand( - "shUpdateBazaarPrices", - "Forcefully updating the bazaar prices right now.", - ) { HypixelBazaarFetcher.fetchNow() } - registerCommand( - "shclearsavedrabbits", - "Clears the saved rabbits on this profile.", - ) { HoppityCollectionStats.clearSavedRabbits() } - registerCommand( - "shresetpunchcard", - "Resets the Rift Punchcard Artifact player list.", - ) { PunchcardHighlight.clearList() } - registerCommand( - "shedittracker", - "Changes the tracked item amount for Diana, Fishing, Pest, Excavator, and Slayer Item Trackers.", - ) { TrackerManager.commandEditTracker(it) } + @HandleEvent + fun registerCommands(event: RegisterCommandsEvent) { + usersMain(event) + usersNormal(event) + usersNormalReset(event) + usersBugFix(event) + devTest(event) + devDebug(event) + internalCommands(event) + shortenedCommands(event) } - private fun developersDebugFeatures() { - registerCommand("shtestbingo", "dev command") { TestBingo.toggle() } - registerCommand("shprintbingohelper", "dev command") { BingoNextStepHelper.command() } - registerCommand("shreloadbingodata", "dev command") { BingoCardDisplay.command() } - registerCommand("shtestgardenvisitors", "dev command") { SkyHanniDebugsAndTests.testGardenVisitors() } - registerCommand("shtestcomposter", "dev command") { ComposterOverlay.onCommand(it) } - registerCommand("shtestinquisitor", "dev command") { InquisitorWaypointShare.test() } - registerCommand("shshowcropmoneycalculation", "dev command") { CropMoneyDisplay.toggleShowCalculation() } - registerCommand("shcropspeedmeter", "Debugs how many crops you collect over time") { CropSpeedMeter.toggle() } - registerCommand0( - "shworldedit", - "Select regions in the world", - { WorldEdit.command(it) }, - { listOf("copy", "reset", "help", "left", "right") }, - ) - registerCommand( - "shconfigsave", - "Manually saving the config", - ) { SkyHanniMod.configManager.saveConfig(ConfigFileType.FEATURES, "manual-command") } - registerCommand( - "shtestburrow", - "Sets a test burrow waypoint at your location", - ) { GriffinBurrowHelper.setTestBurrow(it) } - registerCommand( - "shtestsackapi", - "Get the amount of an item in sacks according to internal feature SackAPI", - ) { SackAPI.testSackAPI(it) } - registerCommand( - "shtestgriffinspots", - "Show potential griffin spots around you.", - ) { GriffinBurrowHelper.testGriffinSpots() } - registerCommand( - "shtestisland", - "Sets the current skyblock island for testing purposes.", - ) { SkyBlockIslandTest.onCommand(it) } - registerCommand( - "shdebugprice", - "Debug different price sources for an item.", - ) { ItemPriceUtils.debugItemPrice(it) } - registerCommand( - "shdebugscoreboard", - "Monitors the scoreboard changes: Prints the raw scoreboard lines in the console after each update, with time since last update.", - ) { ScoreboardData.toggleMonitor() } - registerCommand( - "shresetterminal", - "Resets terminal highlights in F7.", - ) { TerminalInfo.resetTerminals() } + private fun usersMain(event: RegisterCommandsEvent) { + event.register("sh") { + aliases = listOf("skyhanni") + description = "Opens the main SkyHanni config" + callback { ConfigGuiManager.onCommand(it) } + } + event.register("ff") { + description = "Opens the Farming Fortune Guide" + callback { FFGuideGUI.onCommand() } + } + event.register("shcommands") { + description = "Shows this list" + callback { HelpCommand.onCommand(it) } + } + event.register("shdefaultoptions") { + description = "Select default options" + callback { DefaultConfigFeatures.onCommand(it) } + autoComplete { DefaultConfigFeatures.onComplete(it) } + } + event.register("shremind") { + description = "Set a reminder for yourself" + callback { ReminderManager.command(it) } + } + event.register("shwords") { + description = "Opens the config list for modifying visual words" + callback { VisualWordGui.onCommand() } + } + event.register("shnavigate") { + description = "Using path finder to go to locations" + callback { NavigationHelper.onCommand(it) } + } + event.register("shcarry") { + description = "Keep track of carries you do." + callback { CarryTracker.onCommand(it) } + } + event.register("shmarkplayer") { + description = "Add a highlight effect to a player for better visibility" + callback { MarkedPlayerManager.command(it) } + } + event.register("shtrackcollection") { + description = "Tracks your collection gain over time" + callback { CollectionTracker.command(it) } + } } @Suppress("LongMethod") - private fun developersCodingHelp() { - registerCommand("shrepopatterns", "See where regexes are loaded from") { RepoPatternGui.open() } - registerCommand("shtest", "Unused test command.") { SkyHanniDebugsAndTests.testCommand(it) } - registerCommand("shtestrabbitpaths", "Tests pathfinding to rabbit eggs. Use a number 0-14.") { - HoppityEggLocator.testPathfind(it) - } - registerCommand( - "shtestitem", - "test item internal name resolving", - ) { SkyHanniDebugsAndTests.testItemCommand(it) } - registerCommand( - "shfindnullconfig", - "Find config elements that are null and prints them into the console", - ) { SkyHanniDebugsAndTests.findNullConfig(it) } - registerCommand("shtestwaypoint", "Set a waypoint on that location") { SkyHanniDebugsAndTests.waypoint(it) } - registerCommand("shtesttablist", "Set your clipboard as a fake tab list.") { TabListData.toggleDebug() } - registerCommand("shreloadlocalrepo", "Reloading the local repo data") { SkyHanniMod.repo.reloadLocalRepo() } - registerCommand("shchathistory", "Show the unfiltered chat history") { ChatManager.openChatFilterGUI(it) } - registerCommand( - "shstoplisteners", - "Unregistering all loaded forge event listeners", - ) { SkyHanniDebugsAndTests.stopListeners() } - registerCommand( - "shreloadlisteners", - "Trying to load all forge event listeners again. Might not work at all", - ) { SkyHanniDebugsAndTests.reloadListeners() } - registerCommand( - "shcopylocation", - "Copies the player location as LorenzVec format to the clipboard", - ) { SkyHanniDebugsAndTests.copyLocation(it) } - registerCommand( - "shcopyentities", - "Copies entities in the specified radius around the player to the clipboard", - ) { CopyNearbyEntitiesCommand.command(it) } - registerCommand( - "shtracksounds", - "Tracks the sounds for the specified duration (in seconds) and copies it to the clipboard", - ) { TrackSoundsCommand.command(it) } - registerCommand( - "shtrackparticles", - "Tracks the particles for the specified duration (in seconds) and copies it to the clipboard", - ) { TrackParticlesCommand.command(it) } - registerCommand( - "shcopytablist", - "Copies the tab list data to the clipboard", - ) { TabListData.copyCommand(it) } - registerCommand( - "shcopyactionbar", - "Copies the action bar to the clipboard, including formatting codes", - ) { CopyActionBarCommand.command(it) } - registerCommand( - "shcopyscoreboard", - "Copies the scoreboard data to the clipboard", - ) { CopyScoreboardCommand.command(it) } - registerCommand( - "shcopybossbar", - "Copies the name of the bossbar to the clipboard, including formatting codes", - ) { CopyBossbarCommand.command(it) } - registerCommand( - "shcopyitem", - "Copies information about the item in hand to the clipboard", - ) { CopyItemCommand.command() } - registerCommand("shtestpacket", "Logs incoming and outgoing packets to the console") { PacketTest.command(it) } - registerCommand( - "shtestmessage", - "Sends a custom chat message client side in the chat", - ) { TestChatCommand.command(it) } - registerCommand( - "shtestrainbow", - "Sends a rainbow in chat", - ) { ExtendedChatColor.testCommand() } - registerCommand( - "shcopyinternalname", - "Copies the internal name of the item in hand to the clipboard.", - ) { SkyHanniDebugsAndTests.copyItemInternalName() } - registerCommand( - "shpartydebug", - "List persons into the chat SkyHanni thinks are in your party.", - ) { PartyAPI.listMembers() } - registerCommand( - "shplaysound", - "Play the specified sound effect at the given pitch and volume.", - ) { SoundUtils.command(it) } - registerCommand( - "shsendtitle", - "Display a title on the screen with the specified settings.", - ) { TitleManager.command(it) } - registerCommand( - "shresetconfig", - "Reloads the config manager and rendering processors of MoulConfig. " + "This §cWILL RESET §7your config, but also updating the java config files " + "(names, description, orderings and stuff).", - ) { SkyHanniDebugsAndTests.resetConfigCommand() } - registerCommand( - "shreadcropmilestonefromclipboard", - "Read crop milestone from clipboard. This helps fixing wrong crop milestone data", - ) { GardenCropMilestonesCommunityFix.readDataFromClipboard() } - registerCommand( - "shcopyfoundburrowlocations", - "Copy all ever found burrow locations to clipboard", - ) { AllBurrowsList.copyToClipboard() } - registerCommand( - "shaddfoundburrowlocationsfromclipboard", - "Add all ever found burrow locations from clipboard", - ) { AllBurrowsList.addFromClipboard() } - registerCommand( - "shgraph", - "Enables the graph editor", - ) { GraphEditor.commandIn() } - registerCommand( - "shtoggleegglocationdebug", - "Shows Hoppity egg locations with their internal API names and status.", - ) { HoppityEggLocations.toggleDebug() } - registerCommand( - "shresetmineshaftpitystats", - "Resets the mineshaft pity display stats", - ) { MineshaftPityDisplay.fullResetCounter() } - registerCommand( - "shtranslateadvanced", - "Translates a message in an inputted language to another inputted language.", - ) { Translator.translateAdvancedCommand(it) } - } - - private fun internalCommands() { - registerCommand("shaction", "") { ChatClickActionManager.onCommand(it) } + private fun usersNormal(event: RegisterCommandsEvent) { + event.register("shimportghostcounterdata") { + description = "Manually importing the ghost counter data from GhostCounterV3" + category = CommandCategory.USERS_ACTIVE + callback { GhostUtil.importCTGhostCounterData() } + } + event.register("shcroptime") { + description = "Calculates with your current crop per second speed " + + "how long you need to farm a crop to collect this amount of items" + category = CommandCategory.USERS_ACTIVE + callback { GardenCropTimeCommand.onCommand(it) } + } + event.register("shcropsin") { + description = "Calculates with your current crop per second how many items you can collect in this amount of time" + category = CommandCategory.USERS_ACTIVE + callback { GardenCropsInCommand.onCommand(it) } + } + event.register("shrpcstart") { + description = "Manually starts the Discord Rich Presence feature" + category = CommandCategory.USERS_ACTIVE + callback { DiscordRPCManager.startCommand() } + } + event.register("shcropstartlocation") { + description = "Manually sets the crop start location" + category = CommandCategory.USERS_ACTIVE + callback { GardenStartLocation.setLocationCommand() } + } + event.register("shbingotoggle") { + description = "Toggle the bingo card display mode" + category = CommandCategory.USERS_ACTIVE + callback { BingoCardDisplay.toggleCommand() } + } + event.register("shfarmingprofile") { + description = "Look up the farming profile from yourself or another player on elitebot.dev" + category = CommandCategory.USERS_ACTIVE + callback { FarmingWeightDisplay.lookUpCommand(it) } + } + event.register("shcopytranslation") { + description = "Copy the translation of a message in another language to your clipboard.\n" + + "Uses a language code that can be found at the end of a translation message." + category = CommandCategory.USERS_ACTIVE + callback { Translator.fromNativeLanguage(it) } + } + event.register("shtranslate") { + description = "Translate a message in another language your language." + category = CommandCategory.USERS_ACTIVE + callback { Translator.toNativeLanguage(it) } + } + event.register("shmouselock") { + description = "Lock/Unlock the mouse so it will no longer rotate the player (for farming)" + category = CommandCategory.USERS_ACTIVE + callback { LockMouseLook.toggleLock() } + } + event.register("shsensreduce") { + description = "Lowers the mouse sensitivity for easier small adjustments (for farming)" + category = CommandCategory.USERS_ACTIVE + callback { SensitivityReducer.manualToggle() } + } + event.register("shfandomwiki") { + description = "Searches the fandom wiki with SkyHanni's own method." + category = CommandCategory.USERS_ACTIVE + callback { WikiManager.otherWikiCommands(it, true) } + } + event.register("shfandomwikithis") { + description = "Searches the fandom wiki with SkyHanni's own method." + category = CommandCategory.USERS_ACTIVE + callback { WikiManager.otherWikiCommands(it, true, true) } + } + event.register("shofficialwiki") { + description = "Searches the official wiki with SkyHanni's own method." + category = CommandCategory.USERS_ACTIVE + callback { WikiManager.otherWikiCommands(it, false) } + } + event.register("shofficialwikithis") { + description = "Searches the official wiki with SkyHanni's own method." + category = CommandCategory.USERS_ACTIVE + callback { WikiManager.otherWikiCommands(it, false, true) } + } + event.register("shcalccrop") { + description = "Calculate how many crops need to be farmed between different crop milestones." + category = CommandCategory.USERS_ACTIVE + autoComplete { FarmingMilestoneCommand.onComplete(it) } + callback { FarmingMilestoneCommand.onCommand(it.getOrNull(0), it.getOrNull(1), it.getOrNull(2), false) } + } + event.register("shcalccroptime") { + description = "Calculate how long you need to farm crops between different crop milestones." + category = CommandCategory.USERS_ACTIVE + autoComplete { FarmingMilestoneCommand.onComplete(it) } + callback { FarmingMilestoneCommand.onCommand(it.getOrNull(0), it.getOrNull(1), it.getOrNull(2), true) } + } + event.register("shcropgoal") { + description = "Define a custom milestone goal for a crop." + category = CommandCategory.USERS_ACTIVE + callback { FarmingMilestoneCommand.setGoal(it) } + autoComplete { FarmingMilestoneCommand.onComplete(it) } + } + event.register("shskills") { + description = "Skills XP/Level related command" + category = CommandCategory.USERS_ACTIVE + callback { SkillAPI.onCommand(it) } + autoComplete { SkillAPI.onComplete(it) } + } + event.register("shlimbostats") { + description = "Prints your Limbo Stats.\n §7This includes your Personal Best, Playtime, and §aSkyHanni User Luck§7!" + category = CommandCategory.USERS_ACTIVE + callback { LimboTimeTracker.printStats() } + } + event.register("shlanedetection") { + description = "Detect a farming lane in the Garden" + category = CommandCategory.USERS_ACTIVE + callback { FarmingLaneCreator.commandLaneDetection() } + } + event.register("shignore") { + description = "Add/Remove a user from your blacklist" + category = CommandCategory.USERS_ACTIVE + callback { PartyChatCommands.blacklist(it) } + } + event.register("shtpinfested") { + description = "Teleports you to the nearest infested plot" + category = CommandCategory.USERS_ACTIVE + callback { PestFinder.teleportNearestInfestedPlot() } + } + event.register("shhoppitystats") { + description = "Look up stats for a Hoppity's Event (by SkyBlock year).\nRun standalone for a list of years that have stats." + category = CommandCategory.USERS_ACTIVE + callback { HoppityEventSummary.sendStatsMessage(it) } + } + event.register("shcolors") { + description = "Prints a list of all Minecraft color & formatting codes in chat." + category = CommandCategory.USERS_ACTIVE + aliases = listOf("shcolor", "shcolours", "shcolour") + callback { ColorFormattingHelper.printColorCodeList() } + } + event.register("shtps") { + description = "Informs in chat about the server ticks per second (TPS)." + category = CommandCategory.USERS_ACTIVE + callback { TpsCounter.tpsCommand() } + } } - private fun shortenedCommands() { - registerCommand("pko", "Kicks offline party members") { PartyCommands.kickOffline() } - registerCommand("pw", "Warps your party") { PartyCommands.warp() } - registerCommand("pk", "Kick a specific party member") { PartyCommands.kick(it) } - registerCommand("pt", "Transfer the party to another party member") { PartyCommands.transfer(it) } - registerCommand("pp", "Promote a specific party member") { PartyCommands.promote(it) } - registerCommand("pd", "Disbands the party") { PartyCommands.disband() } - registerCommand("rpt", "Reverse transfer party to the previous leader") { PartyCommands.reverseTransfer() } - } + private fun usersNormalReset(event: RegisterCommandsEvent) { - @JvmStatic - fun openFortuneGuide() { - if (!LorenzUtils.inSkyBlock) { - ChatUtils.userError("Join SkyBlock to open the fortune guide!") - } else { - FFGuideGUI.open() + // Trackers + event.register("shresetslayerprofits") { + description = "Resets the total slayer profit for the current slayer type" + category = CommandCategory.USERS_RESET + callback { SlayerProfitTracker.resetCommand() } + } + event.register("shresetpowdertracker") { + description = "Resets the Powder Tracker" + category = CommandCategory.USERS_RESET + callback { PowderTracker.resetCommand() } + } + event.register("shresetdicertracker") { + description = "Resets the Dicer Drop Tracker" + category = CommandCategory.USERS_RESET + callback { DicerRngDropTracker.resetCommand() } + } + event.register("shresetcorpsetracker") { + description = "Resets the Glacite Mineshaft Corpse Tracker" + category = CommandCategory.USERS_RESET + callback { CorpseTracker.resetCommand() } + } + event.register("shresetendernodetracker") { + description = "Resets the Ender Node Tracker" + category = CommandCategory.USERS_RESET + callback { EnderNodeTracker.resetCommand() } + } + event.register("shresetarmordroptracker") { + description = "Resets the Armor Drop Tracker" + category = CommandCategory.USERS_RESET + callback { ArmorDropTracker.resetCommand() } + } + event.register("shresetfrozentreasuretracker") { + description = "Resets the Frozen Treasure Tracker" + category = CommandCategory.USERS_RESET + callback { FrozenTreasureTracker.resetCommand() } + } + event.register("shresetfishingtracker") { + description = "Resets the Fishing Profit Tracker" + category = CommandCategory.USERS_RESET + callback { FishingProfitTracker.resetCommand() } + } + event.register("shresetvisitordrops") { + description = "Resets the Visitors Drop Statistics" + category = CommandCategory.USERS_RESET + callback { GardenVisitorDropStatistics.resetCommand() } + } + event.register("shresetvermintracker") { + description = "Resets the Vermin Tracker" + category = CommandCategory.USERS_RESET + callback { VerminTracker.resetCommand() } + } + event.register("shresetdianaprofittracker") { + description = "Resets the Diana Profit Tracker" + category = CommandCategory.USERS_RESET + callback { DianaProfitTracker.resetCommand() } + } + event.register("shresetpestprofittracker") { + description = "Resets the Pest Profit Tracker" + category = CommandCategory.USERS_RESET + callback { PestProfitTracker.resetCommand() } + } + event.register("shresetexperimentsprofittracker") { + description = "Resets the Experiments Profit Tracker" + category = CommandCategory.USERS_RESET + callback { ExperimentsProfitTracker.resetCommand() } + } + event.register("shresetmythologicalcreaturetracker") { + description = "Resets the Mythological Creature Tracker" + category = CommandCategory.USERS_RESET + callback { MythologicalCreatureTracker.resetCommand() } + } + event.register("shresetseacreaturetracker") { + description = "Resets the Sea Creature Tracker" + category = CommandCategory.USERS_RESET + callback { SeaCreatureTracker.resetCommand() } + } + event.register("shresetstrayrabbittracker") { + description = "Resets the Stray Rabbit Tracker" + category = CommandCategory.USERS_RESET + callback { ChocolateFactoryStrayTracker.resetCommand() } + } + event.register("shresetexcavatortracker") { + description = "Resets the Fossil Excavator Profit Tracker" + category = CommandCategory.USERS_RESET + callback { ExcavatorProfitTracker.resetCommand() } } - } - @JvmStatic - fun openVisualWords() { - if (!LorenzUtils.onHypixel) { - ChatUtils.userError("You need to join Hypixel to use this feature!") - } else { - if (VisualWordGui.sbeConfigPath.exists()) VisualWordGui.drawImport = true - SkyHanniMod.screenToOpen = VisualWordGui() + // non trackers + event.register("shresetghostcounter") { + description = "Resets the ghost counter" + category = CommandCategory.USERS_RESET + callback { GhostUtil.reset() } + } + event.register("shresetcropspeed") { + description = "Resets garden crop speed data and best crop time data" + category = CommandCategory.USERS_RESET + callback { GardenAPI.resetCropSpeed() } + } + event.register("shresetkismet") { + description = "Resets the saved values of the applied kismet feathers in Croesus" + category = CommandCategory.USERS_RESET + callback { CroesusChestTracker.resetChest() } + } + event.register("shresetburrowwarps") { + description = "Manually resetting disabled diana burrow warp points" + category = CommandCategory.USERS_RESET + callback { BurrowWarpHelper.resetDisabledWarps() } + } + event.register("shresetcontestdata") { + description = "Resets Jacob's Contest Data" + category = CommandCategory.USERS_RESET + callback { SkyHanniDebugsAndTests.resetContestData() } + } + event.register("shresetfarmingitems") { + description = "Resets farming items saved for the Farming Fortune Guide" + category = CommandCategory.USERS_RESET + callback { CaptureFarmingGear.onResetGearCommand() } + } + event.register("shresetmineshaftpitystats") { + description = "Resets the mineshaft pity display stats" + category = CommandCategory.USERS_RESET + callback { MineshaftPityDisplay.fullResetCounter() } + } + event.register("shresetterminal") { + description = "Resets terminal highlights in F7." + category = CommandCategory.USERS_RESET + callback { TerminalInfo.resetTerminals() } + } + event.register("shresetsavedrabbits") { + description = "Resets the saved rabbits on this profile." + category = CommandCategory.USERS_RESET + callback { HoppityCollectionStats.resetSavedRabbits() } + } + event.register("shresetpunchcard") { + description = "Resets the Rift Punchcard Artifact player list." + category = CommandCategory.USERS_RESET + callback { PunchcardHighlight.onResetCommand() } } } - private fun clearFarmingItems() { - val storage = GardenAPI.storage?.fortune ?: return - ChatUtils.chat("clearing farming items") - storage.farmingItems.clear() - storage.outdatedItems.clear() + private fun usersBugFix(event: RegisterCommandsEvent) { + event.register("shupdaterepo") { + description = "Download the SkyHanni repo again" + category = CommandCategory.USERS_BUG_FIX + callback { SkyHanniMod.repo.updateRepo() } + } + event.register("shtogglehypixelapierrors") { + description = "Show/hide hypixel api error messages in chat" + category = CommandCategory.USERS_BUG_FIX + callback { APIUtils.toggleApiErrorMessages() } + } + event.register("shfixminions") { + description = "Removed bugged minion locations from your private island" + category = CommandCategory.USERS_BUG_FIX + callback { MinionFeatures.removeBuggedMinions(isCommand = true) } + } + event.register("shwhereami") { + description = "Print current island in chat" + category = CommandCategory.USERS_BUG_FIX + callback { SkyHanniDebugsAndTests.whereAmI() } + } + event.register("shrendertoggle") { + description = "Disables/enables the rendering of all skyhanni guis." + category = CommandCategory.USERS_BUG_FIX + callback { SkyHanniDebugsAndTests.toggleRender() } + } + event.register("shcarrolyn") { + description = "Toggles if the specified crops effect is active from carrolyn" + category = CommandCategory.USERS_BUG_FIX + callback { CaptureFarmingGear.handelCarrolyn(it) } + } + event.register("shrepostatus") { + description = "Shows the status of all the mods constants" + category = CommandCategory.USERS_BUG_FIX + callback { SkyHanniMod.repo.displayRepoStatus(false) } + } + event.register("shkingfix") { + description = "Resets the local King Talisman Helper offset." + category = CommandCategory.USERS_BUG_FIX + callback { KingTalismanHelper.kingFix() } + } + event.register("shupdate") { + description = "Updates the mod to the specified update stream." + category = CommandCategory.USERS_BUG_FIX + callback { UpdateManager.updateCommand(it) } + } + event.register("shupdatebazaarprices") { + description = "Forcefully updating the bazaar prices right now." + category = CommandCategory.USERS_BUG_FIX + callback { HypixelBazaarFetcher.fetchNow() } + } + event.register("shedittracker") { + description = "Changes the tracked item amount for Diana, Fishing, Pest, Excavator, and Slayer Item Trackers." + category = CommandCategory.USERS_BUG_FIX + callback { TrackerManager.commandEditTracker(it) } + } } - private fun forceUpdate(args: Array) { - val currentStream = SkyHanniMod.feature.about.updateStream.get() - val arg = args.firstOrNull() ?: "current" - val updateStream = when { - arg.equals("(?i)(?:full|release)s?".toRegex()) -> UpdateStream.RELEASES - arg.equals("(?i)(?:beta|latest)s?".toRegex()) -> UpdateStream.BETA - else -> currentStream + private fun devDebug(event: RegisterCommandsEvent) { + event.register("shdebug") { + description = "Copies SkyHanni debug data in the clipboard." + category = CommandCategory.DEVELOPER_DEBUG + callback { DebugCommand.command(it) } } - - val switchingToBeta = updateStream == UpdateStream.BETA && (currentStream != UpdateStream.BETA || !UpdateManager.isCurrentlyBeta()) - if (switchingToBeta) { - ChatUtils.clickableChat( - "Are you sure you want to switch to beta? These versions may be less stable.", - onClick = { - UpdateManager.checkUpdate(true, updateStream) - }, - "§eClick to confirm!", - oneTimeClick = true, - ) - } else { - UpdateManager.checkUpdate(true, updateStream) + event.register("shconfig") { + description = "Searches or resets config elements §c(warning, dangerous!)" + category = CommandCategory.DEVELOPER_DEBUG + callback { SkyHanniConfigSearchResetCommand.command(it) } + } + event.register("shversion") { + description = "Prints the SkyHanni version in the chat" + category = CommandCategory.DEVELOPER_DEBUG + callback { SkyHanniDebugsAndTests.debugVersion() } + } + event.register("shtestbingo") { + description = "Toggle the test bingo card display mode" + category = CommandCategory.DEVELOPER_DEBUG + callback { TestBingo.toggle() } + } + event.register("shprintbingohelper") { + description = "Prints the next step helper for the bingo card" + category = CommandCategory.DEVELOPER_DEBUG + callback { BingoNextStepHelper.command() } + } + event.register("shreloadbingodata") { + description = "Reloads the bingo card data" + category = CommandCategory.DEVELOPER_DEBUG + callback { BingoCardDisplay.command() } + } + event.register("shtestgardenvisitors") { + description = "Test the garden visitor drop statistics" + category = CommandCategory.DEVELOPER_DEBUG + callback { SkyHanniDebugsAndTests.testGardenVisitors() } + } + event.register("shtestcomposter") { + description = "Test the composter overlay" + category = CommandCategory.DEVELOPER_DEBUG + callback { ComposterOverlay.onCommand(it) } + } + event.register("shtestinquisitor") { + description = "Test the inquisitor waypoint share" + category = CommandCategory.DEVELOPER_DEBUG + callback { InquisitorWaypointShare.test() } + } + event.register("shshowcropmoneycalculation") { + description = "Show the calculation of the crop money" + category = CommandCategory.DEVELOPER_DEBUG + callback { CropMoneyDisplay.toggleShowCalculation() } + } + event.register("shcropspeedmeter") { + description = "Debugs how many crops you collect over time" + category = CommandCategory.DEVELOPER_DEBUG + callback { CropSpeedMeter.toggle() } + } + event.register("shworldedit") { + description = "Select regions in the world" + category = CommandCategory.DEVELOPER_DEBUG + callback { WorldEdit.command(it) } + autoComplete { listOf("copy", "reset", "help", "left", "right") } + } + event.register("shtestsackapi") { + description = "Get the amount of an item in sacks according to internal feature SackAPI" + category = CommandCategory.DEVELOPER_DEBUG + callback { SackAPI.testSackAPI(it) } + } + event.register("shtestgriffinspots") { + description = "Show potential griffin spots around you." + category = CommandCategory.DEVELOPER_DEBUG + callback { GriffinBurrowHelper.testGriffinSpots() } + } + event.register("shdebugprice") { + description = "Debug different price sources for an item." + category = CommandCategory.DEVELOPER_DEBUG + callback { ItemPriceUtils.debugItemPrice(it) } + } + event.register("shdebugscoreboard") { + description = "Monitors the scoreboard changes: " + + "Prints the raw scoreboard lines in the console after each update, with time since last update." + category = CommandCategory.DEVELOPER_DEBUG + callback { ScoreboardData.toggleMonitor() } + } + event.register("shcopyinternalname") { + description = "Copies the internal name of the item in hand to the clipboard." + category = CommandCategory.DEVELOPER_DEBUG + callback { SkyHanniDebugsAndTests.copyItemInternalName() } + } + event.register("shcopylocation") { + description = "Copies the player location as LorenzVec format to the clipboard" + category = CommandCategory.DEVELOPER_DEBUG + callback { SkyHanniDebugsAndTests.copyLocation(it) } + } + event.register("shcopyentities") { + description = "Copies entities in the specified radius around the player to the clipboard" + category = CommandCategory.DEVELOPER_DEBUG + callback { CopyNearbyEntitiesCommand.command(it) } + } + event.register("shcopytablist") { + description = "Copies the tab list data to the clipboard" + category = CommandCategory.DEVELOPER_DEBUG + callback { TabListData.copyCommand(it) } + } + event.register("shcopyactionbar") { + description = "Copies the action bar to the clipboard, including formatting codes" + category = CommandCategory.DEVELOPER_DEBUG + callback { CopyActionBarCommand.command(it) } + } + event.register("shcopyscoreboard") { + description = "Copies the scoreboard data to the clipboard" + category = CommandCategory.DEVELOPER_DEBUG + callback { CopyScoreboardCommand.command(it) } + } + event.register("shcopybossbar") { + description = "Copies the name of the bossbar to the clipboard, including formatting codes" + category = CommandCategory.DEVELOPER_DEBUG + callback { CopyBossbarCommand.command(it) } + } + event.register("shcopyitem") { + description = "Copies information about the item in hand to the clipboard" + category = CommandCategory.DEVELOPER_DEBUG + callback { CopyItemCommand.command() } + } + event.register("shcopyfoundburrowlocations") { + description = "Copy all ever found burrow locations to clipboard" + category = CommandCategory.DEVELOPER_DEBUG + callback { AllBurrowsList.copyToClipboard() } } } - private fun registerCommand(rawName: String, description: String, function: (Array) -> Unit) { - val name = rawName.lowercase() - if (commands.any { it.name == name }) { - error("The command '$name is already registered!'") + @Suppress("LongMethod") + private fun devTest(event: RegisterCommandsEvent) { + event.register("shtest") { + description = "Unused test command." + category = CommandCategory.DEVELOPER_TEST + callback { SkyHanniDebugsAndTests.testCommand(it) } + } + event.register("shchathistory") { + description = "Show the unfiltered chat history" + category = CommandCategory.DEVELOPER_TEST + callback { ChatManager.openChatFilterGUI(it) } + } + event.register("shreloadlocalrepo") { + description = "Reloading the local repo data" + category = CommandCategory.DEVELOPER_TEST + callback { SkyHanniMod.repo.reloadLocalRepo() } + } + event.register("shgraph") { + description = "Enables the graph editor" + category = CommandCategory.DEVELOPER_TEST + callback { GraphEditor.commandIn() } + } + event.register("shrepopatterns") { + description = "See where regexes are loaded from" + category = CommandCategory.DEVELOPER_TEST + callback { RepoPatternGui.open() } + } + event.register("shtestrabbitpaths") { + description = "Tests pathfinding to rabbit eggs. Use a number 0-14." + category = CommandCategory.DEVELOPER_TEST + callback { HoppityEggLocator.testPathfind(it) } + } + event.register("shtestitem") { + description = "test item internal name resolving" + category = CommandCategory.DEVELOPER_TEST + callback { SkyHanniDebugsAndTests.testItemCommand(it) } + } + event.register("shfindnullconfig") { + description = "Find config elements that are null and prints them into the console" + category = CommandCategory.DEVELOPER_TEST + callback { SkyHanniDebugsAndTests.findNullConfig(it) } + } + event.register("shtestwaypoint") { + description = "Set a waypoint on that location" + category = CommandCategory.DEVELOPER_TEST + callback { SkyHanniDebugsAndTests.waypoint(it) } + } + event.register("shtesttablist") { + description = "Set your clipboard as a fake tab list." + category = CommandCategory.DEVELOPER_TEST + callback { TabListData.toggleDebug() } + } + event.register("shstoplisteners") { + description = "Unregistering all loaded forge event listeners" + category = CommandCategory.DEVELOPER_TEST + callback { SkyHanniDebugsAndTests.stopListeners() } + } + event.register("shreloadlisteners") { + description = "Trying to load all forge event listeners again. Might not work at all" + category = CommandCategory.DEVELOPER_TEST + callback { SkyHanniDebugsAndTests.reloadListeners() } + } + event.register("shtracksounds") { + description = "Tracks the sounds for the specified duration (in seconds) and copies it to the clipboard" + category = CommandCategory.DEVELOPER_TEST + callback { TrackSoundsCommand.command(it) } + } + event.register("shtrackparticles") { + description = "Tracks the particles for the specified duration (in seconds) and copies it to the clipboard" + category = CommandCategory.DEVELOPER_TEST + callback { TrackParticlesCommand.command(it) } + } + event.register("shtestpacket") { + description = "Logs incoming and outgoing packets to the console" + category = CommandCategory.DEVELOPER_TEST + callback { PacketTest.command(it) } + } + event.register("shtestmessage") { + description = "Sends a custom chat message client side in the chat" + category = CommandCategory.DEVELOPER_TEST + callback { TestChatCommand.command(it) } + } + event.register("shtestrainbow") { + description = "Sends a rainbow in chat" + category = CommandCategory.DEVELOPER_TEST + callback { ExtendedChatColor.testCommand() } + } + event.register("shpartydebug") { + description = "List persons into the chat SkyHanni thinks are in your party." + category = CommandCategory.DEVELOPER_TEST + callback { PartyAPI.listMembers() } + } + event.register("shplaysound") { + description = "Play the specified sound effect at the given pitch and volume." + category = CommandCategory.DEVELOPER_TEST + callback { SoundUtils.command(it) } + } + event.register("shsendtitle") { + description = "Display a title on the screen with the specified settings." + category = CommandCategory.DEVELOPER_TEST + callback { TitleManager.command(it) } + } + event.register("shresetconfig") { + description = "Reloads the config manager and rendering processors of MoulConfig. " + + "This §cWILL RESET §7your config, but also updating the java config files " + + "(names, description, orderings and stuff)." + category = CommandCategory.DEVELOPER_TEST + callback { SkyHanniDebugsAndTests.resetConfigCommand() } + } + event.register("shreadcropmilestonefromclipboard") { + description = "Read crop milestone from clipboard. This helps fixing wrong crop milestone data" + category = CommandCategory.DEVELOPER_TEST + callback { GardenCropMilestonesCommunityFix.readDataFromClipboard() } + } + event.register("shaddfoundburrowlocationsfromclipboard") { + description = "Add all ever found burrow locations from clipboard" + category = CommandCategory.DEVELOPER_TEST + callback { AllBurrowsList.addFromClipboard() } + } + event.register("shtoggleegglocationdebug") { + description = "Shows Hoppity egg locations with their internal API names and status." + category = CommandCategory.DEVELOPER_TEST + callback { HoppityEggLocations.toggleDebug() } + } + event.register("shtranslateadvanced") { + description = "Translates a message in an inputted language to another inputted language." + category = CommandCategory.DEVELOPER_TEST + callback { Translator.translateAdvancedCommand(it) } + } + event.register("shconfigsave") { + description = "Manually saving the config" + category = CommandCategory.DEVELOPER_TEST + callback { SkyHanniMod.configManager.saveConfig(ConfigFileType.FEATURES, "manual-command") } + } + event.register("shtestburrow") { + description = "Sets a test burrow waypoint at your location" + category = CommandCategory.DEVELOPER_TEST + callback { GriffinBurrowHelper.setTestBurrow(it) } + } + event.register("shtestisland") { + description = "Sets the current skyblock island for testing purposes." + category = CommandCategory.DEVELOPER_TEST + callback { SkyBlockIslandTest.onCommand(it) } } - ClientCommandHandler.instance.registerCommand(SimpleCommand(name, createCommand(function))) - commands.add(CommandInfo(name, description, currentCategory)) } - private fun registerCommand0( - name: String, - description: String, - function: (Array) -> Unit, - autoComplete: ((Array) -> List) = { listOf() }, - ) { - val command = SimpleCommand( - name, - createCommand(function), - object : SimpleCommand.TabCompleteRunnable { - override fun tabComplete( - sender: ICommandSender?, - args: Array?, - pos: BlockPos?, - ): List { - return autoComplete(args ?: emptyArray()) - } - }, - ) - ClientCommandHandler.instance.registerCommand(command) - commands.add(CommandInfo(name, description, currentCategory)) + private fun internalCommands(event: RegisterCommandsEvent) { + event.register("shaction") { + description = "Internal command for chat click actions" + category = CommandCategory.INTERNAL + callback { ChatClickActionManager.onCommand(it) } + } } - private fun createCommand(function: (Array) -> Unit) = object : SimpleCommand.ProcessCommandRunnable() { - override fun processCommand(sender: ICommandSender?, args: Array?) { - if (args != null) function(args.asList().toTypedArray()) + private fun shortenedCommands(event: RegisterCommandsEvent) { + event.register("pko") { + description = "Kicks offline party members" + category = CommandCategory.SHORTENED_COMMANDS + callback { PartyCommands.kickOffline() } + } + event.register("pw") { + description = "Warps your party" + category = CommandCategory.SHORTENED_COMMANDS + callback { PartyCommands.warp() } + } + event.register("pk") { + description = "Kick a specific party member" + category = CommandCategory.SHORTENED_COMMANDS + callback { PartyCommands.kick(it) } + } + event.register("pt") { + description = "Transfer the party to another party member" + category = CommandCategory.SHORTENED_COMMANDS + callback { PartyCommands.transfer(it) } + } + event.register("pp") { + description = "Promote a specific party member" + category = CommandCategory.SHORTENED_COMMANDS + callback { PartyCommands.promote(it) } + } + event.register("pd") { + description = "Disbands the party" + category = CommandCategory.SHORTENED_COMMANDS + callback { PartyCommands.disband() } + } + event.register("rpt") { + description = "Reverse transfer party to the previous leader" + category = CommandCategory.SHORTENED_COMMANDS + callback { PartyCommands.reverseTransfer() } } } } diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/RegisterCommandsEvent.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/RegisterCommandsEvent.kt new file mode 100644 index 000000000000..448b5d836650 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/RegisterCommandsEvent.kt @@ -0,0 +1,16 @@ +package at.hannibal2.skyhanni.config.commands + +import at.hannibal2.skyhanni.api.event.SkyHanniEvent +import at.hannibal2.skyhanni.config.commands.Commands.commands +import net.minecraftforge.client.ClientCommandHandler + +object RegisterCommandsEvent : SkyHanniEvent() { + fun register(name: String, block: CommandBuilder.() -> Unit) { + val info = CommandBuilder(name).apply(block) + if (commands.any { it.name == name }) { + error("The command '$name is already registered!'") + } + ClientCommandHandler.instance.registerCommand(info.toSimpleCommand()) + commands.add(info) + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.kt index b8a5871b77a6..6240b43bf8e5 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.kt @@ -5,47 +5,26 @@ import net.minecraft.command.CommandBase import net.minecraft.command.ICommandSender import net.minecraft.util.BlockPos -class SimpleCommand : CommandBase { - - private val commandName: String - private val runnable: ProcessCommandRunnable - private var tabRunnable: TabCompleteRunnable? = null - - constructor(commandName: String, runnable: ProcessCommandRunnable) { - this.commandName = commandName - this.runnable = runnable - } - - constructor(commandName: String, runnable: ProcessCommandRunnable, tabRunnable: TabCompleteRunnable?) { - this.commandName = commandName - this.runnable = runnable - this.tabRunnable = tabRunnable - } - - abstract class ProcessCommandRunnable { - - abstract fun processCommand(sender: ICommandSender?, args: Array?) - } - - interface TabCompleteRunnable { - - fun tabComplete(sender: ICommandSender?, args: Array?, pos: BlockPos?): List - } +class SimpleCommand( + private val name: String, + private val aliases: List, + private val callback: (Array) -> Unit, + private val tabCallback: ((Array) -> List) = { emptyList() }, +) : CommandBase() { override fun canCommandSenderUseCommand(sender: ICommandSender) = true - - override fun getCommandName() = commandName - - override fun getCommandUsage(sender: ICommandSender) = "/$commandName" + override fun getCommandName() = name + override fun getCommandAliases() = aliases + override fun getCommandUsage(sender: ICommandSender) = "/$name" override fun processCommand(sender: ICommandSender, args: Array) { try { - runnable.processCommand(sender, args) + callback(args) } catch (e: Throwable) { - ErrorManager.logErrorWithData(e, "Error while running command /$commandName") + ErrorManager.logErrorWithData(e, "Error while running command /$name") } } override fun addTabCompletionOptions(sender: ICommandSender, args: Array, pos: BlockPos) = - if (tabRunnable != null) tabRunnable!!.tabComplete(sender, args, pos) else null + tabCallback(args).takeIf { it.isNotEmpty() } } diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/FarmingFortuneConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/FarmingFortuneConfig.java index 6eb4660d6010..a1cb92be0269 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/FarmingFortuneConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/FarmingFortuneConfig.java @@ -1,8 +1,8 @@ package at.hannibal2.skyhanni.config.features.garden; import at.hannibal2.skyhanni.config.FeatureToggle; -import at.hannibal2.skyhanni.config.commands.Commands; import at.hannibal2.skyhanni.config.core.config.Position; +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI; import com.google.gson.annotations.Expose; import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean; import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorButton; @@ -21,7 +21,7 @@ public class FarmingFortuneConfig { @ConfigOption(name = "Farming Fortune Guide", desc = "Open a guide that breaks down your Farming Fortune.\n§eCommand: /ff") @ConfigEditorButton(buttonText = "Open") - public Runnable open = Commands::openFortuneGuide; + public Runnable open = FFGuideGUI::onCommand; @Expose @ConfigLink(owner = FarmingFortuneConfig.class, field = "display") diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/gui/ModifyWordsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/gui/ModifyWordsConfig.java index 21cfee5c5c74..5a0db7ac4535 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/gui/ModifyWordsConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/gui/ModifyWordsConfig.java @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.config.features.gui; import at.hannibal2.skyhanni.config.FeatureToggle; -import at.hannibal2.skyhanni.config.commands.Commands; +import at.hannibal2.skyhanni.features.misc.visualwords.VisualWordGui; import com.google.gson.annotations.Expose; import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean; import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorButton; @@ -17,6 +17,6 @@ public class ModifyWordsConfig { @ConfigOption(name = "Open Config", desc = "Open the menu to setup the visual words.\n§eCommand: /shwords") @ConfigEditorButton(buttonText = "Open") - public Runnable open = Commands::openVisualWords; + public Runnable open = VisualWordGui::onCommand; } diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/HelpCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/HelpCommand.kt index 2eb5dc3fb893..ffffc7511c6e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/HelpCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/HelpCommand.kt @@ -1,6 +1,8 @@ package at.hannibal2.skyhanni.features.commands +import at.hannibal2.skyhanni.config.commands.CommandBuilder import at.hannibal2.skyhanni.config.commands.Commands +import at.hannibal2.skyhanni.config.commands.Commands.commands import at.hannibal2.skyhanni.utils.StringUtils.splitLines import at.hannibal2.skyhanni.utils.chat.Text import at.hannibal2.skyhanni.utils.chat.Text.hover @@ -12,7 +14,7 @@ object HelpCommand { private const val COMMANDS_PER_PAGE = 15 private const val HELP_ID = -6457563 - private fun createCommandEntry(command: Commands.CommandInfo): IChatComponent { + private fun createCommandEntry(command: CommandBuilder): IChatComponent { val category = command.category val color = category.color val description = command.description.splitLines(200).replace("§r", "§7") @@ -30,7 +32,7 @@ object HelpCommand { } } - private fun showPage(page: Int, search: String, commands: List) { + private fun showPage(page: Int, search: String, commands: List) { val filtered = commands.filter { it.name.contains(search, ignoreCase = true) || it.description.contains(search, ignoreCase = true) } @@ -47,7 +49,7 @@ object HelpCommand { ) { createCommandEntry(it) } } - fun onCommand(args: Array, commands: List) { + fun onCommand(args: Array) { val page: Int val search: String if (args.firstOrNull() == "-p") { diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt index 377d7bfd405f..5db28465e554 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt @@ -269,7 +269,7 @@ object CroesusChestTracker { fun resetChest() = croesusChests?.let { it.clear() it.addAll(generateMaxChest()) - ChatUtils.chat("Kismet State was cleared!") + ChatUtils.chat("Kismet State was Reset!") } @JvmStatic diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCollectionStats.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCollectionStats.kt index 6d201e57edcd..ead632ae6b0d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCollectionStats.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCollectionStats.kt @@ -520,9 +520,9 @@ object HoppityCollectionStats { } // bugfix for some weird potential user errors (e.g. if users play on alpha and get rabbits) - fun clearSavedRabbits() { + fun resetSavedRabbits() { loggedRabbits.clear() - ChatUtils.chat("Cleared saved rabbit data.") + ChatUtils.chat("Reset saved rabbit data.") } fun hasFoundRabbit(rabbit: String): Boolean = loggedRabbits.containsKey(rabbit) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt index 7e1800931c41..460b112540c6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt @@ -189,12 +189,18 @@ object GardenAPI { addItemStack(crop.icon.copy(), highlight = highlight, scale = scale) } - fun hideExtraGuis() = ComposterOverlay.inInventory || AnitaMedalProfit.inInventory || - SkyMartCopperPrice.inInventory || FarmingContestAPI.inInventory || VisitorAPI.inInventory || - FFGuideGUI.isInGui() || ChocolateShopPrice.inInventory || ChocolateFactoryAPI.inChocolateFactory || - ChocolateFactoryAPI.chocolateFactoryPaused || HoppityCollectionStats.inInventory - - fun clearCropSpeed() { + fun hideExtraGuis() = ComposterOverlay.inInventory || + AnitaMedalProfit.inInventory || + SkyMartCopperPrice.inInventory || + FarmingContestAPI.inInventory || + VisitorAPI.inInventory || + FFGuideGUI.isInGui() || + ChocolateShopPrice.inInventory || + ChocolateFactoryAPI.inChocolateFactory || + ChocolateFactoryAPI.chocolateFactoryPaused || + HoppityCollectionStats.inInventory + + fun resetCropSpeed() { storage?.cropsPerSecond?.clear() GardenBestCropTime.reset() updateGardenTool() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt index e8b2d55e4310..f3701c61a5e9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt @@ -387,6 +387,13 @@ object CaptureFarmingGear { } } + fun onResetGearCommand() { + val storage = GardenAPI.storage?.fortune ?: return + ChatUtils.chat("Resets farming items") + storage.farmingItems.clear() + storage.outdatedItems.clear() + } + @SubscribeEvent fun onConfigUpdaterMigratorConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(48, "#profile.garden.fortune.carrotFortune", "#profile.garden.fortune.carrolyn.CARROT") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt index 3771dd112db7..8912bd4d1618 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt @@ -5,6 +5,8 @@ import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.features.garden.fortuneguide.pages.CropPage import at.hannibal2.skyhanni.features.garden.fortuneguide.pages.OverviewPage import at.hannibal2.skyhanni.features.garden.fortuneguide.pages.UpgradePage +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.guide.GuideGUI import at.hannibal2.skyhanni.utils.guide.GuideTab import at.hannibal2.skyhanni.utils.renderables.Renderable @@ -20,6 +22,15 @@ class FFGuideGUI : GuideGUI(FortuneGuidePage.OVERVI companion object { + @JvmStatic + fun onCommand() { + if (!LorenzUtils.inSkyBlock) { + ChatUtils.userError("Join SkyBlock to open the fortune guide!") + } else { + open() + } + } + fun isInGui() = Minecraft.getMinecraft().currentScreen is FFGuideGUI fun open() { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt index 9948d5eeb973..1f9b2e66ffa7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt @@ -174,4 +174,28 @@ object UpdateManager { } private var potentialUpdate: PotentialUpdate? = null + + fun updateCommand(args: Array) { + val currentStream = SkyHanniMod.feature.about.updateStream.get() + val arg = args.firstOrNull() ?: "current" + val updateStream = when { + arg.equals("(?i)(?:full|release)s?".toRegex()) -> UpdateStream.RELEASES + arg.equals("(?i)(?:beta|latest)s?".toRegex()) -> UpdateStream.BETA + else -> currentStream + } + + val switchingToBeta = updateStream == UpdateStream.BETA && (currentStream != UpdateStream.BETA || !UpdateManager.isCurrentlyBeta()) + if (switchingToBeta) { + ChatUtils.clickableChat( + "Are you sure you want to switch to beta? These versions may be less stable.", + onClick = { + UpdateManager.checkUpdate(true, updateStream) + }, + "§eClick to confirm!", + oneTimeClick = true, + ) + } else { + UpdateManager.checkUpdate(true, updateStream) + } + } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt index b8de2eca6bd9..fb2f72bed4a6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt @@ -4,10 +4,12 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigFileType import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ChatUtils.chat import at.hannibal2.skyhanni.utils.GuiRenderUtils import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.KeyboardManager +import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.OSUtils import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.SoundUtils @@ -63,6 +65,16 @@ open class VisualWordGui : GuiScreen() { companion object { + @JvmStatic + fun onCommand() { + if (!LorenzUtils.onHypixel) { + ChatUtils.userError("You need to join Hypixel to use this feature!") + } else { + if (sbeConfigPath.exists()) drawImport = true + SkyHanniMod.screenToOpen = VisualWordGui() + } + } + fun isInGui() = Minecraft.getMinecraft().currentScreen is VisualWordGui var sbeConfigPath = File("." + File.separator + "config" + File.separator + "SkyblockExtras.cfg") var drawImport = false diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/PunchcardHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/PunchcardHighlight.kt index d1fcea62e871..a4068438f056 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/PunchcardHighlight.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/PunchcardHighlight.kt @@ -156,7 +156,7 @@ object PunchcardHighlight { RenderLivingEntityHelper.removeEntityColor(entity) } - fun clearList() { + fun onResetCommand() { playerList.clear() playerQueue.clear() if (config.reverse.get()) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt index acd37e9d5c14..defde1cf2b73 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt @@ -246,7 +246,7 @@ object SlayerProfitTracker { fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled - fun clearProfitCommand(args: Array) { + fun resetCommand() { if (itemLogCategory == "") { ChatUtils.userError( "No current slayer data found! " + diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt index fa6537046fc8..ae9b5e45b285 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt @@ -306,9 +306,9 @@ object SkyHanniDebugsAndTests { private var lastManualContestDataUpdate = SimpleTimeMark.farPast() - fun clearContestData() { + fun resetContestData() { if (lastManualContestDataUpdate.passedSince() < 30.seconds) { - ChatUtils.userError("§cYou already cleared Jacob's Contest data recently!") + ChatUtils.userError("§cYou already reset Jacob's Contest data recently!") return } lastManualContestDataUpdate = SimpleTimeMark.now() From e0ae2e8ad4602b3e96fb6ec39716709f225d2461 Mon Sep 17 00:00:00 2001 From: David Cole <40234707+DavidArthurCole@users.noreply.github.com> Date: Sun, 13 Oct 2024 09:54:05 -0400 Subject: [PATCH 6/7] Backend: Detekt Fixes Part 7 (#2667) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../at/hannibal2/skyhanni/api/SkillAPI.kt | 13 ++++++++-- .../skyhanni/config/ConfigManager.kt | 5 +++- .../skyhanni/config/ConfigUpdaterMigrator.kt | 5 +++- .../skyhanni/config/commands/Commands.kt | 15 +++++++----- .../at/hannibal2/skyhanni/data/BitsAPI.kt | 3 ++- .../at/hannibal2/skyhanni/data/ChatManager.kt | 4 +++- .../at/hannibal2/skyhanni/data/SackAPI.kt | 2 ++ .../data/hypixel/chat/PlayerChatManager.kt | 1 + .../skyhanni/data/mob/MobDetection.kt | 11 +++++---- .../hannibal2/skyhanni/data/mob/MobFilter.kt | 6 +++++ .../skyhanni/data/model/GraphNodeTag.kt | 9 ++++++- .../skyhanni/data/model/TabWidget.kt | 10 ++++---- .../hannibal2/skyhanni/data/repo/RepoUtils.kt | 3 ++- .../features/bingo/MinionCraftHelper.kt | 6 +++-- .../nextstephelper/BingoNextStepHelper.kt | 3 ++- .../skyhanni/features/chat/ChatFilter.kt | 5 +++- .../chat/CompactSplashPotionMessage.kt | 1 + .../features/chat/PowderMiningChatFilter.kt | 2 ++ .../features/chat/translation/Translator.kt | 4 ++-- .../skyhanni/features/combat/FlareDisplay.kt | 2 ++ .../combat/ghostcounter/GhostCounter.kt | 5 +++- .../skyhanni/features/dungeon/DungeonAPI.kt | 2 ++ .../features/dungeon/DungeonChatFilter.kt | 5 ++++ .../features/dungeon/DungeonHideItems.kt | 9 ++++++- .../dungeon/DungeonRankTabListColor.kt | 1 + .../event/carnival/CarnivalReminder.kt | 1 + .../features/event/diana/DianaFixChat.kt | 3 ++- .../event/diana/DianaProfitTracker.kt | 4 +++- .../diana/GriffinBurrowParticleFinder.kt | 15 ++++++++---- .../event/diana/InquisitorWaypointShare.kt | 1 + .../features/event/diana/SoopyGuessBurrow.kt | 1 + .../event/hoppity/HoppityEggsCompactChat.kt | 3 ++- .../event/hoppity/HoppityEventSummary.kt | 3 ++- .../waypoints/easter/EasterEggWaypoints.kt | 5 +++- .../skyhanni/features/fame/ReminderUtils.kt | 3 ++- .../features/fishing/ShowFishingItemName.kt | 2 ++ .../fishing/ThunderSparksHighlight.kt | 2 ++ .../fishing/trophy/GoldenFishTimer.kt | 2 ++ .../skyhanni/features/garden/CropType.kt | 3 ++- .../features/garden/FarmingFortuneDisplay.kt | 1 + .../features/garden/GardenCropMilestoneFix.kt | 1 + .../features/garden/GardenNextJacobContest.kt | 3 ++- .../features/garden/ToolTooltipTweaks.kt | 6 +++-- .../garden/farming/CropMoneyDisplay.kt | 3 ++- .../plots/GardenPlotMenuHighlighting.kt | 5 ++-- .../features/garden/pests/PestFinder.kt | 3 ++- .../visitor/GardenVisitorCompactChat.kt | 1 + .../garden/visitor/GardenVisitorFeatures.kt | 4 +++- .../gui/customscoreboard/ScoreboardPattern.kt | 1 + .../inventory/HideNotClickableItems.kt | 3 ++- .../inventory/ItemDisplayOverlayFeatures.kt | 6 ++--- .../SkyblockGuideHighlightFeature.kt | 6 ++--- .../ChocolateFactoryStrayTracker.kt | 1 + .../features/mining/DeepCavernsGuide.kt | 3 ++- .../mining/eventtracker/MiningEventType.kt | 24 ++++++++++++++----- .../mining/glacitemineshaft/CorpseTracker.kt | 5 +++- .../skyhanni/features/misc/CarryTracker.kt | 3 ++- .../skyhanni/features/misc/HideFarEntities.kt | 3 ++- .../skyhanni/features/misc/LesserOrbHider.kt | 2 ++ .../features/misc/NonGodPotEffectDisplay.kt | 1 + .../skyhanni/features/misc/ParticleHider.kt | 8 +++++-- .../misc/update/GuiOptionEditorUpdateCheck.kt | 5 +++- .../rift/area/dreadfarm/VoltHighlighter.kt | 1 + .../rift/area/mirrorverse/DanceRoomHelper.kt | 4 +++- .../area/westvillage/VerminHighlighter.kt | 4 +++- .../area/westvillage/kloon/KloonHacking.kt | 4 +++- .../features/rift/area/wyldwoods/RiftLarva.kt | 3 +++ .../rift/area/wyldwoods/RiftOdonata.kt | 3 +++ .../rift/everywhere/CruxTalismanDisplay.kt | 1 + .../everywhere/motes/ShowMotesNpcSellPrice.kt | 3 ++- .../features/skillprogress/SkillProgress.kt | 7 ++++-- .../features/skillprogress/SkillTooltip.kt | 3 ++- .../features/slayer/VampireSlayerFeatures.kt | 4 +++- .../slayer/enderman/EndermanSlayerFeatures.kt | 3 +++ .../at/hannibal2/skyhanni/test/WorldEdit.kt | 3 ++- .../skyhanni/utils/CollectionUtils.kt | 4 +--- .../hannibal2/skyhanni/utils/EntityUtils.kt | 5 +++- .../hannibal2/skyhanni/utils/UtilsPatterns.kt | 1 + .../skyhanni/utils/renderables/Renderable.kt | 18 ++++++++++++-- .../utils/repopatterns/RepoPatternManager.kt | 8 +++++-- .../tracker/SkyHanniBucketedItemTracker.kt | 5 +++- 81 files changed, 271 insertions(+), 91 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt index ba8e42d66ee5..95e39d1f73a7 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt @@ -324,7 +324,14 @@ object SkillAPI { val nextLevelDiff = levelArray.getOrNull(level)?.toDouble() ?: 7_600_000.0 val nextLevelProgress = nextLevelDiff * xpPercentage / 100 val totalXp = levelXp + nextLevelProgress - updateSkillInfo(existingLevel, level, nextLevelProgress.toLong(), nextLevelDiff.toLong(), totalXp.toLong(), matcher.group("gained")) + updateSkillInfo( + existingLevel, + level, + nextLevelProgress.toLong(), + nextLevelDiff.toLong(), + totalXp.toLong(), + matcher.group("gained"), + ) } else { val exactLevel = getLevelExact(needed) val levelXp = calculateLevelXp(existingLevel.level - 1).toLong() + current @@ -468,7 +475,9 @@ object SkillAPI { val skill = storage?.get(skillType) ?: return if (targetLevel <= skill.overflowLevel) { - ChatUtils.userError("Custom goal level ($targetLevel) must be greater than your current level (${skill.overflowLevel}).") + ChatUtils.userError( + "Custom goal level ($targetLevel) must be greater than your current level (${skill.overflowLevel})." + ) return } diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt index b00fc7a8f749..24a3748c6340 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt @@ -151,7 +151,10 @@ class ConfigManager { } if (missingConfigLink) { println("") - println("This crash is here to remind you to fix the missing @ConfigLink annotation over your new config position config element.") + println( + "This crash is here to remind you to fix the missing " + + "@ConfigLink annotation over your new config position config element." + ) println("") println("Steps to fix:") println("1. Search for `WEE WOO WEE WOO` in the console output.") diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt index c9ae8c2c7e89..f6d6c72de14d 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt @@ -81,7 +81,10 @@ object ConfigUpdaterMigrator { } val newParentElement = new.at(np.dropLast(1), true) if (newParentElement !is JsonObject) { - logger.log("Catastrophic: element at path $old could not be relocated to $new, since another element already inhabits that path") + logger.log( + "Catastrophic: element at path $old could not be relocated to $new, " + + "since another element already inhabits that path" + ) return } movesPerformed++ diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index 208beafe4966..89f314135541 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -174,8 +174,8 @@ object Commands { callback { GhostUtil.importCTGhostCounterData() } } event.register("shcroptime") { - description = "Calculates with your current crop per second speed " + - "how long you need to farm a crop to collect this amount of items" + description = + "Calculates with your current crop per second speed " + "how long you need to farm a crop to collect this amount of items" category = CommandCategory.USERS_ACTIVE callback { GardenCropTimeCommand.onCommand(it) } } @@ -205,8 +205,9 @@ object Commands { callback { FarmingWeightDisplay.lookUpCommand(it) } } event.register("shcopytranslation") { - description = "Copy the translation of a message in another language to your clipboard.\n" + - "Uses a language code that can be found at the end of a translation message." + description = + "Copy the translation of a message in another language to your clipboard.\n" + + "Uses a 2 letter language code that can be found at the end of a translation message." category = CommandCategory.USERS_ACTIVE callback { Translator.fromNativeLanguage(it) } } @@ -585,7 +586,8 @@ object Commands { callback { ItemPriceUtils.debugItemPrice(it) } } event.register("shdebugscoreboard") { - description = "Monitors the scoreboard changes: " + + description = + "Monitors the scoreboard changes: " + "Prints the raw scoreboard lines in the console after each update, with time since last update." category = CommandCategory.DEVELOPER_DEBUG callback { ScoreboardData.toggleMonitor() } @@ -740,7 +742,8 @@ object Commands { callback { TitleManager.command(it) } } event.register("shresetconfig") { - description = "Reloads the config manager and rendering processors of MoulConfig. " + + description = + "Reloads the config manager and rendering processors of MoulConfig. " + "This §cWILL RESET §7your config, but also updating the java config files " + "(names, description, orderings and stuff)." category = CommandCategory.DEVELOPER_TEST diff --git a/src/main/java/at/hannibal2/skyhanni/data/BitsAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/BitsAPI.kt index e9e58fa463d3..022a18d926e3 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/BitsAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/BitsAPI.kt @@ -68,7 +68,8 @@ object BitsAPI { private val bitsFromFameRankUpChatPattern by bitsChatGroup.pattern( "rankup.bits", - "§eYou gained §3(?.*) Bits Available §ecompounded from all your §epreviously eaten §6cookies§e! Click here to open §6cookie menu§e!", + "§eYou gained §3(?.*) Bits Available §ecompounded from all your " + + "§epreviously eaten §6cookies§e! Click here to open §6cookie menu§e!", ) private val fameRankUpPattern by bitsChatGroup.pattern( diff --git a/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt b/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt index 965b4af578b8..8780561921af 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt @@ -38,7 +38,9 @@ object ChatManager { private val loggerFilteredTypes = mutableMapOf() private val messageHistory = object : LinkedHashMap, MessageFilteringResult>() { - override fun removeEldestEntry(eldest: MutableMap.MutableEntry, MessageFilteringResult>?): Boolean { + override fun removeEldestEntry( + eldest: MutableMap.MutableEntry, MessageFilteringResult>?, + ): Boolean { return size > 100 } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt index 7581b3b1ec94..24dacafbd2ee 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt @@ -49,10 +49,12 @@ object SackAPI { "sack", "^(.* Sack|Enchanted .* Sack)\$", ) + @Suppress("MaxLineLength") private val numPattern by patternGroup.pattern( "number", "(?:(?:§[0-9a-f](?I{1,3})§7:)?|(?:§7Stored:)?) (?§[0-9a-f])(?[0-9.,kKmMbB]+)§7/(?\\d+(?:[0-9.,]+)?[kKmMbB]?)", ) + @Suppress("MaxLineLength") private val gemstonePattern by patternGroup.pattern( "gemstone", " §[0-9a-f](?[A-z]*): §[0-9a-f](?\\d+(?:\\.\\d+)?(?:(?:,\\d+)?)+[kKmM]?)(?: §[0-9a-f]\\(\\d+(?:\\.\\d+)?(?:(?:,\\d+)?)+[kKmM]?\\))?", diff --git a/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerChatManager.kt b/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerChatManager.kt index b6c0e16f9cca..5199e8b7e230 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerChatManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerChatManager.kt @@ -88,6 +88,7 @@ object PlayerChatManager { * REGEX-TEST: §b[MVP§c+§b] hannibal2§f§7 has §8[§6Heroic Aspect of the Void§8] * REGEX-TEST: §8[§b209§8] §b[MVP§d+§b] lrg89§f§7 is holding §8[§5Heroic Aspect of the Void§8] */ + @Suppress("MaxLineLength") private val itemShowPattern by patternGroup.pattern( "itemshow", "(?:§8\\[(?§.)(?\\d+)§8] )?(?.*)§f§7 (?is (?:holding|friends with a|wearing)|has) (?.*)" diff --git a/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt b/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt index b075ab312070..dbfbfe533d4b 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt @@ -355,11 +355,12 @@ object MobDetection { is S0FPacketSpawnMob -> addEntityUpdate(packet.entityID) is S0CPacketSpawnPlayer -> addEntityUpdate(packet.entityID) // is S0EPacketSpawnObject -> addEntityUpdate(packet.entityID) - is S01PacketJoinGame -> // one of the first packets that is sent when switching servers inside the BungeeCord Network (please some prove this, I just found it out via Testing) - { - shouldClear.set(true) - allEntitiesViaPacketId.clear() - } + is S01PacketJoinGame -> { + // one of the first packets that is sent when switching servers inside the BungeeCord Network + // (please some prove this, I just found it out via Testing) + shouldClear.set(true) + allEntitiesViaPacketId.clear() + } } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/mob/MobFilter.kt b/src/main/java/at/hannibal2/skyhanni/data/mob/MobFilter.kt index 5d6111336fbd..6938958e97b4 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/mob/MobFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/mob/MobFilter.kt @@ -120,14 +120,20 @@ object MobFilter { "^§8\\[§7Lv\\d+§8] §.(?Horse|Armadillo|Skeleton Horse|Pig|Rat)$", ) + // TODO: Move all of these to repo + @Suppress("MaxLineLength") internal const val RAT_SKULL = "ewogICJ0aW1lc3RhbXAiIDogMTYxODQxOTcwMTc1MywKICAicHJvZmlsZUlkIiA6ICI3MzgyZGRmYmU0ODU0NTVjODI1ZjkwMGY4OGZkMzJmOCIsCiAgInByb2ZpbGVOYW1lIiA6ICJCdUlJZXQiLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYThhYmI0NzFkYjBhYjc4NzAzMDExOTc5ZGM4YjQwNzk4YTk0MWYzYTRkZWMzZWM2MWNiZWVjMmFmOGNmZmU4IiwKICAgICAgIm1ldGFkYXRhIiA6IHsKICAgICAgICAibW9kZWwiIDogInNsaW0iCiAgICAgIH0KICAgIH0KICB9Cn0=" + @Suppress("MaxLineLength") private const val HELLWISP_TENTACLE_SKULL = "ewogICJ0aW1lc3RhbXAiIDogMTY0OTM4MzAyMTQxNiwKICAicHJvZmlsZUlkIiA6ICIzYjgwOTg1YWU4ODY0ZWZlYjA3ODg2MmZkOTRhMTVkOSIsCiAgInByb2ZpbGVOYW1lIiA6ICJLaWVyYW5fVmF4aWxpYW4iLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDI3MDQ2Mzg0OTM2MzhiODVjMzhkZDYzZmZkYmUyMjJmZTUzY2ZkNmE1MDk3NzI4NzU2MTE5MzdhZTViNWUyMiIsCiAgICAgICJtZXRhZGF0YSIgOiB7CiAgICAgICAgIm1vZGVsIiA6ICJzbGltIgogICAgICB9CiAgICB9CiAgfQp9" + @Suppress("MaxLineLength") private const val RIFT_EYE_SKULL1 = "ewogICJ0aW1lc3RhbXAiIDogMTY0ODA5MTkzNTcyMiwKICAicHJvZmlsZUlkIiA6ICJhNzdkNmQ2YmFjOWE0NzY3YTFhNzU1NjYxOTllYmY5MiIsCiAgInByb2ZpbGVOYW1lIiA6ICIwOEJFRDUiLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZjI2YmRlNDUwNDljN2I3ZDM0NjA1ZDgwNmEwNjgyOWI2Zjk1NWI4NTZhNTk5MWZkMzNlN2VhYmNlNDRjMDgzNCIsCiAgICAgICJtZXRhZGF0YSIgOiB7CiAgICAgICAgIm1vZGVsIiA6ICJzbGltIgogICAgICB9CiAgICB9CiAgfQp9" + @Suppress("MaxLineLength") private const val RIFT_EYE_SKULL2 = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTdkYjE5MjNkMDNjNGVmNGU5ZjZlODcyYzVhNmFkMjU3OGIxYWZmMmIyODFmYmMzZmZhNzQ2NmM4MjVmYjkifX19" + @Suppress("MaxLineLength") internal const val NPC_TURD_SKULL = "ewogICJ0aW1lc3RhbXAiIDogMTYzOTUxMjYxNzc5MywKICAicHJvZmlsZUlkIiA6ICIwZjczMDA3NjEyNGU0NGM3YWYxMTE1NDY5YzQ5OTY3OSIsCiAgInByb2ZpbGVOYW1lIiA6ICJPcmVfTWluZXIxMjMiLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNjM2MzBkOWIwMjA4OGVhMTkyNGE4NzIyNDJhYmM3NWI2MjYyYzJhY2E5MmFlY2Y4NzE0YTU3YTQxZWVhMGI5ZCIKICAgIH0KICB9Cn0=" diff --git a/src/main/java/at/hannibal2/skyhanni/data/model/GraphNodeTag.kt b/src/main/java/at/hannibal2/skyhanni/data/model/GraphNodeTag.kt index 8efcf4621e37..2873ac9a4a11 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/model/GraphNodeTag.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/model/GraphNodeTag.kt @@ -17,6 +17,7 @@ enum class GraphNodeTag( AREA("area", LorenzColor.DARK_GREEN, "Area", "A big SkyBlock area."), SMALL_AREA("small_area", LorenzColor.GREEN, "Small Area", "A small SkyBlock area, e.g. a house."), POI("poi", LorenzColor.WHITE, "Point of Interest", "A relevant spot or a landmark on the map."), + // LAUNCH_PAD("launch", LorenzColor.WHITE, "Launch Pad", "Slime blocks sending you to another server."), TELEPORT("teleport", LorenzColor.BLUE, "Teleport", "A spot from/to teleport."), @@ -42,7 +43,13 @@ enum class GraphNodeTag( // Rift RIFT_ENIGMA("rift_enigma", LorenzColor.DARK_PURPLE, "Enigma Soul", "Enigma Souls in the Rift.", onlyIsland = IslandType.THE_RIFT), - RIFT_BUTTONS_QUEST("rift_buttons_quest", LorenzColor.LIGHT_PURPLE, "Wooden Buttons", "A spot to hit wooden buttons for the Dreadfarm Enigma Soul.", onlyIsland = IslandType.THE_RIFT), + RIFT_BUTTONS_QUEST( + "rift_buttons_quest", + LorenzColor.LIGHT_PURPLE, + "Wooden Buttons", + "A spot to hit wooden buttons for the Dreadfarm Enigma Soul.", + onlyIsland = IslandType.THE_RIFT, + ), RIFT_EYE("rift_eye", LorenzColor.DARK_RED, "Rift Eye", "An Eye in the Rift to teleport to.", onlyIsland = IslandType.THE_RIFT), RIFT_MONTEZUMA( "rift_montezuma", diff --git a/src/main/java/at/hannibal2/skyhanni/data/model/TabWidget.kt b/src/main/java/at/hannibal2/skyhanni/data/model/TabWidget.kt index 85c50528f4e4..e5939c3f758d 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/model/TabWidget.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/model/TabWidget.kt @@ -423,11 +423,13 @@ enum class TabWidget( val removeIndexes = mutableListOf() for ((index, header) in headers) when { - PLAYER_LIST.pattern.matches(header) -> if (playerListFound) removeIndexes.add(index - removeIndexes.size) else playerListFound = - true + PLAYER_LIST.pattern.matches(header) -> + if (playerListFound) removeIndexes.add(index - removeIndexes.size) + else playerListFound = true - INFO.pattern.matches(header) -> if (infoFound) removeIndexes.add(index - removeIndexes.size) else infoFound = - true + INFO.pattern.matches(header) -> + if (infoFound) removeIndexes.add(index - removeIndexes.size) + else infoFound = true } return tabList.transformIf({ size > 81 }, { dropLast(size - 80) }).editCopy { diff --git a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt index 74241946faf2..71c545912803 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt @@ -48,7 +48,8 @@ object RepoUtils { File(newFile.parent).mkdirs() if (!isInTree(dir, newFile)) { throw RuntimeException( - "SkyHanni detected an invalid zip file. This is a potential security risk, please report this on the SkyHanni discord." + "SkyHanni detected an invalid zip file. This is a potential security risk, " + + "please report this on the SkyHanni discord." ) } val fos = FileOutputStream(newFile) 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 6f7a062f85e5..b476a116001e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt @@ -98,7 +98,8 @@ object MinionCraftHelper { return newDisplay } - private fun loadFromInventory(mainInventory: Array): Pair, MutableMap> { + private fun loadFromInventory(mainInventory: Array): + Pair, MutableMap> { init() val minions = mutableMapOf() @@ -144,7 +145,8 @@ object MinionCraftHelper { if (ingredientInternalName == internalName) return true val ingredientPrimitive = NEUItems.getPrimitiveMultiplier(ingredientInternalName) - if (primitiveStack.internalName == ingredientPrimitive.internalName && primitiveStack.amount < ingredientPrimitive.amount) return true + if (primitiveStack.internalName == ingredientPrimitive.internalName && + primitiveStack.amount < ingredientPrimitive.amount) return true } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt index 69602ec70765..d233387cd2e1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt @@ -167,7 +167,8 @@ object BingoNextStepHelper { } } } - if (currentStep is PartialProgressItemsStep && currentStep.displayName == RHYS_TASK_NAME && event.message == "§e[NPC] §dRhys§f: §rThank you for the items!§r") { + if (currentStep is PartialProgressItemsStep && currentStep.displayName == RHYS_TASK_NAME && + event.message == "§e[NPC] §dRhys§f: §rThank you for the items!§r") { currentStep.amountHavingHidden -= 10 } } 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 28a2b4b4f081..e32769cf615f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt @@ -29,6 +29,7 @@ object ChatFilter { // // Lobby Messages + @Suppress("MaxLineLength") private val lobbyPatterns = listOf( // player join "(?: §b>§c>§a>§r §r)?.* §6(?:joined|(?:spooked|slid) into) the lobby!(?:§r §a<§c<§b<)?".toPattern(), @@ -159,6 +160,7 @@ object ChatFilter { ) // Slayer Drop + @Suppress("MaxLineLength") private val slayerDropPatterns = listOf( // Zombie "§b§lRARE DROP! §r§7\\(§r§f§r§9Revenant Viscera§r§7\\) (.*)".toPattern(), @@ -263,6 +265,7 @@ object ChatFilter { ) // Annoying Spam + @Suppress("MaxLineLength") private val annoyingSpamPatterns = listOf( "§7Your Implosion hit (.*) for §r§c(.*) §r§7damage.".toPattern(), "§7Your Molten Wave hit (.*) for §r§c(.*) §r§7damage.".toPattern(), @@ -520,7 +523,7 @@ object ChatFilter { * @param message The message to check * @return The reason why the message was blocked, empty if not blocked */ - @Suppress("CyclomaticComplexMethod") + @Suppress("CyclomaticComplexMethod", "MaxLineLength") private fun block(message: String): String? = when { config.hypixelHub && message.isPresent("lobby") -> "lobby" config.empty && StringUtils.isEmpty(message) -> "empty" diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt index 7547ae6ab24b..745116d16f44 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt @@ -15,6 +15,7 @@ object CompactSplashPotionMessage { private val config get() = SkyHanniMod.feature.chat.compactPotionMessages + @Suppress("MaxLineLength") private val potionEffectPatternList = listOf( "§a§lBUFF! §fYou were splashed by (?.*) §fwith §r(?.*)§r§f! Press TAB or type /effects to view your active effects!".toPattern(), "§a§lBUFF! §fYou have gained §r(?.*)§r§f! Press TAB or type /effects to view your active effects!".toPattern(), diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/PowderMiningChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/PowderMiningChatFilter.kt index 61658a9de62e..22db96d30882 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/PowderMiningChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/PowderMiningChatFilter.kt @@ -64,6 +64,7 @@ object PowderMiningChatFilter { * REGEX-TEST: §cYou need a tool with a §r§aBreaking Power §r§cof §r§66§r§c to mine Ruby Gemstone Block§r§c! Speak to §r§dFragilis §r§cby the entrance to the Crystal Hollows to learn more! * REGEX-TEST: §cYou need a tool with a §r§aBreaking Power §r§cof §r§64§r§c to mine Mithril§r§c! Speak to §r§dFragilis §r§cby the entrance to the Crystal Hollows to learn more! */ + @Suppress("MaxLineLength") private val breakingPowerPattern by patternGroup.pattern( "warning.breakingpower", "§cYou need a tool with a §r§aBreaking Power §r§cof (?:§.)*\\d+§r§c to mine .+", @@ -217,6 +218,7 @@ object PowderMiningChatFilter { * REGEX-TEST: §r§9Electron Transmitter * REGEX-TEST: §r§9Superlite Motor */ + @Suppress("MaxLineLength") private val robotPartsPattern by patternGroup.pattern( "reward.robotparts", "§r§9(?:FTX 3070|Synthetic Heart|Control Switch|Robotron Reflector|Electron Transmitter|Superlite Motor)( §r§8x(?[\\d,]+))?", diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/translation/Translator.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/translation/Translator.kt index ca827432fad9..b4e434c1a2d1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/translation/Translator.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/translation/Translator.kt @@ -119,8 +119,8 @@ object Translator { sourceLanguage: String = "auto", ): Array? { // TODO add &dj=1 to use named json - val url = "https://translate.googleapis.com/translate_a/single?client=gtx&dt=t&sl=$sourceLanguage&tl=$targetLanguage&q=" + - URLEncoder.encode(message, "UTF-8") + val encode = URLEncoder.encode(message, "UTF-8") + val url = "https://translate.googleapis.com/translate_a/single?client=gtx&dt=t&sl=$sourceLanguage&tl=$targetLanguage&q=$encode" var messageToSend = "" val fullResponse = getJSONResponse(url).asJsonArray diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/FlareDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/FlareDisplay.kt index c5804ea37c40..93f9f0452ffe 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/FlareDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/FlareDisplay.kt @@ -42,6 +42,8 @@ object FlareDisplay { private val MAX_FLARE_TIME = 3.minutes + // TODO: Move to repo + @Suppress("MaxLineLength") private val flareSkins = mapOf( "ewogICJ0aW1lc3RhbXAiIDogMTY0NjY4NzMwNjIyMywKICAicHJvZmlsZUlkIiA6ICI0MWQzYWJjMmQ3NDk0MDBjOTA5MGQ1NDM0ZDAzODMxYiIsCiAgInByb2ZpbGVOYW1lIiA6ICJNZWdha2xvb24iLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMjJlMmJmNmMxZWMzMzAyNDc5MjdiYTYzNDc5ZTU4NzJhYzY2YjA2OTAzYzg2YzgyYjUyZGFjOWYxYzk3MTQ1OCIKICAgIH0KICB9Cn0=" to FlareType.WARNING, diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt index 2ef652e4a93a..fe14093ef9d7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt @@ -81,6 +81,8 @@ object GhostCounter { "skillxp", "[+](?[0-9,.]+) \\((?[0-9,.]+)(?:/(?[0-9,.]+))?\\)", ) + + @Suppress("MaxLineLength") private val combatSectionPattern by patternGroup.pattern( "combatsection", ".*[+](?[0-9,.]+) (?[A-Za-z]+) \\((?(?[0-9.,]+)/(?[0-9.,]+)|(?[0-9.]+)%)\\).*", @@ -282,7 +284,8 @@ object GhostCounter { val moneyMadeTips = buildList { for ((name, count, value) in priceMap) { moneyMade += (count.toLong() * value.toLong()) - add("$name: §b${value.addSeparators()} §fx §b${count.addSeparators()} §f= §6${(value.toLong() * count.toLong()).addSeparators()}") + add("$name: §b${value.addSeparators()} §fx §b${count.addSeparators()} §f= " + + "§6${(value.toLong() * count.toLong()).addSeparators()}") } add("§bTotal: §6${moneyMade.addSeparators()}") add("§eClick to copy to clipboard!") diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt index 7ea372b20d33..254e04dca523 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt @@ -63,6 +63,8 @@ object DungeonAPI { val bossStorage: MutableMap? get() = ProfileStorageData.profileSpecific?.dungeons?.bosses private val patternGroup = RepoPattern.group("dungeon") + // TODO: Move to repo + @Suppress("MaxLineLength") private const val WITHER_ESSENCE_TEXTURE = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzRkYjRhZGZhOWJmNDhmZjVkNDE3MDdhZTM0ZWE3OGJkMjM3MTY1OWZjZDhjZDg5MzQ3NDlhZjRjY2U5YiJ9fX0=" diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonChatFilter.kt index 1a566c22579d..6b992e798690 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonChatFilter.kt @@ -25,6 +25,7 @@ object DungeonChatFilter { private val endMessagesEndWith = listOf( " Experience §r§b(Team Bonus)" ) + @Suppress("MaxLineLength") private val abilityPatterns = listOf( "§7Your Guided Sheep hit §r§c(.*) §r§7enemy for §r§c(.*) §r§7damage.".toPattern(), "§a§lBUFF! §fYou were splashed by (.*) §fwith §r§cHealing VIII§r§f!".toPattern(), @@ -99,11 +100,13 @@ object DungeonChatFilter { private val buffMessages = listOf( "§a§lBUFF! §fYou have gained §r§cHealing V§r§f!" ) + @Suppress("MaxLineLength") private val puzzlePatterns = listOf( "§a§lPUZZLE SOLVED! (.*) §r§ewasn't fooled by §r§c(.*)§r§e! §r§4G§r§co§r§6o§r§ed§r§a §r§2j§r§bo§r§3b§r§5!".toPattern(), "§a§lPUZZLE SOLVED! (.*) §r§etied Tic Tac Toe! §r§4G§r§co§r§6o§r§ed§r§a §r§2j§r§bo§r§3b§r§5!".toPattern(), "§4\\[STATUE] Oruo the Omniscient§r§f: §r(.*) §r§fthinks the answer is §r§6 . §r(.*)§r§f! §r§fLock in your party's answer in my Chamber!".toPattern(), ) + @Suppress("MaxLineLength") private val puzzleMessages = listOf( "§4[STATUE] Oruo the Omniscient§r§f: §r§fThough I sit stationary in this prison that is §r§cThe Catacombs§r§f, my knowledge knows no bounds.", "§4[STATUE] Oruo the Omniscient§r§f: §r§fProve your knowledge by answering 3 questions and I shall reward you in ways that transcend time!", @@ -122,6 +125,7 @@ object DungeonChatFilter { "§e§lRIGHT CLICK §r§7on §r§7a §r§8WITHER §r§7door§r§7 to open it. This key can only be used to open §r§a1§r§7 door!", "§e§lRIGHT CLICK §r§7on §r§7the §r§cBLOOD DOOR§r§7 to open it. This key can only be used to open §r§a1§r§7 door!" ) + @Suppress("MaxLineLength") private val pickupPatterns = listOf( "(.*) §r§ehas obtained §r§a§r§9Superboom TNT§r§e!".toPattern(), "(.*) §r§ehas obtained §r§a§r§9Superboom TNT §r§8x2§r§e!".toPattern(), @@ -160,6 +164,7 @@ object DungeonChatFilter { "(.*)§a is now ready!".toPattern(), "§aDungeon starts in (.*) seconds.".toPattern(), ) + @Suppress("MaxLineLength") private val prepareMessages = listOf( "§aYour active Potion Effects have been paused and stored. They will be restored when you leave Dungeons! You are not allowed to use existing Potion Effects while in Dungeons.", "§aDungeon starts in 1 second.", 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 4f29aca52eac..967af0dd3d4b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt @@ -29,25 +29,32 @@ object DungeonHideItems { private val movingSkeletonSkulls = mutableMapOf() // TODO put in skull data repo part - + @Suppress("MaxLineLength") private const val SOUL_WEAVER_HIDER = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMmYyNGVkNjg3NTMwNGZhNGExZjBjNzg1YjJjYjZhNmE3MjU2M2U5ZjNlMjRlYTU1ZTE4MTc4NDUyMTE5YWE2NiJ9fX0=" + @Suppress("MaxLineLength") private const val BLESSING_TEXTURE = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTkzZTIwNjg2MTc4NzJjNTQyZWNkYTFkMjdkZjRlY2U5MWM2OTk5MDdiZjMyN2M0ZGRiODUzMDk0MTJkMzkzOSJ9fX0=" + @Suppress("MaxLineLength") private const val REVIVE_STONE_TEXTURE = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjZhNzZjYzIyZTdjMmFiOWM1NDBkMTI0NGVhZGJhNTgxZjVkZDllMThmOWFkYWNmMDUyODBhNWI0OGI4ZjYxOCJ9fX0K" + @Suppress("MaxLineLength") private const val PREMIUM_FLESH_TEXTURE = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMWE3NWU4YjA0NGM3MjAxYTRiMmU4NTZiZTRmYzMxNmE1YWFlYzY2NTc2MTY5YmFiNTg3MmE4ODUzNGI4MDI1NiJ9fX0K" + @Suppress("MaxLineLength") private const val ABILITY_ORB_TEXTURE = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTAxZTA0MGNiMDFjZjJjY2U0NDI4MzU4YWUzMWQyZTI2NjIwN2M0N2NiM2FkMTM5NzA5YzYyMDEzMGRjOGFkNCJ9fX0=" + @Suppress("MaxLineLength") private const val SUPPORT_ORB_TEXTURE = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTMxYTRmYWIyZjg3ZGI1NDMzMDEzNjUxN2I0NTNhYWNiOWQ3YzBmZTc4NDMwMDcwOWU5YjEwOWNiYzUxNGYwMCJ9fX0=" + @Suppress("MaxLineLength") private const val DAMAGE_ORB_TEXTURE = "eyJ0aW1lc3RhbXAiOjE1NzQ5NTEzMTkwNDQsInByb2ZpbGVJZCI6IjE5MjUyMWI0ZWZkYjQyNWM4OTMxZjAyYTg0OTZlMTFiIiwicHJvZmlsZU5hbWUiOiJTZXJpYWxpemFibGUiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2FiODZkYTJlMjQzYzA1ZGMwODk4YjBjYzVkM2U2NDg3NzE3MzE3N2UwYTIzOTQ0MjVjZWMxMDAyNTljYjQ1MjYifX19" + @Suppress("MaxLineLength") private const val HEALER_FAIRY_TEXTURE = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTZjM2UzMWNmYzY2NzMzMjc1YzQyZmNmYjVkOWE0NDM0MmQ2NDNiNTVjZDE0YzljNzdkMjczYTIzNTIifX19" diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonRankTabListColor.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonRankTabListColor.kt index 3968a3d18a87..17eca4a58cfa 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonRankTabListColor.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonRankTabListColor.kt @@ -21,6 +21,7 @@ object DungeonRankTabListColor { * REGEX-TEST: §8[§r§9319§r§8] §r§bEmpa_ §r§7α §r§f(§r§dMage XXXIV§r§f) * REGEX-TEST: §8[§r§5393§r§8] §r§c[§r§fYOUTUBE§r§c] Remittal§r§f §r§7Σ§r§7♲ §r§f(§r§dMage XL§r§f) */ + @Suppress("MaxLineLength") private val pattern by patternGroup.pattern( "rank", "^(?:§.)*(?\\[(?:§.)*\\d+(?:§.)*]) (?(?:§.)*\\[(?:§.)*[^]]+(?:§.)*])? ?(?\\S+) (?[^(]*)\\((?:§.)*(?\\S+) (?[CLXVI]+)(?:§.)*\\)(?:§.)*$" diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/carnival/CarnivalReminder.kt b/src/main/java/at/hannibal2/skyhanni/features/event/carnival/CarnivalReminder.kt index d77861872d6d..024d1446451c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/carnival/CarnivalReminder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/carnival/CarnivalReminder.kt @@ -49,6 +49,7 @@ object CarnivalReminder { /** REGEX-TEST: §e[NPC] §aCarnival Leader§f: §rYou've already claimed your §aCarnival Tickets §ffor §btoday§f, but I'm happy to answer any questions you might have. */ + @Suppress("MaxLineLength") private val alreadyClaimedPattern by repoGroup.pattern( "already", "§e\\[NPC\\] §aCarnival Leader§f: §rYou've already claimed your §aCarnival Tickets §ffor §btoday§f, but I'm happy to answer any questions you might have.", diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaFixChat.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaFixChat.kt index aefce4e58088..3316d966d020 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaFixChat.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaFixChat.kt @@ -59,7 +59,8 @@ object DianaFixChat { errorCounter++ if (errorCounter == 1) { if (successfulCounter < 5) { - ChatUtils.chat("Could not find Diana Guess using sound and particles, please try again. (Was this a funny sound easter egg?)") + ChatUtils.chat("Could not find Diana Guess using sound and particles, " + + "please try again. (Was this a funny sound easter egg?)") } return } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt index fb90de9e118e..cd9f48b62c25 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt @@ -139,7 +139,9 @@ object DianaProfitTracker { tryHide(event) } - if (message == "§6§lRARE DROP! §r§eYou dug out a §r§9Griffin Feather§r§e!" || message == "§eFollow the arrows to find the §r§6treasure§r§e!") { + if (message == "§6§lRARE DROP! §r§eYou dug out a §r§9Griffin Feather§r§e!" || + message == "§eFollow the arrows to find the §r§6treasure§r§e!" + ) { BurrowAPI.lastBurrowRelatedChatMessage = SimpleTimeMark.now() tryHide(event) } 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 f3860276ad47..a082dfaac6b0 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 @@ -93,20 +93,25 @@ object GriffinBurrowParticleFinder { private enum class ParticleType(val check: S2APacketParticles.() -> Boolean) { EMPTY({ - particleType == net.minecraft.util.EnumParticleTypes.CRIT_MAGIC && particleCount == 4 && particleSpeed == 0.01f && xOffset == 0.5f && yOffset == 0.1f && zOffset == 0.5f + particleType == net.minecraft.util.EnumParticleTypes.CRIT_MAGIC && + particleCount == 4 && particleSpeed == 0.01f && xOffset == 0.5f && yOffset == 0.1f && zOffset == 0.5f }), MOB({ - particleType == net.minecraft.util.EnumParticleTypes.CRIT && particleCount == 3 && particleSpeed == 0.01f && xOffset == 0.5f && yOffset == 0.1f && zOffset == 0.5f + particleType == net.minecraft.util.EnumParticleTypes.CRIT && + particleCount == 3 && particleSpeed == 0.01f && xOffset == 0.5f && yOffset == 0.1f && zOffset == 0.5f }), TREASURE({ - particleType == net.minecraft.util.EnumParticleTypes.DRIP_LAVA && particleCount == 2 && particleSpeed == 0.01f && xOffset == 0.35f && yOffset == 0.1f && zOffset == 0.35f + particleType == net.minecraft.util.EnumParticleTypes.DRIP_LAVA && + particleCount == 2 && particleSpeed == 0.01f && xOffset == 0.35f && yOffset == 0.1f && zOffset == 0.35f }), FOOTSTEP({ - particleType == net.minecraft.util.EnumParticleTypes.FOOTSTEP && particleCount == 1 && particleSpeed == 0.0f && xOffset == 0.05f && yOffset == 0.0f && zOffset == 0.05f + particleType == net.minecraft.util.EnumParticleTypes.FOOTSTEP && + particleCount == 1 && particleSpeed == 0.0f && xOffset == 0.05f && yOffset == 0.0f && zOffset == 0.05f }), ENCHANT({ - particleType == net.minecraft.util.EnumParticleTypes.ENCHANTMENT_TABLE && particleCount == 5 && particleSpeed == 0.05f && xOffset == 0.5f && yOffset == 0.4f && zOffset == 0.5f + particleType == net.minecraft.util.EnumParticleTypes.ENCHANTMENT_TABLE && + particleCount == 5 && particleSpeed == 0.05f && xOffset == 0.5f && yOffset == 0.4f && zOffset == 0.5f }); companion object { 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 2d0e2a809e81..8e72e37d00f8 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 @@ -53,6 +53,7 @@ object InquisitorWaypointShare { /** * REGEX-TEST: §9Party §8> UserName§f: §rA MINOS INQUISITOR has spawned near [Foraging Island ] at Coords 1 2 3 */ + @Suppress("MaxLineLength") private val partyInquisitorCheckerPattern by patternGroup.pattern( "party.inquisitorchecker", "(?§9Party §8> )?(?.+)§f: §rA MINOS INQUISITOR has spawned near \\[(?.*)] at Coords (?[^ ]+) (?[^ ]+) (?[^ ]+)" 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 35016eda3740..477371ec2107 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 @@ -136,6 +136,7 @@ object SoopyGuessBurrow { } } + @Suppress("MaxLineLength") private fun solveEquationThing(x: LorenzVec, y: LorenzVec): LorenzVec { val a = (-y.x * x.y * x.x - y.y * x.y * x.z + y.y * x.y * x.x + x.y * x.z * y.z + x.x * x.z * y.x - x.x * x.z * y.z) / (x.y * y.x - x.y * y.z + x.x * y.z - y.x * x.z + y.y * x.z - y.y * x.x) diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsCompactChat.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsCompactChat.kt index 9b9276420efe..23f76c74d29f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsCompactChat.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsCompactChat.kt @@ -102,7 +102,8 @@ object HoppityEggsCompactChat { val showDupeRarity = rarityConfig.let { it == RarityType.BOTH || it == RarityType.DUPE } val timeStr = if (config.showDuplicateTime) ", §a+§b$timeFormatted§7" else "" - "$mealNameFormat! §7Duplicate ${if (showDupeRarity) "$lastRarity " else ""}$lastName$dupeNumberFormat §7(§6+$format Chocolate§7$timeStr)" + "$mealNameFormat! §7Duplicate ${if (showDupeRarity) "$lastRarity " else ""}" + + "$lastName$dupeNumberFormat §7(§6+$format Chocolate§7$timeStr)" } else if (newRabbit) { val showNewRarity = rarityConfig.let { it == RarityType.BOTH || it == RarityType.NEW } "$mealNameFormat! §d§lNEW ${if (showNewRarity) "$lastRarity " else ""}$lastName §7($lastProfit§7)" diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEventSummary.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEventSummary.kt index 4a536465c28f..41d5142d8ca4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEventSummary.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEventSummary.kt @@ -205,7 +205,8 @@ object HoppityEventSummary { val parsedInt: Int? = if (it.size == 1) it[0].toIntOrNull() else null - val availableYearsFormat = "§eHoppity Event Stats are available for the following years:§r\n${statsYearFormatList.joinToString("§e, ") { it }}" + val availableYearsFormat = + "§eHoppity Event Stats are available for the following years:§r\n${statsYearFormatList.joinToString("§e, ") { it }}" if (parsedInt == null) { if (HoppityAPI.isHoppityEvent()) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EasterEggWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EasterEggWaypoints.kt index 8250b023db10..7f0b208e7976 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EasterEggWaypoints.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EasterEggWaypoints.kt @@ -29,7 +29,10 @@ object EasterEggWaypoints { if (!isEnabled()) return val message = event.message - if (message.startsWith("§a§lYou found an Easter Egg! §r") || message == "§aYou have received the §bsuper reward§a!" || message == "§cYou already found this egg!") { + if (message.startsWith("§a§lYou found an Easter Egg! §r") || + message == "§aYou have received the §bsuper reward§a!" || + message == "§cYou already found this egg!" + ) { val egg = EasterEgg.entries.minByOrNull { it.waypoint.distanceSqToPlayer() }!! egg.found = true if (closest == egg) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/fame/ReminderUtils.kt b/src/main/java/at/hannibal2/skyhanni/features/fame/ReminderUtils.kt index 19e0399ad269..b39a26c4f54b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fame/ReminderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fame/ReminderUtils.kt @@ -11,7 +11,8 @@ object ReminderUtils { // TODO: add arachne fight, add slayer boss spawned, add dragon fight fun isBusy(ignoreFarmingContest: Boolean = false): Boolean = - (DungeonAPI.inDungeon() && !DungeonAPI.completed) || LorenzUtils.inKuudraFight || (FarmingContestAPI.inContest && !ignoreFarmingContest) || + (DungeonAPI.inDungeon() && !DungeonAPI.completed) || + LorenzUtils.inKuudraFight || (FarmingContestAPI.inContest && !ignoreFarmingContest) || RiftAPI.inRift() || IslandType.DARK_AUCTION.isInIsland() || IslandType.MINESHAFT.isInIsland() || IslandType.NONE.isInIsland() || IslandType.UNKNOWN.isInIsland() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/ShowFishingItemName.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/ShowFishingItemName.kt index 514d330a4bee..c25974292321 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/ShowFishingItemName.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/ShowFishingItemName.kt @@ -27,6 +27,8 @@ object ShowFishingItemName { private var itemsOnGround = TimeLimitedCache(750.milliseconds) // Taken from Skytils + // TODO? Move to repo + @Suppress("MaxLineLength") private val cheapCoins = setOf( "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNTM4MDcxNzIxY2M1YjRjZDQwNmNlNDMxYTEzZjg2MDgzYTg5NzNlMTA2NGQyZjg4OTc4Njk5MzBlZTZlNTIzNyJ9fX0=", "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZGZhMDg3ZWI3NmU3Njg3YTgxZTRlZjgxYTdlNjc3MjY0OTk5MGY2MTY3Y2ViMGY3NTBhNGM1ZGViNmM0ZmJhZCJ9fX0=", diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/ThunderSparksHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/ThunderSparksHighlight.kt index b84ee2970b0d..3ddb00d37050 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/ThunderSparksHighlight.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/ThunderSparksHighlight.kt @@ -26,6 +26,8 @@ import java.awt.Color object ThunderSparksHighlight { private val config get() = SkyHanniMod.feature.fishing.thunderSpark + // TODO: Move to repo + @Suppress("MaxLineLength") private const val TEXTURE = "ewogICJ0aW1lc3RhbXAiIDogMTY0MzUwNDM3MjI1NiwKICAicHJvZmlsZUlkIiA6ICI2MzMyMDgwZTY3YTI0Y2MxYjE3ZGJhNzZmM2MwMGYxZCIsCiAgInByb2ZpbGVOYW1lIiA6ICJUZWFtSHlkcmEiLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvN2IzMzI4ZDNlOWQ3MTA0MjAzMjI1NTViMTcyMzkzMDdmMTIyNzBhZGY4MWJmNjNhZmM1MGZhYTA0YjVjMDZlMSIsCiAgICAgICJtZXRhZGF0YSIgOiB7CiAgICAgICAgIm1vZGVsIiA6ICJzbGltIgogICAgICB9CiAgICB9CiAgfQp9" private val sparks = mutableListOf() diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/GoldenFishTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/GoldenFishTimer.kt index b7c67034feab..dd023a7fadf3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/GoldenFishTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/GoldenFishTimer.kt @@ -93,6 +93,8 @@ object GoldenFishTimer { handle() } + // TODO: Move to repo + @Suppress("MaxLineLength") private const val GOLDEN_FISH_SKULL_TEXTURE = "ewogICJ0aW1lc3RhbXAiIDogMTY0MzgzMTA2MDE5OCwKICAicHJvZmlsZUlkIiA6ICJiN2ZkYmU2N2NkMDA0NjgzYjlmYTllM2UxNzczODI1NCIsCiAgInByb2ZpbGVOYW1lIiA6ICJDVUNGTDE0IiwKICAic2lnbmF0dXJlUmVxdWlyZWQiIDogdHJ1ZSwKICAidGV4dHVyZXMiIDogewogICAgIlNLSU4iIDogewogICAgICAidXJsIiA6ICJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzEyMGNmM2MwYTQwZmM2N2UwZTVmZTBjNDZiMGFlNDA5YWM3MTAzMGE3NjU2ZGExN2IxMWVkMDAxNjQ1ODg4ZmUiCiAgICB9CiAgfQp9" private val goldenFishSkullItem by lazy { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt index 290c5427bb6e..9403120eb382 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt @@ -75,7 +75,8 @@ enum class CropType( if (itemName == "Red Mushroom" || itemName == "Brown Mushroom") return MUSHROOM if (itemName == "Seeds") return WHEAT return entries.firstOrNull { - it.cropName.equals(itemName, ignoreCase = true) || it.simpleName.equals(itemName, ignoreCase = true) + it.cropName.equals(itemName, ignoreCase = true) || + it.simpleName.equals(itemName, ignoreCase = true) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt index 55898266e440..a6331db11af9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt @@ -54,6 +54,7 @@ object FarmingFortuneDisplay { "collection", "§7You have §6\\+(?\\d{1,3})☘ .*", ) + @Suppress("MaxLineLength") private val tooltipFortunePattern by patternGroup.pattern( "tooltip.new", "^§7Farming Fortune: §a\\+(?[\\d.]+)(?: §2\\(\\+\\d\\))?(?: §9\\(\\+(?\\d+)\\))?(?: §d\\(\\+(?\\d+)\\))?\$", diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt index 127ee3f305a1..3c2ca657813d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt @@ -29,6 +29,7 @@ object GardenCropMilestoneFix { * REGEX-TEST: Cocoa Beans 31: §r§a68% * REGEX-TEST: Potato 32: §r§a97.7% */ + @Suppress("MaxLineLength") private val tabListPattern by patternGroup.pattern( "tablist", " (?Wheat|Carrot|Potato|Pumpkin|Sugar Cane|Melon|Cactus|Cocoa Beans|Mushroom|Nether Wart) (?\\d+): §r§a(?.*)%" diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt index d0a386272a1c..1b201b5aa5af 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt @@ -565,7 +565,8 @@ object GardenNextJacobContest { newContests[timeMark + contestDuration] = FarmingContest(timeMark + contestDuration, crops) } } else { - ChatUtils.chat("This year's contests aren't available to fetch automatically yet, please load them from your calendar or wait 10 minutes.") + ChatUtils.chat("This year's contests aren't available to fetch automatically yet, " + + "please load them from your calendar or wait 10 minutes.") ChatUtils.clickableChat( "Click here to open your calendar!", onClick = { HypixelCommands.calendar() }, diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt index 8700e49425be..54e37332a6a1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt @@ -86,8 +86,10 @@ object ToolTooltipTweaks { val cropString = if (hiddenFortune != 0.0) " §6[+${hiddenFortune.roundToInt()}]" else "" val fortuneLine = when (config.cropTooltipFortune) { - CropTooltipFortuneEntry.DEFAULT -> "§7Farming Fortune: §a+${displayedFortune.formatStat()}$ffdString$reforgeString" - CropTooltipFortuneEntry.SHOW -> "§7Farming Fortune: §a+${displayedFortune.formatStat()}$ffdString$reforgeString$cropString" + CropTooltipFortuneEntry.DEFAULT -> "§7Farming Fortune: " + + "§a+${displayedFortune.formatStat()}$ffdString$reforgeString" + CropTooltipFortuneEntry.SHOW -> "§7Farming Fortune: " + + "§a+${displayedFortune.formatStat()}$ffdString$reforgeString$cropString" else -> "§7Farming Fortune: §a+${totalFortune.formatStat()}$ffdString$reforgeString$cropString" } iterator.set(fortuneLine) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt index 87306744e4a8..81ae0c96ff85 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt @@ -160,7 +160,8 @@ object CropMoneyDisplay { } val bazaarData = internalName.getBazaarData() val price = - if (LorenzUtils.noTradeMode || bazaarData == null) internalName.getNpcPrice() / 160 else (bazaarData.instantBuyPrice + bazaarData.sellOfferPrice) / 320 + if (LorenzUtils.noTradeMode || bazaarData == null) internalName.getNpcPrice() / 160 + else (bazaarData.instantBuyPrice + bazaarData.sellOfferPrice) / 320 extraDicerCoins = 60 * 60 * GardenCropSpeed.getRecentBPS() * dicerDrops * price } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/plots/GardenPlotMenuHighlighting.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/plots/GardenPlotMenuHighlighting.kt index 3ca75b1793b0..d4e3933ce074 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/plots/GardenPlotMenuHighlighting.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/plots/GardenPlotMenuHighlighting.kt @@ -29,9 +29,8 @@ object GardenPlotMenuHighlighting { val list = mutableListOf() val plot = GardenPlotAPI.plots.find { it.inventorySlot == slot.slotIndex } ?: continue - val (pestsEnabled, spraysEnabled, locksEnabled, currentEnabled, pastesEnabled) = PlotStatusType.entries.map { - it in config.deskPlotStatusTypes - } + val (pestsEnabled, spraysEnabled, locksEnabled, currentEnabled, pastesEnabled) = + PlotStatusType.entries.map { it in config.deskPlotStatusTypes } if (plot.pests >= 1 && pestsEnabled) list.add(PlotStatusType.PESTS) if (plot.currentSpray != null && spraysEnabled) list.add(PlotStatusType.SPRAYS) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt index 690592d52184..68c9e632376e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt @@ -123,7 +123,8 @@ object PestFinder { fun onRenderWorld(event: LorenzRenderWorldEvent) { if (!isEnabled()) return if (!config.showPlotInWorld) return - if (config.onlyWithVacuum && !PestAPI.hasVacuumInHand() && (PestAPI.lastTimeVacuumHold.passedSince() > config.showBorderForSeconds.seconds)) return + if (config.onlyWithVacuum && !PestAPI.hasVacuumInHand() && + (PestAPI.lastTimeVacuumHold.passedSince() > config.showBorderForSeconds.seconds)) return val playerLocation = event.exactPlayerEyeLocation() val visibility = config.visibilityType diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorCompactChat.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorCompactChat.kt index 8cafd5260a1a..1524084546dd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorCompactChat.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorCompactChat.kt @@ -32,6 +32,7 @@ object GardenVisitorCompactChat { * REGEX-TEST: §7§8+§d1,241 Gemstone Powder * REGEX-TEST: §7§8+§2Crystal Hollows Pass */ + @Suppress("MaxLineLength") private val visitorRewardPattern by patternGroup.pattern( "visitorreward", "^ {4}(?:(?:§.)+\\+)?(?:(?§.)(?[\\d,]+(?:\\.?(?:\\d)?k)?)x? )?(?:(?(?:§.)+)?(?.*?))(?: (?:(?:§.)?)?x(?\\d+))?\$" diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt index 1d5907d85284..641ad717e403 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt @@ -582,7 +582,9 @@ object GardenVisitorFeatures { } } - if ((config.highlightStatus == HighlightMode.COLOR || config.highlightStatus == HighlightMode.BOTH) && entity is EntityLivingBase) { + if ((config.highlightStatus == HighlightMode.COLOR || config.highlightStatus == HighlightMode.BOTH) && + entity is EntityLivingBase + ) { val color = visitor.status.color if (color != -1) { RenderLivingEntityHelper.setEntityColor( diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardPattern.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardPattern.kt index f7371d9566c5..5170bd910d2b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardPattern.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardPattern.kt @@ -131,6 +131,7 @@ object ScoreboardPattern { "solo", "§3§lSolo$", ) + @Suppress("MaxLineLength") val teammatesPattern by dungeonSb.pattern( "teammates", "(§.)*(?\\[\\w]) (§.)*(?[a-zA-Z0-9_]{2,16}) ((§.)*(?\\[Lvl?(?[\\w,.]+)?]?)|(§.)*(?[\\w,.]+)(§.)*.?)$", diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt index f8a16bf50b0b..8af1fe056829 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt @@ -563,7 +563,8 @@ object HideNotClickableItems { val bazaarInventory = BazaarApi.inBazaarInventory val auctionHouseInventory = - chestName == "Co-op Auction House" || chestName == "Auction House" || chestName == "Create BIN Auction" || chestName == "Create Auction" + chestName == "Co-op Auction House" || chestName == "Auction House" || + chestName == "Create BIN Auction" || chestName == "Create Auction" if (!bazaarInventory && !auctionHouseInventory) return false showGreenLine = true diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt index 40eb8c4b335b..0184e5265794 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt @@ -298,10 +298,8 @@ object ItemDisplayOverlayFeatures { } } - if (BESTIARY_LEVEL.isSelected() && (chestName.contains("Bestiary ➜") || chestName.contains("Fishing ➜")) && - lore.any { - it.contains("Deaths: ") - } + if (BESTIARY_LEVEL.isSelected() && (chestName.contains("Bestiary ➜") || + chestName.contains("Fishing ➜")) && lore.any { it.contains("Deaths: ") } ) { lore.matchFirst(bestiaryStackPattern) { val tier = (group("tier").romanToDecimalIfNecessary() - 1) diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/SkyblockGuideHighlightFeature.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/SkyblockGuideHighlightFeature.kt index c95950a85dcd..35e14f898660 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/SkyblockGuideHighlightFeature.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/SkyblockGuideHighlightFeature.kt @@ -175,9 +175,8 @@ class SkyblockGuideHighlightFeature private constructor( "travel", "Core ➜ Fast Travels Unlocked", taskOnlyCompleteOncePattern, - { - HypixelCommands.wiki("MUSEUM_TRAVEL_SCROLL") - }, // The items do not have proper internal names and using the fact that all travel scrolls lead to the same wiki page + // The items do not have proper internal names and using the fact that all travel scrolls lead to the same wiki page + { HypixelCommands.wiki("MUSEUM_TRAVEL_SCROLL") }, openWikiTooltip ) SkyblockGuideHighlightFeature( @@ -252,6 +251,7 @@ class SkyblockGuideHighlightFeature private constructor( SkyblockGuideHighlightFeature( { skyblockGuideConfig.menuGuide }, "tasks.skill", "Skill Related Tasks", categoryProgressPattern ) + @Suppress("MaxLineLength") SkyblockGuideHighlightFeature( { skyblockGuideConfig.collectionGuide }, "collections", diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayTracker.kt index bb4eeaedb20c..9c890aa56dc3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayTracker.kt @@ -104,6 +104,7 @@ object ChocolateFactoryStrayTracker { /** * REGEX-TEST: §7You caught a stray §9Fish the Rabbit§7! §7You have already found §9Fish the §9Rabbit§7, so you received §655,935,257 §6Chocolate§7! */ + @Suppress("MaxLineLength") private val fishTheRabbitPattern by ChocolateFactoryAPI.patternGroup.pattern( "stray.fish", "§7You caught a stray (?§.)Fish the Rabbit§7! §7You have already found (?:§.)?Fish the (?:§.)?Rabbit§7, so you received §6(?[\\d,]*) (?:§6)?Chocolate§7!", diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsGuide.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsGuide.kt index a1d8f43a8d5b..68fc72669070 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsGuide.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsGuide.kt @@ -97,7 +97,8 @@ object DeepCavernsGuide { if (it.displayName != "§aObsidian Sanctuary") { if (!show) { start() - ChatUtils.chat("Automatically enabling Deep Caverns Guide, helping you find the way to the bottom of the Deep Caverns and the path to Rhys.") + ChatUtils.chat("Automatically enabling Deep Caverns Guide, " + + "helping you find the way to the bottom of the Deep Caverns and the path to Rhys.") } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventType.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventType.kt index 15d46c0466a3..f11838683909 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventType.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventType.kt @@ -22,6 +22,7 @@ enum class MiningEventType( val eventName: String, private val shortName: String, val defaultLength: Duration, + // TODO change to LorenzColor private val colorCode: Char, val dwarvenSpecific: Boolean, iconInput: Renderable, @@ -68,14 +69,18 @@ enum class MiningEventType( }, ), + + @Suppress("MaxLineLength") GOBLIN_RAID( "GOBLIN RAID", "Raid", 5.minutes, 'c', true, - ItemUtils.createSkull( + ItemUtils.createSkull( // TODO: Move skull texture to repo "Goblin", "32518c29-6127-3c71-b2a7-be4c3251e76f", "ewogICJ0aW1lc3RhbXAiIDogMTYwNzQ2NDg4MTMwOCwKICAicHJvZmlsZUlkIiA6ICJhMmY4MzQ1OTVjODk0YTI3YWRkMzA0OTcxNmNhOTEwYyIsCiAgInByb2ZpbGVOYW1lIiA6ICJiUHVuY2giLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTcyODUwOTA2YjdmMGQ5NTJjMGU1MDgwNzNjYzQzOWZkMzM3NGNjZjViODg5YzA2ZjdlOGQ5MGNjMGNjMjU1YyIKICAgIH0KICB9Cn0=", ), ), + + @Suppress("MaxLineLength") BETTER_TOGETHER( "BETTER TOGETHER", "Better", 18.minutes, 'd', false, object : Renderable { @@ -86,7 +91,7 @@ enum class MiningEventType( val steveHead = Renderable.itemStack(Items.skull.toItemStack(3), 0.36) val alexHead = Renderable.itemStack( - ItemUtils.createSkull( + ItemUtils.createSkull( // TODO: Move skull texture to repo "Alex", "6ab43178-89fd-4905-97f6-0f67d9d76fd9", "fRBfVNlIWW6cL478st/8NsNEHVxjvwQDp4+MbKbFj1tPZvxXgpIXRaQsLeDl/0+E4tipPKNANAbmqj9EKAVx3b3gDqLLrTTk/NfuH2RD3I5ppzio8w5oYk1022SopaayGBP4+kuwktDHzlR8IgAUb1RiavldKp+TGRdCbqw8vHHBm9pnuOePzTOOADQgdanRj98bOcfIXe69tSS/VHxDe9tkpYFPkQR8zsJcjUxf+nS83iFU9CW9lKtQlyoU6/BPbHFILvcR1KDR5Imj7GJe2OJefghI6OqtHNZP2tzkia2IDU0Yc4ikwC+7yN3i6I3Do4G3gTtCZVfNXiSdFyU9nCMyBxggTaG9zaljZpN0BynG4FzYMujIVgeNa6FLqwoaFT0iELW2w9JgJFgyVlaDKEqMSGyxgqtcQMPBuvCwMFFjeFd2EhtfTjQ4hcpva+NXXoYPP7yfTk/0DErNZV2dUTasekar8lH6U58B7ECNxDUwcon4z7sSO5mdlPJoiT7zllgpwQn5NUPaxZxaKkGdUIFEGzjmBfnCmk6MOqzi05Rr18wnkdic9hz/fIzzTMhn9mbMG6VF9eBkE4mNu1K5jai6II5Mz9BV49U0ZcA874N1VHpJpQE6762TYv+u7ICTRIOf2LD9wEgu3py/nX+IHma5j22ClUtXH3hYdZmHg+s=\",Value:\"ewogICJ0aW1lc3RhbXAiIDogMTcxMTY1OTI2NDg1NSwKICAicHJvZmlsZUlkIiA6ICI2YWI0MzE3ODg5ZmQ0OTA1OTdmNjBmNjdkOWQ3NmZkOSIsCiAgInByb2ZpbGVOYW1lIiA6ICJNSEZfQWxleCIsCiAgInNpZ25hdHVyZVJlcXVpcmVkIiA6IHRydWUsCiAgInRleHR1cmVzIiA6IHsKICAgICJTS0lOIiA6IHsKICAgICAgInVybCIgOiAiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS84M2NlZTVjYTZhZmNkYjE3MTI4NWFhMDBlODA0OWMyOTdiMmRiZWJhMGVmYjhmZjk3MGE1Njc3YTFiNjQ0MDMyIiwKICAgICAgIm1ldGFkYXRhIiA6IHsKICAgICAgICAibW9kZWwiIDogInNsaW0iCiAgICAgIH0KICAgIH0KICB9Cn0=", @@ -108,17 +113,24 @@ enum class MiningEventType( "RAFFLE", "Raffle", 160.seconds, - '6', - true, - Items.name_tag.toItemStack().overrideId("MINING_RAFFLE_TICKET"), + colorCode = '6', + dwarvenSpecific = true, + iconInput = Items.name_tag.toItemStack().overrideId("MINING_RAFFLE_TICKET"), + ), + MITHRIL_GOURMAND( + "MITHRIL GOURMAND", + "Gourmand", 10.minutes, + colorCode = 'b', + dwarvenSpecific = true, + iconInput = Items.dye.toItemStack(6).overrideId("MITHRIL_GOURMAND") ), - MITHRIL_GOURMAND("MITHRIL GOURMAND", "Gourmand", 10.minutes, 'b', true, Items.dye.toItemStack(6).overrideId("MITHRIL_GOURMAND")), ; constructor( eventName: String, shortName: String, defaultLength: Duration, + // TODO change to LorenzColor colorCode: Char, dwarvenSpecific: Boolean, iconInput: ItemStack, diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/CorpseTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/CorpseTracker.kt index bc5e324401bb..cb2c3cfe487f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/CorpseTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/CorpseTracker.kt @@ -147,5 +147,8 @@ object CorpseTracker { } fun isEnabled() = - LorenzUtils.inSkyBlock && config.enabled && (IslandType.MINESHAFT.isInIsland() || (!config.onlyInMineshaft && MiningAPI.inGlacialTunnels())) + LorenzUtils.inSkyBlock && config.enabled && ( + IslandType.MINESHAFT.isInIsland() || + (!config.onlyInMineshaft && MiningAPI.inGlacialTunnels()) + ) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CarryTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CarryTracker.kt index 7efce2fcdae5..b43625ed2769 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CarryTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CarryTracker.kt @@ -276,7 +276,8 @@ object CarryTracker { ), onClick = { HypixelCommands.partyChat( - "$customerName Carry: already paid: ${paidFormat.removeColor()}, " + "still missing: ${missingFormat.removeColor()}", + "$customerName Carry: already paid: ${paidFormat.removeColor()}, " + + "still missing: ${missingFormat.removeColor()}", ) }, ), diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/HideFarEntities.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/HideFarEntities.kt index d12953b98006..8a47da6f72e5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/HideFarEntities.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/HideFarEntities.kt @@ -41,6 +41,7 @@ object HideFarEntities { } } - fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled && (!(GardenAPI.inGarden() && config.excludeGarden) && !(DungeonAPI.inDungeon() && config.excludeDungeon)) + fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled && + (!(GardenAPI.inGarden() && config.excludeGarden) && !(DungeonAPI.inDungeon() && config.excludeDungeon)) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/LesserOrbHider.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/LesserOrbHider.kt index 36bfb3fb78aa..c07ab7de45fc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/LesserOrbHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/LesserOrbHider.kt @@ -19,6 +19,8 @@ object LesserOrbHider { private val config get() = SkyHanniMod.feature.misc private val hiddenEntities = CollectionUtils.weakReferenceList() + // TODO: Move to repo + @Suppress("MaxLineLength") private const val LESSER_TEXTURE = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZjgzMjM2NjM5NjA3MDM2YzFiYTM5MWMyYjQ2YTljN2IwZWZkNzYwYzhiZmEyOTk2YTYwNTU1ODJiNGRhNSJ9fX0=" diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt index 83f45e535d5c..8fcc8fd8779d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt @@ -96,6 +96,7 @@ object NonGodPotEffectDisplay { // todo : cleanup and add support for poison candy I, and add support for splash / other formats @SubscribeEvent + @Suppress("MaxLineLength") fun onChat(event: LorenzChatEvent) { if (event.message == "§aYou cleared all of your active effects!") { effectDuration.clear() diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt index 990f1a8b74e9..c9ad14620610 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt @@ -25,12 +25,16 @@ object ParticleHider { } val type = event.type - if (SkyHanniMod.feature.misc.particleHiders.hideCloseRedstoneParticles && type == EnumParticleTypes.REDSTONE && distanceToPlayer < 2) { + if (SkyHanniMod.feature.misc.particleHiders.hideCloseRedstoneParticles && + type == EnumParticleTypes.REDSTONE && distanceToPlayer < 2 + ) { event.cancel() return } - if (SkyHanniMod.feature.misc.particleHiders.hideFireballParticles && (type == EnumParticleTypes.SMOKE_NORMAL || type == EnumParticleTypes.SMOKE_LARGE)) { + if (SkyHanniMod.feature.misc.particleHiders.hideFireballParticles && + (type == EnumParticleTypes.SMOKE_NORMAL || type == EnumParticleTypes.SMOKE_LARGE) + ) { for (entity in EntityUtils.getEntities()) { val distance = entity.getLorenzVec().distance(event.location) if (distance < 5) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/update/GuiOptionEditorUpdateCheck.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/update/GuiOptionEditorUpdateCheck.kt index 84d86615da3d..9f2d2ac595d4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/update/GuiOptionEditorUpdateCheck.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/update/GuiOptionEditorUpdateCheck.kt @@ -68,7 +68,10 @@ class GuiOptionEditorUpdateCheck(option: ProcessedOption) : GuiOptionEditor(opti override fun mouseInput(x: Int, y: Int, width: Int, mouseX: Int, mouseY: Int): Boolean { val width = width - 20 - if (Mouse.getEventButtonState() && (mouseX - getButtonPosition(width) - x) in (0..button.width) && (mouseY - 10 - y) in (0..button.height)) { + if (Mouse.getEventButtonState() && + (mouseX - getButtonPosition(width) - x) in (0..button.width) && + (mouseY - 10 - y) in (0..button.height) + ) { when (UpdateManager.updateState) { UpdateManager.UpdateState.AVAILABLE -> UpdateManager.queueUpdate() UpdateManager.UpdateState.QUEUED -> {} diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/VoltHighlighter.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/VoltHighlighter.kt index 50c6593fb9d2..99c94d63a1df 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/VoltHighlighter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/VoltHighlighter.kt @@ -94,6 +94,7 @@ object VoltHighlighter { DOING_LIGHTNING, } + @Suppress("MaxLineLength") private fun getVoltState(itemStack: ItemStack): VoltState { return when (itemStack.getSkullTexture()) { // TODO: Move these textures to the repo diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt index 89e5d556b2b4..ec382a5d42ac 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt @@ -115,7 +115,9 @@ object DanceRoomHelper { @SubscribeEvent fun onPlaySound(event: PlaySoundEvent) { if (!isEnabled() || !inRoom) return - if ((event.soundName == "random.burp" && event.volume == 0.8f) || (event.soundName == "random.levelup" && event.pitch == 1.8412699f && event.volume == 1.0f)) { + if ((event.soundName == "random.burp" && event.volume == 0.8f) || + (event.soundName == "random.levelup" && event.pitch == 1.8412699f && event.volume == 1.0f) + ) { index = 0 found = false countdown = null diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminHighlighter.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminHighlighter.kt index c08594c26ea9..aab8c0caff0f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminHighlighter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminHighlighter.kt @@ -26,9 +26,11 @@ object VerminHighlighter { private val checkedEntities = TimeLimitedSet(1.minutes) - // TODO repo + // TODO: Move to repo + @Suppress("MaxLineLength") private const val FLY_TEXTURE = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTMwYWMxZjljNjQ5Yzk5Y2Q2MGU0YmZhNTMzNmNjMTg1MGYyNzNlYWI5ZjViMGI3OTQwZDRkNGQ3ZGM4MjVkYyJ9fX0=" + @Suppress("MaxLineLength") private const val SPIDER_TEXTURE = "ewogICJ0aW1lc3RhbXAiIDogMTY1MDU1NjEzMTkxNywKICAicHJvZmlsZUlkIiA6ICI0ODI5MmJkMjI1OTc0YzUwOTZiMTZhNjEyOGFmMzY3NSIsCiAgInByb2ZpbGVOYW1lIiA6ICJLVVJPVE9ZVEIyOCIsCiAgInNpZ25hdHVyZVJlcXVpcmVkIiA6IHRydWUsCiAgInRleHR1cmVzIiA6IHsKICAgICJTS0lOIiA6IHsKICAgICAgInVybCIgOiAiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS84ZmRmNjJkNGUwM2NhNTk0YzhjZDIxZGQxNzUzMjdmMWNmNzdjNGJjMDU3YTA5NTk2MDNkODNhNjhiYTI3MDA4IgogICAgfQogIH0KfQ==" diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/kloon/KloonHacking.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/kloon/KloonHacking.kt index 637fdfd15e1d..7b88b09ed857 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/kloon/KloonHacking.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/kloon/KloonHacking.kt @@ -89,7 +89,9 @@ object KloonHacking { slot highlight if (correctButton) LorenzColor.GREEN else LorenzColor.RED continue } - if (slot.slotIndex > i * 9 + 8 && slot.slotIndex < i * 9 + 18 && slot.stack!!.displayName.removeColor() == correctButtons[i]) { + if (slot.slotIndex > i * 9 + 8 && slot.slotIndex < i * 9 + 18 && + slot.stack!!.displayName.removeColor() == correctButtons[i] + ) { slot highlight LorenzColor.YELLOW } if (slot.slotIndex == i * 9 + 17) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftLarva.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftLarva.kt index a89698596a74..7a58c5d51113 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftLarva.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftLarva.kt @@ -18,6 +18,9 @@ object RiftLarva { private val config get() = RiftAPI.config.area.wyldWoods.larvas private var hasHookInHand = false + + // TODO: Move to repo + @Suppress("MaxLineLength") private const val LARVA_SKULL_TEXTURE = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTgzYjMwZTlkMTM1YjA1MTkwZWVhMmMzYWM2MWUyYWI1NWEyZDgxZTFhNThkYmIyNjk4M2ExNDA4MjY2NCJ9fX0=" diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftOdonata.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftOdonata.kt index 555e5968c8e7..452d3edb0bb7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftOdonata.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftOdonata.kt @@ -19,6 +19,9 @@ object RiftOdonata { private val config get() = RiftAPI.config.area.wyldWoods.odonata private var hasBottleInHand = false + + // TODO: Move to repo + @Suppress("MaxLineLength") private const val ODONATA_SKULL_TEXTURE = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOWZkODA2ZGVmZGZkZjU5YjFmMjYwOWM4ZWUzNjQ2NjZkZTY2MTI3YTYyMzQxNWI1NDMwYzkzNThjNjAxZWY3YyJ9fX0=" private val emptyBottle by lazy { "EMPTY_ODONATA_BOTTLE".asInternalName() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/CruxTalismanDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/CruxTalismanDisplay.kt index 9e92b0807129..e32fd46a79d5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/CruxTalismanDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/CruxTalismanDisplay.kt @@ -23,6 +23,7 @@ object CruxTalismanDisplay { private val config get() = RiftAPI.config.cruxTalisman + @Suppress("MaxLineLength") private val progressPattern by RepoPattern.pattern( "rift.everywhere.crux.progress", ".*(?§[0-9a-z][IV1-4-]+)\\s+(?§[0-9a-z]\\w+)§[0-9a-z]:\\s*(?§[0-9a-z](?:§[0-9a-z])?MAXED|§[0-9a-z]\\d+§[0-9a-z]/§[0-9a-z]\\d+).*" diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt index 022a808d0afc..9cc9e19734b9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt @@ -72,7 +72,8 @@ object ShowMotesNpcSellPrice { val burgerText = if (burgerStacks > 0) "(${burgerStacks}x≡) " else "" val size = itemStack.stackSize if (size > 1) { - event.toolTip.add("§6NPC price: $burgerText§d${baseMotes.addSeparators()} Motes §7($size x §d${(baseMotes / size).addSeparators()} Motes§7)") + event.toolTip.add("§6NPC price: $burgerText§d${baseMotes.addSeparators()} Motes " + + "§7($size x §d${(baseMotes / size).addSeparators()} Motes§7)") } else { event.toolTip.add("§6NPC price: $burgerText§d${baseMotes.addSeparators()} Motes") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt b/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt index ffee3eda4656..ccc1ac1c1573 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt @@ -320,8 +320,11 @@ object SkillProgress { val xpInfo = skillXPInfoMap[activeSkill] ?: return@buildList val skillInfoLast = oldSkillInfoMap[activeSkill] ?: return@buildList oldSkillInfoMap[activeSkill] = skillInfo - val level = - if (config.overflowConfig.enableInEtaDisplay.get() || config.customGoalConfig.enableInETADisplay) skillInfo.overflowLevel else skillInfo.level + val level = if (config.overflowConfig.enableInEtaDisplay.get() || config.customGoalConfig.enableInETADisplay) { + skillInfo.overflowLevel + } else { + skillInfo.level + } val useCustomGoalLevel = skillInfo.customGoalLevel != 0 && skillInfo.customGoalLevel > skillInfo.overflowLevel && customGoalConfig.enableInETADisplay diff --git a/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillTooltip.kt b/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillTooltip.kt index 8c1d3f618c29..e616deda48f3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillTooltip.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillTooltip.kt @@ -56,7 +56,8 @@ object SkillTooltip { if (line.contains(bar)) { val progress = (skillInfo.overflowCurrentXp.toDouble() / skillInfo.overflowCurrentXpMax) val progressBar = StringUtils.progressBar(progress) - iterator.set("$progressBar §e${skillInfo.overflowCurrentXp.addSeparators()}§6/§e${skillInfo.overflowCurrentXpMax.addSeparators()}") + iterator.set("$progressBar §e${skillInfo.overflowCurrentXp.addSeparators()}§6/" + + "§e${skillInfo.overflowCurrentXpMax.addSeparators()}") iterator.add("") } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt index 13186cd96910..87ceb82424e8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt @@ -65,9 +65,11 @@ object VampireSlayerFeatures { private val username get() = EntityUtils.getEntities().firstOrNull()?.name ?: error("own player is null") - // TODO: Add to repo + // TODO: Move to repo + @Suppress("MaxLineLength") private const val BLOOD_ICHOR_TEXTURE = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzAzNDA5MjNhNmRlNDgyNWExNzY4MTNkMTMzNTAzZWZmMTg2ZGIwODk2ZTMyYjY3MDQ5MjhjMmEyYmY2ODQyMiJ9fX0=" + @Suppress("MaxLineLength") private const val KILLER_SPRING_TEXTURE = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzdmN2E3YmM4YWM4NmYyM2NhN2JmOThhZmViNzY5NjAyMjdlMTgzMmZlMjA5YTMwMjZmNmNlYjhiZGU3NGY1NCJ9fX0=" private var nextClawSend = 0L diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt index 684d06cd4ba2..9b03ebbeb2f5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt @@ -48,6 +48,9 @@ object EndermanSlayerFeatures { private val nukekubiSkulls = mutableSetOf() private var sittingBeacon = mapOf() private val logger = LorenzLogger("slayer/enderman") + + // TODO: Move to repo + @Suppress("MaxLineLength") private const val NUKEKUBI_SKULL_TEXTURE = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWIwNzU5NGUyZGYyNzM5MjFhNzdjMTAxZDBiZmRmYTExMTVhYmVkNWI5YjIwMjllYjQ5NmNlYmE5YmRiYjRiMyJ9fX0=" diff --git a/src/main/java/at/hannibal2/skyhanni/test/WorldEdit.kt b/src/main/java/at/hannibal2/skyhanni/test/WorldEdit.kt index 0c5f66626de2..b599fcc90f7c 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/WorldEdit.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/WorldEdit.kt @@ -106,7 +106,8 @@ object WorldEdit { } when (it.firstOrNull()) { null, "help" -> { - ChatUtils.chat("Use a wood axe and left/right click to select a region in the world. Then use /shworldedit copy or /shworldedit reset.") + ChatUtils.chat("Use a wood axe and left/right click to select a region in the world. " + + "Then use /shworldedit copy or /shworldedit reset.") } "copy" -> { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt index 829b692345f4..536a1d7df6a1 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt @@ -291,9 +291,7 @@ object CollectionUtils { } fun takeColumn(start: Int, end: Int, startColumn: Int, endColumn: Int, rowSize: Int = 9) = - generateSequence(start) { - it + 1 - }.map { + generateSequence(start) { it + 1 }.map { (it / (endColumn - startColumn)) * rowSize + (it % (endColumn - startColumn)) + startColumn }.takeWhile { it <= end } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt index 59799ff3d1fd..c5eb95fc892a 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt @@ -181,7 +181,10 @@ object EntityUtils { fun getAllEntities(): Sequence = Minecraft.getMinecraft().theWorld?.getAllEntities()?.let { if (Minecraft.getMinecraft() .isOnMainThread() - ) it else it.toMutableList() // TODO: while i am here, i want to point out that copying the entity list does not constitute proper synchronization, but *does* make crashes because of it rarer. + ) it + // TODO: while i am here, i want to point out that copying the entity list does not constitute proper synchronization, + // but *does* make crashes because of it rarer. + else it.toMutableList() }?.asSequence()?.filterNotNull() ?: emptySequence() fun getAllTileEntities(): Sequence = Minecraft.getMinecraft()?.theWorld?.loadedTileEntityList?.let { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt b/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt index 2e507989699b..b273b5f09991 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt @@ -76,6 +76,7 @@ object UtilsPatterns { "(?:§5§o)?§7Cost.*", ) + @Suppress("MaxLineLength") val timeAmountPattern by patternGroup.pattern( "time.amount", "(?:(?\\d+) ?y(?:\\w* ?)?)?(?:(?\\d+) ?d(?:\\w* ?)?)?(?:(?\\d+) ?h(?:\\w* ?)?)?(?:(?\\d+) ?m(?:\\w* ?)?)?(?:(?\\d+) ?s(?:\\w* ?)?)?", diff --git a/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt b/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt index 94f0bc16eff1..c7c66084e045 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt @@ -260,7 +260,16 @@ interface Renderable { val isInNeuSettings = openGui.startsWith("io.github.moulberry.notenoughupdates.") val result = - isGuiScreen && isGuiPositionEditor && inMenu && isNotInSignAndOnSlot && isConfigScreen && !isInNeuPv && !isInSkytilsPv && !neuFocus && !isInSkytilsSettings && !isInNeuSettings + isGuiScreen && + isGuiPositionEditor && + inMenu && + isNotInSignAndOnSlot && + isConfigScreen && + !isInNeuPv && + !isInSkytilsPv && + !neuFocus && + !isInSkytilsSettings && + !isInNeuSettings if (debug) { if (!result) { @@ -614,7 +623,12 @@ interface Renderable { override val horizontalAlign = content.horizontalAlign override val verticalAlign = content.verticalAlign - val searchWidth get() = (Minecraft.getMinecraft().fontRendererObj.getStringWidth(searchPrefix + textInput.editTextWithAlwaysCarriage()) * scale).toInt() + 1 + val searchWidth: Int + get() { + val fontRenderer = Minecraft.getMinecraft().fontRendererObj + val string = searchPrefix + textInput.editTextWithAlwaysCarriage() + return (fontRenderer.getStringWidth(string) * scale).toInt() + 1 + } init { textInput.registerToEvent(key) { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternManager.kt b/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternManager.kt index abdf15b1c100..57a5852a3a81 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternManager.kt @@ -101,7 +101,9 @@ object RepoPatternManager { val previousOwner = exclusivity[key] if (previousOwner != owner && previousOwner != null && !previousOwner.transient) { if (!config.tolerateDuplicateUsage) - crash("Non unique access to regex at \"$key\". First obtained by ${previousOwner.ownerClass} / ${previousOwner.property}, tried to use at ${owner.ownerClass} / ${owner.property}") + crash("Non unique access to regex at \"$key\". " + + "First obtained by ${previousOwner.ownerClass} / ${previousOwner.property}, " + + "tried to use at ${owner.ownerClass} / ${owner.property}") } else { exclusivity[key] = owner } @@ -119,7 +121,9 @@ object RepoPatternManager { } val previousParentOwner = previousParentOwnerMutable - if (previousParentOwner != null && previousParentOwner != parentKeyHolder && !(previousParentOwner.shares && previousParentOwner.parent == parentKeyHolder)) { + if (previousParentOwner != null && previousParentOwner != parentKeyHolder && + !(previousParentOwner.shares && previousParentOwner.parent == parentKeyHolder) + ) { if (!config.tolerateDuplicateUsage) crash( "Non unique access to array regex at \"$parent\"." + " First obtained by ${previousParentOwner.ownerClass} / ${previousParentOwner.property}," + diff --git a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniBucketedItemTracker.kt b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniBucketedItemTracker.kt index 2addca5c0aa9..ff691fd53696 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniBucketedItemTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniBucketedItemTracker.kt @@ -151,7 +151,10 @@ class SkyHanniBucketedItemTracker, BucketedData : BucketedItemTracke onClick = { if (KeyboardManager.isModifierKeyDown()) { data.removeItem(data.getSelectedBucket(), internalName) - ChatUtils.chat("Removed $cleanName §efrom $name${if (data.getSelectedBucket() != null) " (${data.getSelectedBucket()})" else ""}") + ChatUtils.chat("Removed $cleanName §efrom $name" + + if (data.getSelectedBucket() != null) " (${data.getSelectedBucket()})" + else "" + ) } else { modify { it.toggleItemHide(data.getSelectedBucket(), internalName) From c5915be522ccfb73feed69b8d0fa1b45420e78e3 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Sun, 13 Oct 2024 15:54:20 +0200 Subject: [PATCH 7/7] Improvement: More Inquis messages (#2720) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Co-authored-by: Cal --- .../event/diana/InquisitorWaypointShare.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 8e72e37d00f8..96f18ecd8ab4 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 @@ -58,6 +58,15 @@ object InquisitorWaypointShare { "party.inquisitorchecker", "(?§9Party §8> )?(?.+)§f: §rA MINOS INQUISITOR has spawned near \\[(?.*)] at Coords (?[^ ]+) (?[^ ]+) (?[^ ]+)" ) + + /** + * REGEX-TEST: §9Party §8> §b[MVP§9+§b] _088§f: §rx: 86, y: 73, z: -29 I dug up an inquisitor come over here! + */ + private val odinPattern by patternGroup.pattern( + "party.odin", + "(?§9Party §8> )?(?.+)§f: §rx: (?[^ ]+), y: (?[^ ]+), z: (?[^ ]+) I dug up an inquisitor come over here!" + ) + private val diedPattern by patternGroup.pattern( "died", "(?§9Party §8> )?(?.*)§f: §rInquisitor dead!" @@ -238,6 +247,11 @@ object InquisitorWaypointShare { event.cancel() } } + odinPattern.matchMatcher(message) { + if (detectFromChat()) { + event.cancel() + } + } partyOnlyCoordsPattern.matchMatcher(message) { if (detectFromChat()) {