aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-01-07 22:32:13 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-01-07 22:32:13 +0100
commit204bef3f09e51c88b655e80faa13bb52357d0ff8 (patch)
treef29ce1397e4a886935a56eeb0d3f3cd3151236b2 /src/main/java/at
parent6c19d8e279079879e065e586ee5cc86e7ef74b70 (diff)
downloadskyhanni-204bef3f09e51c88b655e80faa13bb52357d0ff8.tar.gz
skyhanni-204bef3f09e51c88b655e80faa13bb52357d0ff8.tar.bz2
skyhanni-204bef3f09e51c88b655e80faa13bb52357d0ff8.zip
Fixed an error when showing all elements in Powder Tracker.
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/mining/PowderTrackerConfig.java6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt24
3 files changed, 18 insertions, 14 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt
index f9a94e1d0..8fc9239a1 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt
@@ -9,7 +9,7 @@ import com.google.gson.JsonPrimitive
object ConfigUpdaterMigrator {
val logger = LorenzLogger("ConfigMigration")
- const val CONFIG_VERSION = 19
+ const val CONFIG_VERSION = 20
fun JsonElement.at(chain: List<String>, init: Boolean): JsonElement? {
if (chain.isEmpty()) return this
if (this !is JsonObject) return null
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/mining/PowderTrackerConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/mining/PowderTrackerConfig.java
index 1e658c5a2..660c9493c 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/mining/PowderTrackerConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/mining/PowderTrackerConfig.java
@@ -16,7 +16,6 @@ import java.util.List;
import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.AMBER;
import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.AMETHYST;
import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.DIAMOND_ESSENCE;
-import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.DISPLAY_MODE;
import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.DOUBLE_POWDER;
import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.ELECTRON;
import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.FTX;
@@ -29,7 +28,6 @@ import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.P
import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.SAPPHIRE;
import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.SPACER_1;
import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.SPACER_2;
-import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.TITLE;
import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.TOPAZ;
import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.TOTAL_CHESTS;
@@ -58,8 +56,6 @@ public class PowderTrackerConfig {
)
@ConfigEditorDraggableList()
public Property<List<PowderDisplayEntry>> textFormat = Property.of(new ArrayList<>(Arrays.asList(
- TITLE,
- DISPLAY_MODE,
TOTAL_CHESTS,
DOUBLE_POWDER,
MITHRIL_POWDER,
@@ -80,8 +76,6 @@ public class PowderTrackerConfig {
)));
public enum PowderDisplayEntry implements HasLegacyId {
- TITLE("§b§lPowder Tracker", 0),
- DISPLAY_MODE("§7Display Mode: §a[Total] §e[This Session]", 1),
TOTAL_CHESTS("§d852 Total chests Picked §7(950/h)", 2),
DOUBLE_POWDER("§bx2 Powder: §aActive!", 3),
MITHRIL_POWDER("§b250,420 §aMithril Powder §7(350,000/h)", 4),
diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt
index ce5a8dd48..be35e0e55 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt
@@ -18,6 +18,8 @@ import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.tracker.SkyHanniTracker
import at.hannibal2.skyhanni.utils.tracker.TrackerData
+import com.google.gson.JsonArray
+import com.google.gson.JsonNull
import com.google.gson.annotations.Expose
import net.minecraft.entity.boss.BossStatus
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -178,10 +180,24 @@ object PowderTracker {
event.transform(11, "mining.powderTracker.textFormat") { element ->
ConfigUtils.migrateIntArrayListToEnumArrayList(element, PowderDisplayEntry::class.java)
}
+
+ event.transform(20, "mining.powderTracker.textFormat") { element ->
+ val newList = JsonArray()
+ for (entry in element.asJsonArray) {
+ if (entry is JsonNull) continue
+ if (entry.asString.let { it != "TITLE" && it != "DISPLAY_MODE" }) {
+ newList.add(entry)
+ }
+ }
+ newList
+ }
}
- private fun formatDisplay(map: List<List<Any>>) = buildList {
+ private fun formatDisplay(map: List<List<Any>>) = buildList<List<Any>> {
if (map.isEmpty()) return@buildList
+
+ addAsSingletonList("§b§lPowder Tracker")
+
for (index in config.textFormat.get()) {
// TODO, change functionality to use enum rather than ordinals
add(map[index.ordinal])
@@ -195,12 +211,6 @@ object PowderTracker {
calculate(data, goldEssenceInfo, PowderChestReward.GOLD_ESSENCE)
calculateChest(data)
- addAsSingletonList("§b§lPowder Tracker")
-
- if (!tracker.isInventoryOpen()) {
- addAsSingletonList("")
- }
-
val chestPerHour = format(chestInfo.perHour)
addAsSingletonList("§d${data.totalChestPicked.addSeparators()} Total Chests Picked §7($chestPerHour/h)")
addAsSingletonList("§bDouble Powder: ${if (doublePowder) "§aActive! §7($powderTimer)" else "§cInactive!"}")