aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2024-09-29 19:41:58 +1000
committerGitHub <noreply@github.com>2024-09-29 11:41:58 +0200
commit8988f7d34d706b909012dceea8bad65b4863ea44 (patch)
treebe907ec20f3cfbd46f0ea314d615a47596e177ba /src/main/java/at/hannibal2/skyhanni
parent3569dec0ab32c357eb34cff79c200f379f3d19ce (diff)
downloadskyhanni-8988f7d34d706b909012dceea8bad65b4863ea44.tar.gz
skyhanni-8988f7d34d706b909012dceea8bad65b4863ea44.tar.bz2
skyhanni-8988f7d34d706b909012dceea8bad65b4863ea44.zip
Backend: Detekt Fixes Part 4 (#2610)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/api/DataWatcherAPI.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/UniqueGiftingOpportunitiesFeatures.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/hoppity/MythicRabbitPetWarning.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/gui/BeaconPower.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/SkyblockGuideHighlightFeature.kt18
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/ExperimentationTableAPI.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/UserLuckBreakdown.kt22
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboPlaytime.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/CruxTalismanDisplay.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt16
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/guide/GuideGUI.kt18
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/guide/GuideTab.kt12
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/renderables/Searchable.kt8
17 files changed, 82 insertions, 79 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/api/DataWatcherAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/DataWatcherAPI.kt
index 94931dd8c..e7e7fd2b5 100644
--- a/src/main/java/at/hannibal2/skyhanni/api/DataWatcherAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/api/DataWatcherAPI.kt
@@ -8,7 +8,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@SkyHanniModule
object DataWatcherAPI {
- private val DATA_VALUE_CUSTOM_NAME = 2
+ private const val DATA_VALUE_CUSTOM_NAME = 2
@SubscribeEvent
fun onDataWatcherUpdate(event: DataWatcherUpdatedEvent) {
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 427fbb902..2e56a536b 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
@@ -61,7 +61,7 @@ object BingoNextStepHelper {
private val itemIslandRequired = mutableMapOf<String, IslandVisitStep>()
private val itemPreconditions = mutableMapOf<String, NextStep>()
private val islands = mutableMapOf<IslandType, IslandVisitStep>()
- private val rhysTaskName = "30x Enchanted Minerals (Redstone, Lapis Lazuli, Coal) (for Rhys)"
+ private const val RHYS_TASK_NAME = "30x Enchanted Minerals (Redstone, Lapis Lazuli, Coal) (for Rhys)"
private val finalSteps = mutableListOf<NextStep>()
private var currentSteps = emptyList<NextStep>()
@@ -167,7 +167,7 @@ object BingoNextStepHelper {
}
}
}
- if (currentStep is PartialProgressItemsStep && currentStep.displayName == rhysTaskName && 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
}
}
@@ -365,7 +365,7 @@ object BingoNextStepHelper {
private fun rhys() {
val redstoneForRhys = PartialProgressItemsStep(
- rhysTaskName,
+ RHYS_TASK_NAME,
"Redstone",
160 * 10,
mapOf("Redstone" to 1, "Enchanted Redstone" to 160)
@@ -373,7 +373,7 @@ object BingoNextStepHelper {
redstoneForRhys requires IslandType.DEEP_CAVERNS.getStep()
val lapisForRhys = PartialProgressItemsStep(
- rhysTaskName,
+ RHYS_TASK_NAME,
"Lapis Lazuli",
160 * 10,
mapOf("Lapis Lazuli" to 1, "Enchanted Lapis Lazuli" to 160)
@@ -381,7 +381,7 @@ object BingoNextStepHelper {
lapisForRhys requires IslandType.DEEP_CAVERNS.getStep()
val coalForRhys = PartialProgressItemsStep(
- rhysTaskName,
+ RHYS_TASK_NAME,
"Coal",
160 * 10,
mapOf("Coal" to 1, "Enchanted Coal" to 160)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/UniqueGiftingOpportunitiesFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/event/UniqueGiftingOpportunitiesFeatures.kt
index e24a66594..b1939a793 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/UniqueGiftingOpportunitiesFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/UniqueGiftingOpportunitiesFeatures.kt
@@ -57,12 +57,12 @@ object UniqueGiftingOpportunitiesFeatures {
private fun isEnabled() = holdingGift
- private val hasNotGiftedNametag = "§a§lꤥ"
- private val hasGiftedNametag = "§c§lꤥ"
+ private const val HAS_NOT_GIFTED_NAMETAG = "§a§lꤥ"
+ private const val HAS_GIFTED_NAMETAG = "§c§lꤥ"
private fun analyzeArmorStand(entity: EntityArmorStand) {
if (!config.useArmorStandDetection) return
- if (entity.name != hasGiftedNametag) return
+ if (entity.name != HAS_GIFTED_NAMETAG) return
val matchedPlayer = EntityUtils.getEntitiesNearby<EntityPlayer>(entity.getLorenzVec(), 2.0)
.singleOrNull { !it.isNPC() } ?: return
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/MythicRabbitPetWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/MythicRabbitPetWarning.kt
index 8162f3a05..833583ad0 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/MythicRabbitPetWarning.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/MythicRabbitPetWarning.kt
@@ -7,8 +7,8 @@ import at.hannibal2.skyhanni.utils.SimpleTimeMark
import kotlin.time.Duration.Companion.seconds
object MythicRabbitPetWarning {
- val mythicRabbit = "§dRabbit"
- var lastCheck = SimpleTimeMark.farPast()
+ private const val MYTHIC_RABBIT_DISPLAY_NAME = "§dRabbit"
+ private var lastCheck = SimpleTimeMark.farPast()
fun check() {
if (!HoppityEggsManager.config.petWarning) return
@@ -21,7 +21,7 @@ object MythicRabbitPetWarning {
}
}
- fun correctPet() = PetAPI.isCurrentPet(mythicRabbit)
+ fun correctPet() = PetAPI.isCurrentPet(MYTHIC_RABBIT_DISPLAY_NAME)
private fun warn() {
ChatUtils.chat("Use a §dMythic Rabbit Pet §efor more chocolate!")
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt
index 12f3accd1..a3e869087 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt
@@ -98,8 +98,8 @@ object FishingProfitTracker {
private val MAGMA_FISH by lazy { "MAGMA_FISH".asInternalName() }
- private val nameAll: CategoryName = "All"
- private var currentCategory: CategoryName = nameAll
+ private const val NAME_ALL: CategoryName = "All"
+ private var currentCategory: CategoryName = NAME_ALL
private var itemCategories = mapOf<String, List<NEUInternalName>>()
@@ -110,7 +110,7 @@ object FishingProfitTracker {
private fun getCurrentCategories(data: Data): Map<CategoryName, Int> {
val map = mutableMapOf<CategoryName, Int>()
- map[nameAll] = data.items.size
+ map[NAME_ALL] = data.items.size
for ((name, items) in itemCategories) {
val amount = items.count { it in data.items }
if (amount > 0) {
@@ -145,7 +145,7 @@ object FishingProfitTracker {
checkMissingItems(data)
val list = amounts.keys.toList()
if (currentCategory !in list) {
- currentCategory = nameAll
+ currentCategory = NAME_ALL
}
if (tracker.isInventoryOpen()) {
@@ -160,7 +160,7 @@ object FishingProfitTracker {
)
}
- val filter: (NEUInternalName) -> Boolean = if (currentCategory == nameAll) {
+ val filter: (NEUInternalName) -> Boolean = if (currentCategory == NAME_ALL) {
{ true }
} else {
val items = itemCategories[currentCategory]!!
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt
index b293c2736..f050e56cd 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt
@@ -55,12 +55,12 @@ object SeaCreatureTracker {
}
}
- private val nameAll: CategoryName = "All"
- private var currentCategory: CategoryName = nameAll
+ private const val NAME_ALL: CategoryName = "All"
+ private var currentCategory: CategoryName = NAME_ALL
private fun getCurrentCategories(data: Data): Map<CategoryName, Int> {
val map = mutableMapOf<CategoryName, Int>()
- map[nameAll] = data.amount.size
+ map[NAME_ALL] = data.amount.size
for ((category, names) in SeaCreatureManager.allVariants) {
val amount = names.count { it in data.amount }
if (amount > 0) {
@@ -103,7 +103,7 @@ object SeaCreatureTracker {
val amounts = getCurrentCategories(data)
val list = amounts.keys.toList()
if (currentCategory !in list) {
- currentCategory = nameAll
+ currentCategory = NAME_ALL
}
if (tracker.isInventoryOpen()) {
@@ -118,7 +118,7 @@ object SeaCreatureTracker {
)
}
- return if (currentCategory == nameAll) {
+ return if (currentCategory == NAME_ALL) {
{ true }
} else filterCurrentCategory()
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/BeaconPower.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/BeaconPower.kt
index 76990b37a..8c68dc2c1 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/gui/BeaconPower.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/gui/BeaconPower.kt
@@ -58,8 +58,8 @@ object BeaconPower {
private var display = ""
- private val BEACON_POWER_SLOT = 22
- private val STATS_SLOT = 23
+ private const val BEACON_POWER_SLOT = 22
+ private const val STATS_SLOT = 23
@SubscribeEvent
fun onInventoryUpdate(event: InventoryUpdatedEvent) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt
index a3da970c6..c9fb4b15f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt
@@ -48,7 +48,7 @@ object CustomScoreboard {
private var display = emptyList<ScoreboardElementType>()
private var cache = emptyList<ScoreboardElementType>()
- private val guiName = "Custom Scoreboard"
+ private const val GUI_NAME = "Custom Scoreboard"
// Cached scoreboard data, only update after no change for 300ms
var activeLines = emptyList<String>()
@@ -80,12 +80,12 @@ object CustomScoreboard {
RenderBackground.updatePosition(finalRenderable)
- config.position.renderRenderable(finalRenderable, posLabel = guiName)
+ config.position.renderRenderable(finalRenderable, posLabel = GUI_NAME)
}
@SubscribeEvent
fun onGuiPositionMoved(event: GuiPositionMovedEvent) {
- if (event.guiName == guiName) {
+ if (event.guiName == GUI_NAME) {
with(alignmentConfig) {
if (horizontalAlignment != HorizontalAlignment.DONT_ALIGN ||
verticalAlignment != VerticalAlignment.DONT_ALIGN
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 c34b08125..e0d7e207c 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/SkyblockGuideHighlightFeature.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/SkyblockGuideHighlightFeature.kt
@@ -21,8 +21,8 @@ import org.intellij.lang.annotations.Language
val patternGroup = RepoPattern.group("skyblockguide.highlight")
-private const val keyPrefixInventory = "inventory"
-private const val keyPrefixCondition = "condition"
+private const val KEY_PREFIX_INVENTORY = "inventory"
+private const val KEY_PREFIX_CONDITION = "condition"
class SkyblockGuideHighlightFeature private constructor(
private val config: () -> Boolean,
@@ -44,8 +44,8 @@ class SkyblockGuideHighlightFeature private constructor(
onTooltip: (LorenzToolTipEvent) -> Unit = {},
) : this(
config,
- patternGroup.pattern("$key.$keyPrefixInventory", inventory),
- patternGroup.pattern("$key.$keyPrefixCondition", loreCondition),
+ patternGroup.pattern("$key.$KEY_PREFIX_INVENTORY", inventory),
+ patternGroup.pattern("$key.$KEY_PREFIX_CONDITION", loreCondition),
onSlotClicked,
onTooltip
)
@@ -59,7 +59,7 @@ class SkyblockGuideHighlightFeature private constructor(
onTooltip: (LorenzToolTipEvent) -> Unit = {},
) : this(
config,
- patternGroup.pattern("$key.$keyPrefixInventory", inventory),
+ patternGroup.pattern("$key.$KEY_PREFIX_INVENTORY", inventory),
loreCondition,
onSlotClicked,
onTooltip
@@ -132,13 +132,13 @@ class SkyblockGuideHighlightFeature private constructor(
}
private val taskOnlyCompleteOncePattern =
- patternGroup.pattern("$keyPrefixCondition.once", "§7§eThis task can only be completed once!")
- private val xPattern = patternGroup.pattern("$keyPrefixCondition.x", "§c ?✖.*")
+ patternGroup.pattern("$KEY_PREFIX_CONDITION.once", "§7§eThis task can only be completed once!")
+ private val xPattern = patternGroup.pattern("$KEY_PREFIX_CONDITION.x", "§c ?✖.*")
private val totalProgressPattern =
- patternGroup.pattern("$keyPrefixCondition.total", "§7Total Progress: §3\\d{1,2}(?:\\.\\d)?%")
+ patternGroup.pattern("$KEY_PREFIX_CONDITION.total", "§7Total Progress: §3\\d{1,2}(?:\\.\\d)?%")
private val categoryProgressPattern =
patternGroup.pattern(
- "$keyPrefixCondition.category",
+ "$KEY_PREFIX_CONDITION.category",
"§7Progress to Complete Category: §6\\d{1,2}(?:\\.\\d)?%"
)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/ExperimentationTableAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/ExperimentationTableAPI.kt
index 0c7fc1a73..25abb16ed 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/ExperimentationTableAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/ExperimentationTableAPI.kt
@@ -35,12 +35,13 @@ object ExperimentationTableAPI {
fun onInventoryUpdated(event: InventoryUpdatedEvent) {
if (LorenzUtils.skyBlockIsland != IslandType.PRIVATE_ISLAND || !inTable) return
- val entity = EntityUtils.getEntities<EntityArmorStand>().find { it.hasSkullTexture(experimentationTableSkull) } ?: return
+ val entity = EntityUtils.getEntities<EntityArmorStand>().find { it.hasSkullTexture(EXPERIMENTATION_TABLE_SKULL) } ?: return
val vec = entity.getLorenzVec()
if (storage?.tablePos != vec) storage?.tablePos = vec
}
- private val experimentationTableSkull =
+ // TODO: Add to repo
+ private const val EXPERIMENTATION_TABLE_SKULL =
"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTUyOWF" +
"iYzg4MzA5NTNmNGQ5MWVkZmZmMjQ2OTVhOWY2Mjc1OGZhNGM1MWIyOWFjMjQ2YzM3NDllYWFlODliMyJ9fX0="
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/UserLuckBreakdown.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/UserLuckBreakdown.kt
index f1fad4e63..63d64bbb0 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/UserLuckBreakdown.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/UserLuckBreakdown.kt
@@ -38,19 +38,19 @@ object UserLuckBreakdown {
private lateinit var mainLuckItem: ItemStack
private val mainLuckID = "ENDER_PEARL".asInternalName()
- private val mainLuckName = "§a✴ SkyHanni User Luck"
+ private const val MAIN_LUCK_NAME = "§a✴ SkyHanni User Luck"
private lateinit var fillerItem: ItemStack
private var fillerID = "STAINED_GLASS_PANE".asInternalName()
- private val fillerName = " "
+ private const val FILLER_NAME = " "
private lateinit var limboItem: ItemStack
private var limboID = "ENDER_PEARL".asInternalName()
- private val limboName = "§a✴ Limbo Personal Best"
+ private const val LIMBO_NAME = "§a✴ Limbo Personal Best"
private lateinit var skillsItem: ItemStack
private var skillsID = "DIAMOND_SWORD".asInternalName()
- private val skillsName = "§a✴ Category: Skills"
+ private const val SKILLS_NAME = "§a✴ Category: Skills"
private var showAllStats = true
@@ -63,7 +63,7 @@ object UserLuckBreakdown {
"§7Show all stats: §.(?<toggle>.*)",
)
- private val luckTooltipString = "§5§o §a✴ SkyHanni User Luck §f"
+ private const val LUCK_TOOLTIP = "§5§o §a✴ SkyHanni User Luck §f"
private var inCustomBreakdown = false
private val validItemSlots = (10..53).filter { it !in listOf(17, 18, 26, 27, 35, 36) && it !in 44..53 }
@@ -178,7 +178,7 @@ object UserLuckBreakdown {
if (lastIndex == -1) return
val luckString = tryTruncateFloat(totalLuck)
- event.toolTip.add(lastIndex, "$luckTooltipString$luckString")
+ event.toolTip.add(lastIndex, "$LUCK_TOOLTIP$luckString")
}
private fun statsBreakdownLoreTooltip(event: LorenzToolTipEvent, limboLuck: Float) {
@@ -205,7 +205,7 @@ object UserLuckBreakdown {
if (totalLuck == 0f) return
val luckString = tryTruncateFloat(totalLuck)
- event.toolTip.add(lastIndex, "$luckTooltipString$luckString")
+ event.toolTip.add(lastIndex, "$LUCK_TOOLTIP$luckString")
}
private fun tryTruncateFloat(input: Float): String {
@@ -239,7 +239,7 @@ object UserLuckBreakdown {
private fun createItems() {
fillerItem = ItemUtils.createItemStack(
fillerID.getItemStack().item,
- fillerName,
+ FILLER_NAME,
listOf(),
1,
15,
@@ -251,17 +251,17 @@ object UserLuckBreakdown {
mainLuckItem = ItemUtils.createItemStack(
mainLuckID.getItemStack().item,
- "$mainLuckName §f${tryTruncateFloat(totalLuck)}",
+ "$MAIN_LUCK_NAME §f${tryTruncateFloat(totalLuck)}",
*createItemLore("mainMenu", totalLuck),
)
limboItem = ItemUtils.createItemStack(
limboID.getItemStack().item,
- limboName,
+ LIMBO_NAME,
*createItemLore("limbo", limboLuck),
)
skillsItem = ItemUtils.createItemStack(
skillsID.getItemStack().item,
- skillsName,
+ SKILLS_NAME,
*createItemLore("skills"),
)
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboPlaytime.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboPlaytime.kt
index 1c46b40d6..443f5c80b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboPlaytime.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboPlaytime.kt
@@ -43,7 +43,7 @@ object LimboPlaytime {
private val enabled get() = SkyHanniMod.feature.misc.showLimboTimeInPlaytimeDetailed
private val itemID = "ENDER_PEARL".asInternalName()
- private val itemName = "§aLimbo"
+ private const val ITEM_NAME = "§aLimbo"
private lateinit var limboItem: ItemStack
private var lastCreateCooldown = SimpleTimeMark.farPast()
@@ -60,7 +60,7 @@ object LimboPlaytime {
lastCreateCooldown = SimpleTimeMark.now()
limboItem = ItemUtils.createItemStack(
itemID.getItemStack().item,
- itemName,
+ ITEM_NAME,
*createItemLore()
)
}
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 c333550f6..9e92b0807 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
@@ -28,7 +28,7 @@ object CruxTalismanDisplay {
".*(?<tier>§[0-9a-z][IV1-4-]+)\\s+(?<name>§[0-9a-z]\\w+)§[0-9a-z]:\\s*(?<progress>§[0-9a-z](?:§[0-9a-z])?MAXED|§[0-9a-z]\\d+§[0-9a-z]/§[0-9a-z]\\d+).*"
)
- private val partialName = "CRUX_TALISMAN"
+ private const val PARTIAL_NAME = "CRUX_TALISMAN"
private var display = emptyList<List<Any>>()
private val displayLine = mutableListOf<Crux>()
private val bonusesLine = mutableListOf<String>()
@@ -91,7 +91,7 @@ object CruxTalismanDisplay {
fun onSecondPassed(event: SecondPassedEvent) {
if (!isEnabled()) return
if (!event.repeatSeconds(2)) return
- if (!InventoryUtils.getItemsInOwnInventory().any { it.getInternalName().startsWith(partialName) }) return
+ if (!InventoryUtils.getItemsInOwnInventory().any { it.getInternalName().startsWith(PARTIAL_NAME) }) return
displayLine.clear()
bonusesLine.clear()
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 f60517e4c..57aa65e53 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt
@@ -60,9 +60,11 @@ object VampireSlayerFeatures {
// Nicked support
private val username
get() = EntityUtils.getEntities<EntityPlayerSP>().firstOrNull()?.name ?: error("own player is null")
- private val bloodIchorTexture =
+
+ // TODO: Add to repo
+ private const val BLOOD_ICHOR_TEXTURE =
"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzAzNDA5MjNhNmRlNDgyNWExNzY4MTNkMTMzNTAzZWZmMTg2ZGIwODk2ZTMyYjY3MDQ5MjhjMmEyYmY2ODQyMiJ9fX0="
- private val killerSpringTexture =
+ private const val KILLER_SPRING_TEXTURE =
"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzdmN2E3YmM4YWM4NmYyM2NhN2JmOThhZmViNzY5NjAyMjdlMTgzMmZlMjA5YTMwMjZmNmNlYjhiZGU3NGY1NCJ9fX0="
private var nextClawSend = 0L
@@ -82,8 +84,8 @@ object VampireSlayerFeatures {
for (stand in EntityUtils.getEntities<EntityArmorStand>()) {
val vec = stand.position.toLorenzVec()
val distance = start.distance(vec)
- val isIchor = stand.hasSkullTexture(bloodIchorTexture)
- if (isIchor || stand.hasSkullTexture(killerSpringTexture)) {
+ val isIchor = stand.hasSkullTexture(BLOOD_ICHOR_TEXTURE)
+ if (isIchor || stand.hasSkullTexture(KILLER_SPRING_TEXTURE)) {
val color = (if (isIchor) configBloodIchor.color else configKillerSpring.color)
.toChromaColor().withAlpha(config.withAlpha)
if (distance <= 15) {
@@ -275,8 +277,8 @@ object VampireSlayerFeatures {
for (stand in Minecraft.getMinecraft().theWorld.loadedEntityList.filterIsInstance<EntityArmorStand>()) {
val vec = stand.position.toLorenzVec()
val distance = start.distance(vec)
- val isIchor = stand.hasSkullTexture(bloodIchorTexture)
- val isSpring = stand.hasSkullTexture(killerSpringTexture)
+ val isIchor = stand.hasSkullTexture(BLOOD_ICHOR_TEXTURE)
+ val isSpring = stand.hasSkullTexture(KILLER_SPRING_TEXTURE)
if (!(isIchor && config.bloodIchor.highlight) && !(isSpring && config.killerSpring.highlight)) continue
val color = (if (isIchor) configBloodIchor.color else configKillerSpring.color)
.toChromaColor().withAlpha(config.withAlpha)
@@ -336,7 +338,7 @@ object VampireSlayerFeatures {
for (player in EntityUtils.getEntitiesNearby<EntityOtherPlayerMP>(loc, 3.0)) {
if (!player.isHighlighted() || event.type != EnumParticleTypes.ENCHANTMENT_TABLE) continue
for (stand in EntityUtils.getEntitiesNearby<EntityArmorStand>(event.location, 3.0)) {
- if (stand.hasSkullTexture(killerSpringTexture) || stand.hasSkullTexture(bloodIchorTexture)) {
+ if (stand.hasSkullTexture(KILLER_SPRING_TEXTURE) || stand.hasSkullTexture(BLOOD_ICHOR_TEXTURE)) {
standList = standList.editCopy { this[stand] = player }
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/guide/GuideGUI.kt b/src/main/java/at/hannibal2/skyhanni/utils/guide/GuideGUI.kt
index 944a3201a..4e06b22ea 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/guide/GuideGUI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/guide/GuideGUI.kt
@@ -8,11 +8,11 @@ import net.minecraft.client.gui.GuiScreen
import net.minecraft.client.renderer.GlStateManager
import net.minecraft.item.ItemStack
-const val selectedColor = 0x50000000
-const val notSelectedColor = 0x50303030
-const val tabSpacing = 5
-const val tabShortSide = 25
-const val tabLongSide = 28
+const val SELECTED_COLOR = 0x50000000
+const val NOT_SELECTED_COLOR = 0x50303030
+const val TAB_SPACING = 5
+const val TAB_SHORT_SIDE = 25
+const val TAB_LONG_SIDE = 28
abstract class GuideGUI<pageEnum : Enum<*>>(defaultScreen: pageEnum) : GuiScreen() {
@@ -50,11 +50,11 @@ abstract class GuideGUI<pageEnum : Enum<*>>(defaultScreen: pageEnum) : GuiScreen
}
private fun renderHorizontalTabs() {
- var offset = Pair(tabSpacing.toFloat() * 3f, -tabLongSide.toFloat())
+ var offset = Pair(TAB_SPACING.toFloat() * 3f, -TAB_LONG_SIDE.toFloat())
GlStateManager.translate(offset.first, offset.second, 0f)
for (tab in horizontalTabs) {
tab.render(offset.first.toInt(), offset.second.toInt())
- val xShift = (tabShortSide + tabSpacing).toFloat()
+ val xShift = (TAB_SHORT_SIDE + TAB_SPACING).toFloat()
offset = offset.first + xShift to offset.second
GlStateManager.translate(xShift, 0f, 0f)
}
@@ -62,11 +62,11 @@ abstract class GuideGUI<pageEnum : Enum<*>>(defaultScreen: pageEnum) : GuiScreen
}
private fun renderVerticalTabs() {
- var offset = Pair(-tabLongSide.toFloat(), tabSpacing.toFloat() * 3f)
+ var offset = Pair(-TAB_LONG_SIDE.toFloat(), TAB_SPACING.toFloat() * 3f)
GlStateManager.translate(offset.first, offset.second, 0f)
for (tab in verticalTabs) {
tab.render(offset.first.toInt(), offset.second.toInt())
- val yShift = (tabShortSide + tabSpacing).toFloat()
+ val yShift = (TAB_SHORT_SIDE + TAB_SPACING).toFloat()
offset = offset.first to offset.second + yShift
GlStateManager.translate(0f, yShift, 0f)
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/guide/GuideTab.kt b/src/main/java/at/hannibal2/skyhanni/utils/guide/GuideTab.kt
index acc69c8cc..231402d33 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/guide/GuideTab.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/guide/GuideTab.kt
@@ -28,19 +28,19 @@ class GuideTab(
}
fun select() {
- selectColor = selectedColor
+ selectColor = SELECTED_COLOR
}
fun unSelect() {
- selectColor = notSelectedColor
+ selectColor = NOT_SELECTED_COLOR
}
- fun isSelected() = selectColor == selectedColor
+ fun isSelected() = selectColor == SELECTED_COLOR
- val width = if (isVertical) tabLongSide else tabShortSide
- val height = if (isVertical) tabShortSide else tabLongSide
+ val width = if (isVertical) TAB_LONG_SIDE else TAB_SHORT_SIDE
+ val height = if (isVertical) TAB_SHORT_SIDE else TAB_LONG_SIDE
- private var selectColor = notSelectedColor
+ private var selectColor = NOT_SELECTED_COLOR
private val renderable = Renderable.clickAndHover(object : Renderable {
override val width = this@GuideTab.width
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/renderables/Searchable.kt b/src/main/java/at/hannibal2/skyhanni/utils/renderables/Searchable.kt
index 4a81830a8..d2191462f 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/renderables/Searchable.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/renderables/Searchable.kt
@@ -9,14 +9,14 @@ fun Renderable.toSearchable(searchText: String? = null) = Searchable(this, searc
fun Searchable.toRenderable() = renderable
fun List<Searchable>.toRenderable() = map { it.toRenderable() }
fun List<Searchable>.toMap() = associate { it.renderable to it.string }
-val searchPrefix = "§eSearch: §7"
+const val SEARCH_PREFIX = "§eSearch: §7"
fun List<Searchable>.buildSearchBox(
textInput: TextInput,
): Renderable {
val key = 0
return Renderable.searchBox(
Renderable.verticalSearchableContainer(toMap(), textInput = textInput, key = key + 1),
- searchPrefix,
+ SEARCH_PREFIX,
onUpdateSize = { println("onUpdateSize") },
textInput = textInput,
key = key,
@@ -39,7 +39,7 @@ fun List<Searchable>.buildSearchableScrollable(
scrollValue = scrollValue,
velocity = velocity,
),
- searchPrefix,
+ SEARCH_PREFIX,
onUpdateSize = { println("onUpdateSize") },
textInput = textInput,
key = key,
@@ -51,7 +51,7 @@ fun Map<List<Renderable>, String?>.buildSearchableTable(): Renderable {
val key = 0
return Renderable.searchBox(
Renderable.searchableTable(toMap(), textInput = textInput, key = key + 1),
- searchPrefix,
+ SEARCH_PREFIX,
onUpdateSize = { println("onUpdateSize") },
textInput = textInput,
key = key,