aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/data
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/CropAccessoryData.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/EventCounter.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/FriendAPI.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestonesCommunityFix.kt14
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/GardenCropUpgrades.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/GuildAPI.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt29
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/IslandType.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/LocationFixData.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/MayorElection.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/PartyAPI.kt10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt14
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/RenderData.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/TrackerManager.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/ContributorListJson.java1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/GardenJson.java2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/ItemsJson.java1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/model/ComposterUpgrade.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt28
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt8
34 files changed, 115 insertions, 77 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt b/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt
index 08bef76ff..d631e8e26 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt
@@ -9,8 +9,7 @@ import at.hannibal2.skyhanni.features.chat.ChatFilterGui
import at.hannibal2.skyhanni.utils.IdentityCharacteristics
import at.hannibal2.skyhanni.utils.LorenzLogger
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils.chat
-import at.hannibal2.skyhanni.utils.LorenzUtils.makeAccessible
+import at.hannibal2.skyhanni.utils.ReflectionUtils.makeAccessible
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.ChatLine
import net.minecraft.client.gui.GuiNewChat
@@ -54,6 +53,7 @@ object ChatManager {
val renderedString = "$format$name"
companion object {
+
val maxLength by lazy {
entries.maxOf { Minecraft.getMinecraft().fontRendererObj.getStringWidth(it.renderedString) }
}
@@ -64,7 +64,7 @@ object ChatManager {
val message: IChatComponent,
var actionKind: ActionKind,
var actionReason: String?,
- val modified: IChatComponent?
+ val modified: IChatComponent?,
)
@SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true)
@@ -77,7 +77,6 @@ object ChatManager {
val actionBarEvent = LorenzActionBarEvent(message)
actionBarEvent.postAndCatch()
}
-
}
@SubscribeEvent
diff --git a/src/main/java/at/hannibal2/skyhanni/data/CropAccessoryData.kt b/src/main/java/at/hannibal2/skyhanni/data/CropAccessoryData.kt
index ad5d01d3c..9ea5742a1 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/CropAccessoryData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/CropAccessoryData.kt
@@ -20,6 +20,7 @@ import java.io.ByteArrayInputStream
import java.util.Base64
class CropAccessoryData {
+
// TODO USE SH-REPO
private val accessoryBagNamePattern = "Accessory Bag \\((?<current>\\d)/(?<total>\\d)\\)".toPattern()
private var loadedAccessoryThisProfile = false
@@ -89,12 +90,12 @@ class CropAccessoryData {
}
}
-
private fun bestCropAccessory(items: Iterable<ItemStack>) =
items.mapNotNull { item -> CropAccessory.getByName(item.getInternalName()) }
.maxOrNull() ?: CropAccessory.NONE
companion object {
+
var accessoryBagPageCount = 0
private set
diff --git a/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt b/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt
index dec06dc8e..ae5a03878 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt
@@ -13,6 +13,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class EntityMovementData {
companion object {
+
private val entityLocation = mutableMapOf<Entity, LorenzVec>()
fun addToTrack(entity: Entity) {
diff --git a/src/main/java/at/hannibal2/skyhanni/data/EventCounter.kt b/src/main/java/at/hannibal2/skyhanni/data/EventCounter.kt
index 70de5e436..f7a730a65 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/EventCounter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/EventCounter.kt
@@ -1,13 +1,14 @@
package at.hannibal2.skyhanni.data
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import kotlin.time.Duration.Companion.seconds
object EventCounter {
+
private val config get() = SkyHanniMod.feature.dev.debug
private var map = mutableMapOf<String, Int>()
diff --git a/src/main/java/at/hannibal2/skyhanni/data/FriendAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/FriendAPI.kt
index 834ccaa55..c9cfcc62f 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/FriendAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/FriendAPI.kt
@@ -15,6 +15,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.util.UUID
object FriendAPI {
+
// TODO USE SH-REPO
private val removedFriendPattern =
".*\n§r§eYou removed §r(?<name>.*)§e from your friends list!§r§9§m\n.*".toPattern()
diff --git a/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt b/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt
index 34baceb0b..dfa275cb7 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt
@@ -1,5 +1,6 @@
package at.hannibal2.skyhanni.data
+import at.hannibal2.skyhanni.data.jsonobjects.repo.GardenJson
import at.hannibal2.skyhanni.events.CropMilestoneUpdateEvent
import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
@@ -8,11 +9,11 @@ import at.hannibal2.skyhanni.features.garden.GardenAPI
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
-import at.hannibal2.skyhanni.data.jsonobjects.repo.GardenJson
import net.minecraft.item.ItemStack
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
object GardenCropMilestones {
+
// TODO USE SH-REPO
private val cropPattern = "§7Harvest §f(?<name>.*) §7on .*".toPattern()
val totalPattern = "§7Total: §a(?<name>.*)".toPattern()
diff --git a/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestonesCommunityFix.kt b/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestonesCommunityFix.kt
index 71398af27..950f226f1 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestonesCommunityFix.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestonesCommunityFix.kt
@@ -6,11 +6,12 @@ import at.hannibal2.skyhanni.data.jsonobjects.repo.GardenJson
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.features.garden.CropType
import at.hannibal2.skyhanni.features.garden.GardenAPI
+import at.hannibal2.skyhanni.utils.ChatUtils
+import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy
+import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy
-import at.hannibal2.skyhanni.utils.LorenzUtils.nextAfter
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber
import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNecessary
@@ -23,6 +24,7 @@ import net.minecraft.item.ItemStack
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
object GardenCropMilestonesCommunityFix {
+
private val pattern = ".*§e(?<having>.*)§6/§e(?<max>.*)".toPattern()
private var showWrongData = false
private var showWhenAllCorrect = false
@@ -55,7 +57,7 @@ object GardenCropMilestonesCommunityFix {
}
if (data.isNotEmpty()) {
- LorenzUtils.chat(
+ ChatUtils.chat(
"Found §c${data.size} §ewrong crop milestone steps in the menu! " +
"Correct data got put into clipboard. " +
"Please share it on the §bSkyHanni Discord §ein the channel §b#share-data§e."
@@ -63,7 +65,7 @@ object GardenCropMilestonesCommunityFix {
OSUtils.copyToClipboard("```${data.joinToString("\n")}```")
} else {
if (showWhenAllCorrect) {
- LorenzUtils.chat("No wrong crop milestone steps found!")
+ ChatUtils.chat("No wrong crop milestone steps found!")
}
}
}
@@ -71,7 +73,7 @@ object GardenCropMilestonesCommunityFix {
private fun checkForWrongData(
stack: ItemStack,
crop: CropType,
- wrongData: MutableList<String>
+ wrongData: MutableList<String>,
) {
val name = stack.name ?: return
val rawNumber = name.removeColor().replace(crop.cropName, "").trim()
@@ -151,7 +153,7 @@ object GardenCropMilestonesCommunityFix {
}
}
totalFixedValues += fixed
- LorenzUtils.chat("Fixed: $fixed/$alreadyCorrect, total fixes: $totalFixedValues")
+ ChatUtils.chat("Fixed: $fixed/$alreadyCorrect, total fixes: $totalFixedValues")
val s = ConfigManager.gson.toJsonTree(GardenCropMilestones.cropMilestoneData).toString()
OSUtils.copyToClipboard("\"crop_milestones\":$s,")
}
diff --git a/src/main/java/at/hannibal2/skyhanni/data/GardenCropUpgrades.kt b/src/main/java/at/hannibal2/skyhanni/data/GardenCropUpgrades.kt
index 1ea0871ee..c15299ab3 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/GardenCropUpgrades.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/GardenCropUpgrades.kt
@@ -12,6 +12,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class GardenCropUpgrades {
+
// TODO USE SH-REPO
private val tierPattern = "§7Current Tier: §[0-9a-e](\\d)§7/§a9".toRegex()
private val chatUpgradePattern = " {2}§r§6§lCROP UPGRADE §e§f([\\w ]+)§7 #(\\d)".toRegex()
@@ -39,6 +40,7 @@ class GardenCropUpgrades {
}
companion object {
+
private val cropUpgrades: MutableMap<CropType, Int>? get() = GardenAPI.storage?.cropUpgrades
fun CropType.getUpgradeLevel() = cropUpgrades?.get(this)
@@ -46,6 +48,5 @@ class GardenCropUpgrades {
fun CropType.setUpgradeLevel(level: Int) {
cropUpgrades?.put(this, level)
}
-
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt
index 0f1da835b..9c50b1c09 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt
@@ -6,10 +6,11 @@ import at.hannibal2.skyhanni.config.core.config.gui.GuiPositionEditor
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.LorenzKeyPressEvent
import at.hannibal2.skyhanni.test.SkyHanniDebugsAndTests
+import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils.getPropertiesWithType
import at.hannibal2.skyhanni.utils.LorenzUtils.isRancherSign
import at.hannibal2.skyhanni.utils.NEUItems
+import at.hannibal2.skyhanni.utils.ReflectionUtils.getPropertiesWithType
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField
import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer
@@ -78,7 +79,7 @@ class GuiEditManager {
SkyHanniMod.screenToOpen = GuiPositionEditor(latestPositions.values.toList(), 2)
if (hotkeyReminder && lastHotkeyReminded.passedSince() > 30.minutes) {
lastHotkeyReminded = SimpleTimeMark.now()
- LorenzUtils.chat(
+ ChatUtils.chat(
"§eTo edit hidden GUI elements:\n" +
" §7- §e1. Set a key in /sh edit.\n" +
" §7- §e2. Click that key while the GUI element is visible."
@@ -116,7 +117,7 @@ class GuiEditManager {
fun Position.getAbsY() = getAbsY0(getDummySize(true).y)
fun GuiProfileViewer.anyTextBoxFocused() =
- this.getPropertiesWithType<GuiElementTextField>().any{it.focus}
+ this.getPropertiesWithType<GuiElementTextField>().any { it.focus }
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/data/GuildAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/GuildAPI.kt
index 5a4fb4f99..f4273e745 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/GuildAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/GuildAPI.kt
@@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.cleanPlayerName
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
object GuildAPI {
+
private var inGuildMessage = false
private val list = mutableListOf<String>()
diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt
index 3f6ec7051..57889cc48 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt
@@ -10,6 +10,7 @@ import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.events.ProfileJoinEvent
import at.hannibal2.skyhanni.features.bingo.BingoAPI
import at.hannibal2.skyhanni.test.command.ErrorManager
+import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.LorenzLogger
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
@@ -26,6 +27,7 @@ import net.minecraftforge.fml.common.network.FMLNetworkEvent
import kotlin.concurrent.thread
class HypixelData {
+
private val patternGroup = RepoPattern.group("data.hypixeldata")
private val tabListProfilePattern by patternGroup.pattern(
"tablistprofile",
@@ -43,6 +45,7 @@ class HypixelData {
private var lastLocRaw = 0L
companion object {
+
private val patternGroup = RepoPattern.group("data.hypixeldata")
private val serverIdScoreboardPattern by patternGroup.pattern(
"serverid.scoreboard",
@@ -61,7 +64,7 @@ class HypixelData {
var skyBlockIsland = IslandType.UNKNOWN
var serverId: String? = null
- //Ironman, Stranded and Bingo
+ // Ironman, Stranded and Bingo
var noTrade = false
var ironman = false
@@ -95,16 +98,20 @@ class HypixelData {
if (!LorenzUtils.inSkyBlock) return null
if (serverId != null) return serverId
- ScoreboardData.sidebarLinesFormatted.forEach { serverIdScoreboardPattern.matchMatcher(it) {
- val serverType = if (group("servertype") == "M") "mega" else "mini"
- serverId = "$serverType${group("serverid")}"
- return serverId
- } }
+ ScoreboardData.sidebarLinesFormatted.forEach {
+ serverIdScoreboardPattern.matchMatcher(it) {
+ val serverType = if (group("servertype") == "M") "mega" else "mini"
+ serverId = "$serverType${group("serverid")}"
+ return serverId
+ }
+ }
- TabListData.getTabList().forEach { serverIdTablistPattern.matchMatcher(it) {
- serverId = group("serverid")
- return serverId
- } }
+ TabListData.getTabList().forEach {
+ serverIdTablistPattern.matchMatcher(it) {
+ serverId = group("serverid")
+ return serverId
+ }
+ }
return serverId
}
@@ -262,7 +269,7 @@ class HypixelData {
if (skyBlockIsland != islandType) {
IslandChangeEvent(islandType, skyBlockIsland).postAndCatch()
if (islandType == IslandType.UNKNOWN) {
- LorenzUtils.debug("Unknown island detected: '$newIsland'")
+ ChatUtils.debug("Unknown island detected: '$newIsland'")
loggerIslandChange.log("Unknown: '$newIsland'")
} else {
loggerIslandChange.log(islandType.name)
diff --git a/src/main/java/at/hannibal2/skyhanni/data/IslandType.kt b/src/main/java/at/hannibal2/skyhanni/data/IslandType.kt
index a3eef5dd9..e6a01136c 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/IslandType.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/IslandType.kt
@@ -17,7 +17,7 @@ enum class IslandType(val displayName: String, val modeName: String = "null") {
CRYSTAL_HOLLOWS("Crystal Hollows"),
THE_PARK("The Park", "floating_islands_1"),
DEEP_CAVERNS("Deep Caverns", "deep_caverns"),
- GOLD_MINES("Gold Mine", "gold_mine"),//TODO confirm
+ GOLD_MINES("Gold Mine", "gold_mine"),// TODO confirm
GARDEN("Garden"),
GARDEN_GUEST("Garden Guest"),
SPIDER_DEN("Spider's Den"),
@@ -29,6 +29,7 @@ enum class IslandType(val displayName: String, val modeName: String = "null") {
;
companion object {
+
fun getByNameOrUnknown(name: String) = getByNameOrNull(name) ?: UNKNOWN
fun getByName(name: String) = getByNameOrNull(name) ?: error("IslandType not found: '$name'")
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt
index f62ebd800..406901b9d 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt
@@ -38,7 +38,6 @@ class ItemRenderBackground {
}
}
-
@SubscribeEvent
fun renderOverlayLol(event: RenderRealOverlayEvent) {
val stack = event.stack
@@ -70,4 +69,4 @@ class ItemRenderBackground {
GlStateManager.popMatrix()
}
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/data/LocationFixData.kt b/src/main/java/at/hannibal2/skyhanni/data/LocationFixData.kt
index f32256031..728678824 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/LocationFixData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/LocationFixData.kt
@@ -1,13 +1,14 @@
package at.hannibal2.skyhanni.data
+import at.hannibal2.skyhanni.data.jsonobjects.repo.LocationFixJson
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.utils.LocationUtils.isPlayerInside
-import at.hannibal2.skyhanni.data.jsonobjects.repo.LocationFixJson
import net.minecraft.util.AxisAlignedBB
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
object LocationFixData {
+
private var locationFixes = mutableListOf<LocationFix>()
class LocationFix(val island: IslandType, val area: AxisAlignedBB, val realLocation: String)
diff --git a/src/main/java/at/hannibal2/skyhanni/data/MayorElection.kt b/src/main/java/at/hannibal2/skyhanni/data/MayorElection.kt
index 646337a27..e8abad8a9 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/MayorElection.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/MayorElection.kt
@@ -5,8 +5,8 @@ import at.hannibal2.skyhanni.config.ConfigManager
import at.hannibal2.skyhanni.data.jsonobjects.local.MayorJson
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.utils.APIUtil
+import at.hannibal2.skyhanni.utils.CollectionUtils.put
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils.put
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import io.github.moulberry.notenoughupdates.util.SkyBlockTime
import kotlinx.coroutines.Dispatchers
@@ -16,10 +16,12 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.time.Duration.Companion.minutes
class MayorElection {
+
private var lastUpdate = SimpleTimeMark.farPast()
private var dispatcher = Dispatchers.IO
companion object {
+
var rawMayorData: MayorJson? = null
var candidates = mapOf<Int, MayorJson.Candidate>()
var currentCandidate: MayorJson.Candidate? = null
diff --git a/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt b/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt
index fa8494dcb..72395b4fc 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt
@@ -13,6 +13,7 @@ import net.minecraft.network.play.server.S2FPacketSetSlot
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
object OtherInventoryData {
+
private var currentInventory: Inventory? = null
private var acceptItems = false
private var lateEvent: InventoryUpdatedEvent? = null
@@ -105,6 +106,6 @@ object OtherInventoryData {
val title: String,
val slotCount: Int,
val items: MutableMap<Int, ItemStack> = mutableMapOf(),
- var fullyOpenedOnce: Boolean = false
+ var fullyOpenedOnce: Boolean = false,
)
}
diff --git a/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt b/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt
index 97065766e..824b895bb 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt
@@ -7,12 +7,12 @@ import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.events.OwnInventoryItemUpdateEvent
import at.hannibal2.skyhanni.events.PacketEvent
import at.hannibal2.skyhanni.events.entity.ItemAddInInventoryEvent
+import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut
import at.hannibal2.skyhanni.utils.DelayedRun
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull
import at.hannibal2.skyhanni.utils.ItemUtils.getItemName
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut
import at.hannibal2.skyhanni.utils.NEUInternalName
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
@@ -26,6 +26,7 @@ import kotlin.time.Duration
import kotlin.time.Duration.Companion.milliseconds
class OwnInventoryData {
+
private var itemAmounts = mapOf<NEUInternalName, Int>()
private var dirty = false
private val sackToInventoryChatPattern by RepoPattern.pattern(
diff --git a/src/main/java/at/hannibal2/skyhanni/data/PartyAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/PartyAPI.kt
index daac67f16..22fb8e4f8 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/PartyAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/PartyAPI.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.data
import at.hannibal2.skyhanni.events.LorenzChatEvent
+import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.OSUtils
import at.hannibal2.skyhanni.utils.StringUtils.cleanPlayerName
@@ -13,6 +14,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.random.Random
object PartyAPI {
+
private val patternGroup = RepoPattern.group("data.party")
private val youJoinedPartyPattern by patternGroup.pattern(
"you.joined",
@@ -76,17 +78,17 @@ object PartyAPI {
fun listMembers() {
val size = partyMembers.size
if (size == 0) {
- LorenzUtils.chat("No tracked party members!")
+ ChatUtils.chat("No tracked party members!")
return
}
- LorenzUtils.chat("Tracked party members §7($size) §f:", prefixColor = "§a")
+ ChatUtils.chat("Tracked party members §7($size) §f:", prefixColor = "§a")
for (member in partyMembers) {
- LorenzUtils.chat(" §a- §7$member", false)
+ ChatUtils.chat(" §a- §7$member", false)
}
if (Random.nextDouble() < 0.1) {
OSUtils.openBrowser("https://www.youtube.com/watch?v=iANP7ib7CPA")
- LorenzUtils.hoverableChat("§7Are You Ready To Party?", listOf("§b~Spongebob"), prefix = false)
+ ChatUtils.hoverableChat("§7Are You Ready To Party?", listOf("§b~Spongebob"), prefix = false)
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt b/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt
index 8e6f9bb7d..e4b54115c 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt
@@ -11,12 +11,14 @@ import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.events.PreProfileSwitchEvent
import at.hannibal2.skyhanni.events.ProfileJoinEvent
import at.hannibal2.skyhanni.events.TabListUpdateEvent
+import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
object ProfileStorageData {
+
var playerSpecific: Storage.PlayerSpecific? = null
var profileSpecific: Storage.ProfileSpecific? = null
var loaded = false
@@ -47,11 +49,11 @@ object ProfileStorageData {
val playerSpecific = playerSpecific
val sackPlayers = sackPlayers
if (playerSpecific == null) {
- LorenzUtils.error("profileSpecific after profile swap can not be set: playerSpecific is null!")
+ ChatUtils.error("profileSpecific after profile swap can not be set: playerSpecific is null!")
return
}
if (sackPlayers == null) {
- LorenzUtils.error("sackPlayers after profile swap can not be set: sackPlayers is null!")
+ ChatUtils.error("sackPlayers after profile swap can not be set: sackPlayers is null!")
return
}
loadProfileSpecific(playerSpecific, sackPlayers, profileName)
@@ -63,11 +65,11 @@ object ProfileStorageData {
val playerSpecific = playerSpecific
val sackPlayers = sackPlayers
if (playerSpecific == null) {
- LorenzUtils.error("playerSpecific is null in ProfileJoinEvent!")
+ ChatUtils.error("playerSpecific is null in ProfileJoinEvent!")
return
}
if (sackPlayers == null) {
- LorenzUtils.error("sackPlayers is null in sackPlayers!")
+ ChatUtils.error("sackPlayers is null in sackPlayers!")
return
}
@@ -104,7 +106,7 @@ object ProfileStorageData {
if (System.currentTimeMillis() > noTabListTime + 3_000) {
noTabListTime = System.currentTimeMillis()
- LorenzUtils.chat(
+ ChatUtils.chat(
"Extra Information from Tab list not found! " +
"Enable it: SkyBlock Menu ➜ Settings ➜ Personal ➜ User Interface ➜ Player List Info"
)
@@ -114,7 +116,7 @@ object ProfileStorageData {
private fun loadProfileSpecific(
playerSpecific: Storage.PlayerSpecific,
sackProfile: SackData.PlayerSpecific,
- profileName: String
+ profileName: String,
) {
noTabListTime = -1
profileSpecific = playerSpecific.profiles.getOrPut(profileName) { Storage.ProfileSpecific() }
diff --git a/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt
index 0deb53164..e5f226945 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt
@@ -11,6 +11,7 @@ import net.minecraft.client.Minecraft
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class PurseAPI {
+
// TODO USE SH-REPO
private val pattern = "(Piggy|Purse): §6(?<coins>[\\d,]*).*".toPattern()
private var currentPurse = 0.0
diff --git a/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt b/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt
index 917ea9f5d..2ca07b16c 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt
@@ -24,9 +24,9 @@ class RenderData {
if (!SkyHanniDebugsAndTests.globalRender) return
if (GuiEditManager.isInGui() || VisualWordGui.isInGui()) return
- GlStateManager.translate(0f,0f,-3f)
+ GlStateManager.translate(0f, 0f, -3f)
GuiRenderEvent.GuiOverlayRenderEvent().postAndCatch()
- GlStateManager.translate(0f,0f,3f)
+ GlStateManager.translate(0f, 0f, 3f)
}
@SubscribeEvent
@@ -40,9 +40,9 @@ class RenderData {
GlStateManager.enableDepth()
if (GuiEditManager.isInGui()) {
- GlStateManager.translate(0f,0f,-3f)
+ GlStateManager.translate(0f, 0f, -3f)
GuiRenderEvent.GuiOverlayRenderEvent().postAndCatch()
- GlStateManager.translate(0f,0f,3f)
+ GlStateManager.translate(0f, 0f, 3f)
}
GuiRenderEvent.ChestGuiOverlayRenderEvent().postAndCatch()
diff --git a/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt
index fe6dc189d..ee9ea621c 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt
@@ -11,11 +11,11 @@ import at.hannibal2.skyhanni.events.SackDataUpdateEvent
import at.hannibal2.skyhanni.features.fishing.FishingAPI
import at.hannibal2.skyhanni.features.fishing.trophy.TrophyRarity
import at.hannibal2.skyhanni.features.inventory.SackDisplay
+import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy
import at.hannibal2.skyhanni.utils.NEUInternalName
import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
import at.hannibal2.skyhanni.utils.NEUItems.getNpcPriceOrNull
@@ -30,6 +30,7 @@ import net.minecraft.item.ItemStack
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
object SackAPI {
+
private val sackDisplayConfig get() = SkyHanniMod.feature.inventory.sackDisplay
private val chatConfig get() = SkyHanniMod.feature.chat
private var lastOpenedInventory = ""
@@ -337,12 +338,12 @@ object SackAPI {
data class SackItem(
@Expose val amount: Long,
@Expose val lastChange: Int,
- @Expose private val status: SackStatus?
+ @Expose private val status: SackStatus?,
) {
+
fun getStatus() = status ?: SackStatus.MISSING
}
-
private val gemstoneMap = mapOf(
"Jade Gemstones" to "ROUGH_JADE_GEM".asInternalName(),
"Amber Gemstones" to "ROUGH_AMBER_GEM".asInternalName(),
@@ -356,6 +357,7 @@ private val gemstoneMap = mapOf(
// ideally should be correct but using alright should also be fine unless they sold their whole sacks
enum class SackStatus {
+
MISSING,
CORRECT,
ALRIGHT,
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt
index 71d84328c..661330f92 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt
@@ -12,6 +12,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class ScoreboardData {
companion object {
+
// TODO USE SH-REPO
private val splitIcons = listOf(
"\uD83C\uDF6B",
@@ -93,4 +94,4 @@ class ScoreboardData {
ScorePlayerTeam.formatPlayerName(scoreboard.getPlayersTeam(it.playerName), it.playerName)
}
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt b/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt
index d2726c3aa..f7915a94c 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt
@@ -14,6 +14,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class SkillExperience {
+
// TODO USE SH-REPO
private val actionBarPattern = ".*§3\\+.* (?<skill>.*) \\((?<overflow>.*)/(?<needed>.*)\\).*".toPattern()
private val inventoryPattern = ".* §e(?<number>.*)§6/.*".toPattern()
@@ -79,6 +80,7 @@ class SkillExperience {
}
companion object {
+
private val skillExp = mutableMapOf<String, Long>()
private fun getLevelForExpExactly(experience: Long): Int {
@@ -109,7 +111,7 @@ class SkillExperience {
return 0
}
- //TODO create additional event
+ // TODO create additional event
fun getExpForSkill(skillName: String) = skillExp[skillName.lowercase()] ?: 0
private val levelingExp = listOf(
diff --git a/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt
index ddb5943a0..64d1f6206 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt
@@ -7,9 +7,9 @@ import at.hannibal2.skyhanni.events.SlayerChangeEvent
import at.hannibal2.skyhanni.events.SlayerProgressChangeEvent
import at.hannibal2.skyhanni.events.SlayerQuestCompleteEvent
import at.hannibal2.skyhanni.features.slayer.SlayerType
+import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter
import at.hannibal2.skyhanni.utils.ItemUtils.nameWithEnchantment
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils.nextAfter
import at.hannibal2.skyhanni.utils.NEUInternalName
import at.hannibal2.skyhanni.utils.NEUItems.getItemStack
import at.hannibal2.skyhanni.utils.NEUItems.getNpcPriceOrNull
diff --git a/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt b/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt
index 6dd0c6725..6b904bc37 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt
@@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.data
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.PreProfileSwitchEvent
-import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import io.github.moulberry.moulconfig.internal.TextRenderUtils
import net.minecraft.client.Minecraft
@@ -16,6 +16,7 @@ import kotlin.time.Duration.Companion.seconds
class TitleManager {
companion object {
+
private var originalText = ""
private var display = ""
private var endTime = SimpleTimeMark.farPast()
@@ -38,7 +39,7 @@ class TitleManager {
fun command(args: Array<String>) {
if (args.size < 4) {
- LorenzUtils.userError("Usage: /shsendtitle <duration> <height> <fontSize> <text ..>")
+ ChatUtils.userError("Usage: /shsendtitle <duration> <height> <fontSize> <text ..>")
return
}
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt b/src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt
index 3b8f6b7a7..3d3c9fd58 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt
@@ -36,6 +36,7 @@ class ToolTipData {
}
companion object {
+
var lastSlot: Slot? = null
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/data/TrackerManager.kt b/src/main/java/at/hannibal2/skyhanni/data/TrackerManager.kt
index cea3a5c2f..b59d31394 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/TrackerManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/TrackerManager.kt
@@ -5,8 +5,8 @@ import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.config.features.misc.TrackerConfig.PriceFromEntry
import at.hannibal2.skyhanni.events.ConfigLoadEvent
import at.hannibal2.skyhanni.events.GuiRenderEvent
+import at.hannibal2.skyhanni.utils.ConditionalUtils
import at.hannibal2.skyhanni.utils.ConfigUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -18,7 +18,7 @@ object TrackerManager {
@SubscribeEvent
fun onConfigLoad(event: ConfigLoadEvent) {
val config = SkyHanniMod.feature.misc.tracker.hideCheapItems
- LorenzUtils.onToggle(config.alwaysShowBest, config.minPrice, config.enabled) {
+ ConditionalUtils.onToggle(config.alwaysShowBest, config.minPrice, config.enabled) {
hasChanged = true
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/ContributorListJson.java b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/ContributorListJson.java
index dc2b4a5ac..8ea6d8ef6 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/ContributorListJson.java
+++ b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/ContributorListJson.java
@@ -1,4 +1,5 @@
package at.hannibal2.skyhanni.data.jsonobjects.repo;
+
import com.google.gson.annotations.Expose;
import java.util.List;
diff --git a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/GardenJson.java b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/GardenJson.java
index be015722a..dd00add03 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/GardenJson.java
+++ b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/GardenJson.java
@@ -1,9 +1,9 @@
package at.hannibal2.skyhanni.data.jsonobjects.repo;
import at.hannibal2.skyhanni.features.garden.CropType;
-import at.hannibal2.skyhanni.utils.NEUInternalName;
import at.hannibal2.skyhanni.utils.LorenzRarity;
import at.hannibal2.skyhanni.utils.LorenzVec;
+import at.hannibal2.skyhanni.utils.NEUInternalName;
import com.google.gson.annotations.Expose;
import org.jetbrains.annotations.Nullable;
diff --git a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/ItemsJson.java b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/ItemsJson.java
index ad1aeb2e3..87b5e4e00 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/ItemsJson.java
+++ b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/ItemsJson.java
@@ -5,7 +5,6 @@ import com.google.gson.annotations.Expose;
import java.util.List;
import java.util.Map;
-import java.util.Set;
public class ItemsJson {
@Expose
diff --git a/src/main/java/at/hannibal2/skyhanni/data/model/ComposterUpgrade.kt b/src/main/java/at/hannibal2/skyhanni/data/model/ComposterUpgrade.kt
index 627bfdef7..ecb26b37c 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/model/ComposterUpgrade.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/model/ComposterUpgrade.kt
@@ -9,6 +9,7 @@ enum class ComposterUpgrade(val displayName: String, val slotNumber: Int) {
;
companion object {
+
private fun regexValues() = entries.joinToString("|") { it.displayName }
// TODO USE SH-REPO
diff --git a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt
index b686602bb..021dd183b 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt
@@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.config.ConfigManager
import at.hannibal2.skyhanni.events.DebugDataCollectEvent
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.test.command.ErrorManager
+import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import com.google.gson.JsonObject
@@ -26,6 +27,7 @@ import java.util.concurrent.atomic.AtomicBoolean
import kotlin.time.Duration.Companion.minutes
class RepoManager(private val configLocation: File) {
+
private val gson get() = ConfigManager.gson
private var latestRepoCommit: String? = null
private val repoLocation: File = File(configLocation, "repo")
@@ -33,6 +35,7 @@ class RepoManager(private val configLocation: File) {
private var lastRepoUpdate = SimpleTimeMark.farPast()
companion object {
+
val successfulConstants = mutableListOf<String>()
val unsuccessfulConstants = mutableListOf<String>()
@@ -55,7 +58,7 @@ class RepoManager(private val configLocation: File) {
}
}
- private val atomicShouldManuallyReload = AtomicBoolean(false)//TODO remove the workaround
+ private val atomicShouldManuallyReload = AtomicBoolean(false)// TODO remove the workaround
fun updateRepo() {
atomicShouldManuallyReload.set(true)
@@ -87,7 +90,7 @@ class RepoManager(private val configLocation: File) {
) {
if (unsuccessfulConstants.isEmpty() && lastRepoUpdate.passedSince() < 1.minutes) {
if (command) {
- LorenzUtils.chat("§7The repo is already up to date!")
+ ChatUtils.chat("§7The repo is already up to date!")
atomicShouldManuallyReload.set(false)
}
return@supplyAsync false
@@ -119,7 +122,7 @@ class RepoManager(private val configLocation: File) {
e
).printStackTrace()
if (command) {
- LorenzUtils.error("An error occurred while trying to reload the repo! See logs for more info.")
+ ChatUtils.error("An error occurred while trying to reload the repo! See logs for more info.")
}
return@supplyAsync false
}
@@ -161,10 +164,10 @@ class RepoManager(private val configLocation: File) {
}
comp.complete(null)
if (answerMessage.isNotEmpty() && !error) {
- LorenzUtils.chat("§a$answerMessage")
+ ChatUtils.chat("§a$answerMessage")
}
if (error) {
- LorenzUtils.clickableChat(
+ ChatUtils.clickableChat(
"Error with the repo detected, try /shupdaterepo to fix it!",
"shupdaterepo",
prefixColor = "§c"
@@ -204,33 +207,34 @@ class RepoManager(private val configLocation: File) {
fun displayRepoStatus(joinEvent: Boolean) {
if (joinEvent) {
if (unsuccessfulConstants.isNotEmpty()) {
- LorenzUtils.error(
+ ChatUtils.error(
"§7Repo Issue! Some features may not work. Please report this error on the Discord!\n"
+ "§7Repo Auto Update Value: §c${SkyHanniMod.feature.dev.repoAutoUpdate}\n"
+ "§7If you have Repo Auto Update turned off, please try turning that on.\n"
+ "§cUnsuccessful Constants §7(${unsuccessfulConstants.size}):"
)
for (constant in unsuccessfulConstants) {
- LorenzUtils.chat(" §e- §7$constant")
+ ChatUtils.chat(" §e- §7$constant")
}
}
return
}
if (unsuccessfulConstants.isEmpty() && successfulConstants.isNotEmpty()) {
- LorenzUtils.chat("Repo working fine! Commit hash: $latestRepoCommit", prefixColor = "§a")
+ ChatUtils.chat("Repo working fine! Commit hash: $latestRepoCommit", prefixColor = "§a")
return
}
- LorenzUtils.chat("Repo has errors! Commit has: ${latestRepoCommit ?: "null"}", prefixColor = "§c")
+ ChatUtils.chat("Repo has errors! Commit has: ${latestRepoCommit ?: "null"}", prefixColor = "§c")
+// if (successfulConstants.isNotEmpty()) ChatUtils.chat(
if (successfulConstants.isNotEmpty()) LorenzUtils.chat(
"Successful Constants §7(${successfulConstants.size}):",
prefixColor = "§a"
)
for (constant in successfulConstants) {
- LorenzUtils.chat(" §a- §7$constant", false)
+ ChatUtils.chat(" §a- §7$constant", false)
}
- LorenzUtils.chat("Unsuccessful Constants §7(${unsuccessfulConstants.size}):")
+ ChatUtils.chat("Unsuccessful Constants §7(${unsuccessfulConstants.size}):")
for (constant in unsuccessfulConstants) {
- LorenzUtils.chat(" §e- §7$constant", false)
+ ChatUtils.chat(" §e- §7$constant", false)
}
}
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 7ec70c673..38a08f8d6 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt
@@ -31,7 +31,7 @@ object RepoUtils {
// create output directory if it doesn't exist
if (!dir.exists()) dir.mkdirs()
val fis: FileInputStream
- //buffer for read and write data to file
+ // buffer for read and write data to file
val buffer = ByteArray(1024)
try {
fis = FileInputStream(zipFilePath)
@@ -42,7 +42,7 @@ object RepoUtils {
var fileName = ze.name
fileName = fileName.substring(fileName.split("/").toTypedArray()[0].length + 1)
val newFile = File(destDir + File.separator + fileName)
- //create directories for sub directories in zip
+ // create directories for sub directories in zip
File(newFile.parent).mkdirs()
if (!isInTree(dir, newFile)) {
throw RuntimeException(
@@ -56,11 +56,11 @@ object RepoUtils {
}
fos.close()
}
- //close this ZipEntry
+ // close this ZipEntry
zis.closeEntry()
ze = zis.nextEntry
}
- //close last ZipEntry
+ // close last ZipEntry
zis.closeEntry()
zis.close()
fis.close()