diff options
author | CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> | 2024-06-08 12:18:03 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-08 12:18:03 +1000 |
commit | aaca5f08d47732b3db5329a3a9404281b21d2f55 (patch) | |
tree | 6e9888c91928ba5e49e1d736b28fe0f4c847faa8 /src/main/java/at/hannibal2/skyhanni/data | |
parent | 0c53ce8afdd5f64d2764d5ce0d4f2f2a59a7b06e (diff) | |
download | skyhanni-aaca5f08d47732b3db5329a3a9404281b21d2f55.tar.gz skyhanni-aaca5f08d47732b3db5329a3a9404281b21d2f55.tar.bz2 skyhanni-aaca5f08d47732b3db5329a3a9404281b21d2f55.zip |
Backend: Add annotation to smaller modules (#2022)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data')
5 files changed, 51 insertions, 48 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ActionBarStatsData.kt b/src/main/java/at/hannibal2/skyhanni/data/ActionBarStatsData.kt index fc7480729..b2145db76 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ActionBarStatsData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ActionBarStatsData.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.events.ActionBarUpdateEvent import at.hannibal2.skyhanni.events.ActionBarValueUpdateEvent +import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern @@ -37,6 +38,7 @@ enum class ActionBarStatsData(@Language("RegExp") rawPattern: String) { var value: String = "" private set + @SkyHanniModule companion object { init { diff --git a/src/main/java/at/hannibal2/skyhanni/data/HotmData.kt b/src/main/java/at/hannibal2/skyhanni/data/HotmData.kt index 841e39c17..51b86cf92 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HotmData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HotmData.kt @@ -13,6 +13,7 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.events.ScoreboardChangeEvent import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardPattern +import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ConditionalUtils.transformIf @@ -267,6 +268,7 @@ enum class HotmData( fun getReward() = rewardFun(activeLevel) + @SkyHanniModule companion object { val storage get() = ProfileStorageData.profileSpecific?.mining?.hotmTree diff --git a/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt b/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt index af3683402..95dbe1577 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent +import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.SimpleTimeMark import io.github.notenoughupdates.moulconfig.internal.TextRenderUtils @@ -14,43 +15,41 @@ import kotlin.time.Duration import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds -class TitleManager { +@SkyHanniModule +object TitleManager { - companion object { + private var originalText = "" + private var display = "" + private var endTime = SimpleTimeMark.farPast() + private var heightModifier = 1.8 + private var fontSizeModifier = 4f - private var originalText = "" - private var display = "" - private var endTime = SimpleTimeMark.farPast() - private var heightModifier = 1.8 - private var fontSizeModifier = 4f + fun sendTitle(text: String, duration: Duration, height: Double, fontSize: Float) { + originalText = text + display = "§f$text" + endTime = SimpleTimeMark.now() + duration + heightModifier = height + fontSizeModifier = fontSize + } - fun sendTitle(text: String, duration: Duration, height: Double, fontSize: Float) { - originalText = text - display = "§f$text" - endTime = SimpleTimeMark.now() + duration - heightModifier = height - fontSizeModifier = fontSize + fun optionalResetTitle(condition: (String) -> Boolean) { + if (condition(originalText)) { + sendTitle("", 1.milliseconds, 1.8, 4f) } + } - fun optionalResetTitle(condition: (String) -> Boolean) { - if (condition(originalText)) { - sendTitle("", 1.milliseconds, 1.8, 4f) - } + fun command(args: Array<String>) { + if (args.size < 4) { + ChatUtils.userError("Usage: /shsendtitle <duration> <height> <fontSize> <text ..>") + return } - fun command(args: Array<String>) { - if (args.size < 4) { - ChatUtils.userError("Usage: /shsendtitle <duration> <height> <fontSize> <text ..>") - return - } + val duration = args[0].toInt().seconds + val height = args[1].toDouble() + val fontSize = args[2].toFloat() + val title = "§6" + args.drop(3).joinToString(" ").replace("&", "§") - val duration = args[0].toInt().seconds - val height = args[1].toDouble() - val fontSize = args[2].toFloat() - val title = "§6" + args.drop(3).joinToString(" ").replace("&", "§") - - sendTitle(title, duration, height, fontSize) - } + sendTitle(title, duration, height, fontSize) } @SubscribeEvent 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 b8bf67f81..59cacde87 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/mob/MobData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/mob/MobData.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.data.mob import at.hannibal2.skyhanni.events.MobEvent +import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.CollectionUtils.takeIfAllNotNull import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LorenzLogger @@ -11,36 +12,35 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.TreeMap import at.hannibal2.skyhanni.data.mob.Mob.Type as MobType -class MobData { +@SkyHanniModule +object MobData { class MobSet : HashSet<Mob>() { val entityList get() = this.flatMap { listOf(it.baseEntity) + (it.extraEntities) } } - companion object { - val players = MobSet() - val displayNPCs = MobSet() - val skyblockMobs = MobSet() - val summoningMobs = MobSet() - val special = MobSet() - val currentMobs = MobSet() + val players = MobSet() + val displayNPCs = MobSet() + val skyblockMobs = MobSet() + val summoningMobs = MobSet() + val special = MobSet() + val currentMobs = MobSet() - val entityToMob = mutableMapOf<EntityLivingBase, Mob>() + val entityToMob = mutableMapOf<EntityLivingBase, Mob>() - internal val currentEntityLiving = mutableSetOf<EntityLivingBase>() - internal val previousEntityLiving = mutableSetOf<EntityLivingBase>() + internal val currentEntityLiving = mutableSetOf<EntityLivingBase>() + internal val previousEntityLiving = mutableSetOf<EntityLivingBase>() - internal val retries = TreeMap<Int, RetryEntityInstancing>() + internal val retries = TreeMap<Int, RetryEntityInstancing>() - const val ENTITY_RENDER_RANGE_IN_BLOCKS = 80.0 // Entity DeRender after ~5 Chunks - const val DETECTION_RANGE = 22.0 - const val DISPLAY_NPC_DETECTION_RANGE = 24.0 // 24.0 + const val ENTITY_RENDER_RANGE_IN_BLOCKS = 80.0 // Entity DeRender after ~5 Chunks + const val DETECTION_RANGE = 22.0 + const val DISPLAY_NPC_DETECTION_RANGE = 24.0 // 24.0 - var externRemoveOfRetryAmount = 0 + var externRemoveOfRetryAmount = 0 - val logger = LorenzLogger("mob/detection") - } + val logger = LorenzLogger("mob/detection") internal enum class Result { Found, 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 9a1ec8672..452fa09b3 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt @@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.data.mob import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.IslandType -import at.hannibal2.skyhanni.data.mob.MobData.Companion.logger +import at.hannibal2.skyhanni.data.mob.MobData.logger import at.hannibal2.skyhanni.data.mob.MobFilter.isDisplayNPC import at.hannibal2.skyhanni.data.mob.MobFilter.isRealPlayer import at.hannibal2.skyhanni.data.mob.MobFilter.isSkyBlockMob |