aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-29 13:10:21 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-29 13:10:21 +0200
commit00834cd15e9154018f9e1bb113355a119f1e9a80 (patch)
tree541abf49835f42cbee47f9a1cf273f7abdb91944 /src/main/java/at/hannibal2
parentab471dbbfd660831e7998a1da596d562a2090677 (diff)
downloadskyhanni-00834cd15e9154018f9e1bb113355a119f1e9a80.tar.gz
skyhanni-00834cd15e9154018f9e1bb113355a119f1e9a80.tar.bz2
skyhanni-00834cd15e9154018f9e1bb113355a119f1e9a80.zip
added addAsSingletonList
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/CropMoneyDisplay.kt30
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenBestCropTime.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/SkyMartBestProfit.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt5
10 files changed, 44 insertions, 40 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/CropMoneyDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/CropMoneyDisplay.kt
index 094f890a0..b3f20e353 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/CropMoneyDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/CropMoneyDisplay.kt
@@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.features.bazaar.BazaarApi
import at.hannibal2.skyhanni.features.garden.GardenAPI.Companion.getSpeed
import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.LorenzUtils.sortedDesc
import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.NumberUtil
@@ -16,7 +17,6 @@ import io.github.moulberry.notenoughupdates.NotEnoughUpdates
import kotlinx.coroutines.launch
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
-import java.util.*
class CropMoneyDisplay {
private var display = mutableListOf<List<Any>>()
@@ -66,24 +66,22 @@ class CropMoneyDisplay {
}
if (!ready) {
- newDisplay.add(Collections.singletonList(title))
- newDisplay.add(Collections.singletonList("§eLoading..."))
+ newDisplay.addAsSingletonList(title)
+ newDisplay.addAsSingletonList("§eLoading...")
return newDisplay
}
if (!hasCropInHand && !config.moneyPerHourAlwaysOn) return newDisplay
- newDisplay.add(
- Collections.singletonList(
- if (config.moneyPerHourAdvancedStats) {
- "$title §7(§eSell Offer§7/§eInstant Sell§7/§eNpc Price§7)"
- } else if (LorenzUtils.noTradeMode) {
- "$title §7(§eNpc Price§7)"
- } else {
- "$title §7(§eSell Offer§7)"
- }
- )
+ newDisplay.addAsSingletonList(
+ if (config.moneyPerHourAdvancedStats) {
+ "$title §7(§eSell Offer§7/§eInstant Sell§7/§eNpc Price§7)"
+ } else if (LorenzUtils.noTradeMode) {
+ "$title §7(§eNpc Price§7)"
+ } else {
+ "$title §7(§eSell Offer§7)"
+ }
)
val moneyPerHourData = calculateMoneyPerHour()
@@ -92,12 +90,12 @@ class CropMoneyDisplay {
val message = "money/hr empty but speed data not empty, retry"
LorenzUtils.debug(message)
println(message)
- newDisplay.add(Collections.singletonList("§eStill Loading..."))
+ newDisplay.addAsSingletonList("§eStill Loading...")
ready = false
loaded = false
return newDisplay
}
- newDisplay.add(Collections.singletonList("§cFarm crops to add them to this list!"))
+ newDisplay.addAsSingletonList("§cFarm crops to add them to this list!")
return newDisplay
}
@@ -225,4 +223,4 @@ class CropMoneyDisplay {
}
private fun isEnabled() = GardenAPI.inGarden() && config.moneyPerHourDisplay
-} \ No newline at end of file
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenBestCropTime.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenBestCropTime.kt
index cce6dd67f..139573899 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenBestCropTime.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenBestCropTime.kt
@@ -4,9 +4,9 @@ import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.GardenCropMilestones
import at.hannibal2.skyhanni.data.GardenCropMilestones.Companion.getCounter
import at.hannibal2.skyhanni.features.garden.GardenAPI.Companion.getSpeed
+import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.LorenzUtils.sorted
import at.hannibal2.skyhanni.utils.TimeUtils
-import java.util.*
class GardenBestCropTime {
var display = listOf<List<Any>>()
@@ -34,10 +34,10 @@ class GardenBestCropTime {
}
val title = if (gardenExp) "§2Garden Experience" else "§bSkyBlock Level"
- newList.add(Collections.singletonList("§eBest Crop Time §7($title§7)"))
+ newList.addAsSingletonList("§eBest Crop Time §7($title§7)")
if (sorted.isEmpty()) {
- newList.add(Collections.singletonList("§cFarm crops to add them to this list!"))
+ newList.addAsSingletonList("§cFarm crops to add them to this list!")
return newList
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt
index 6da25ac8b..b39302ef3 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt
@@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.data.SendTitleHelper
import at.hannibal2.skyhanni.events.*
import at.hannibal2.skyhanni.features.garden.GardenAPI.Companion.setSpeed
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
import at.hannibal2.skyhanni.utils.SoundUtils.playSound
import at.hannibal2.skyhanni.utils.TimeUtils
@@ -330,7 +331,7 @@ class GardenCropMilestoneDisplay {
}
if (needsInventory) {
- newList.add(Collections.singletonList("§cOpen §e/cropmilestones §cto update!"))
+ newList.addAsSingletonList("§cOpen §e/cropmilestones §cto update!")
}
return newList
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt
index ef4d06e27..8de0536f9 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt
@@ -10,6 +10,7 @@ import at.hannibal2.skyhanni.utils.*
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.addAsSingletonList
import at.hannibal2.skyhanni.utils.RenderUtils.drawString
import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
@@ -25,7 +26,6 @@ import net.minecraftforge.event.entity.player.ItemTooltipEvent
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
-import java.util.*
import java.util.regex.Pattern
class GardenVisitorFeatures {
@@ -113,7 +113,7 @@ class GardenVisitorFeatures {
}
}
if (requiredItems.isNotEmpty()) {
- newDisplay.add(Collections.singletonList("§7Visitor items needed:"))
+ newDisplay.addAsSingletonList("§7Visitor items needed:")
for ((internalName, amount) in requiredItems) {
val name = NEUItems.getItemStack(internalName).name!!
val itemStack = NEUItems.getItemStack(internalName)
@@ -134,11 +134,11 @@ class GardenVisitorFeatures {
}
if (newVisitors.isNotEmpty()) {
if (requiredItems.isNotEmpty()) {
- newDisplay.add(Collections.singletonList(""))
+ newDisplay.addAsSingletonList("")
}
val amount = newVisitors.size
val visitorLabel = if (amount == 1) "visitor" else "visitors"
- newDisplay.add(Collections.singletonList("§e$amount §7new $visitorLabel:"))
+ newDisplay.addAsSingletonList("§e$amount §7new $visitorLabel:")
for (visitor in newVisitors) {
val displayName = GardenVisitorColorNames.getColoredName(visitor)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/SkyMartBestProfit.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/SkyMartBestProfit.kt
index 169fd900b..a4d1e5bd1 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/SkyMartBestProfit.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/SkyMartBestProfit.kt
@@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.events.InventoryOpenEvent
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.addAsSingletonList
import at.hannibal2.skyhanni.utils.LorenzUtils.sortedDesc
import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.NumberUtil
@@ -15,7 +16,6 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import net.minecraft.client.Minecraft
import net.minecraft.item.ItemStack
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import java.util.*
import java.util.regex.Pattern
class SkyMartBestProfit {
@@ -74,8 +74,8 @@ class SkyMartBestProfit {
): MutableList<List<Any>> {
val newList = mutableListOf<List<Any>>()
- newList.add(Collections.singletonList("Coins per §cCopper§f:"))
- newList.add(Collections.singletonList(""))
+ newList.addAsSingletonList("Coins per §cCopper§f:")
+ newList.addAsSingletonList("")
val keys = priceMap.sortedDesc().keys
val renderer = Minecraft.getMinecraft().fontRendererObj
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt
index 2b79bbd42..ef9541d9f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt
@@ -8,6 +8,7 @@ import at.hannibal2.skyhanni.features.nether.reputationhelper.dailykuudra.DailyK
import at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.DailyQuestHelper
import at.hannibal2.skyhanni.features.nether.reputationhelper.miniboss.DailyMiniBossHelper
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
import at.hannibal2.skyhanni.utils.TabListData
@@ -15,7 +16,6 @@ import com.google.gson.JsonObject
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
-import java.util.*
class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) {
@@ -79,7 +79,7 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) {
//TODO test
if (factionType == FactionType.NONE) return
- newList.add(Collections.singletonList("Reputation Helper:"))
+ newList.addAsSingletonList("Reputation Helper:")
questHelper.render(newList)
miniBossHelper.render(newList)
if (factionType == FactionType.MAGE) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt
index ce30ed3db..e8d69aa38 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt
@@ -8,12 +8,12 @@ import at.hannibal2.skyhanni.features.nether.reputationhelper.CrimsonIsleReputat
import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
import net.minecraftforge.client.event.RenderWorldLastEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import java.util.*
import java.util.regex.Pattern
class DailyKuudraBossHelper(private val reputationHelper: CrimsonIsleReputationHelper) {
@@ -67,15 +67,15 @@ class DailyKuudraBossHelper(private val reputationHelper: CrimsonIsleReputationH
fun render(display: MutableList<List<Any>>) {
val done = kuudraTiers.count { it.doneToday }
- display.add(Collections.singletonList(""))
- display.add(Collections.singletonList("§7Daily Kuudra (§e$done§8/§e3 killed§7)"))
+ display.addAsSingletonList("")
+ display.addAsSingletonList("§7Daily Kuudra (§e$done§8/§e3 killed§7)")
if (done != 2) {
for (tier in kuudraTiers) {
val result = if (tier.doneToday) "§7Done" else "§bTodo"
val displayName = tier.getDisplayName()
val displayItem = tier.displayItem
if (displayItem == null) {
- display.add(Collections.singletonList(" $displayName: $result"))
+ display.addAsSingletonList(" $displayName: $result")
} else {
val lineList = mutableListOf<Any>()
lineList.add(" ")
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt
index 611330339..a6d06366a 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt
@@ -13,6 +13,7 @@ import at.hannibal2.skyhanni.utils.*
import at.hannibal2.skyhanni.utils.InventoryUtils.getInventoryName
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.name
+import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
import at.hannibal2.skyhanni.utils.RenderUtils.highlight
import net.minecraft.client.gui.inventory.GuiChest
@@ -20,7 +21,6 @@ import net.minecraft.inventory.ContainerChest
import net.minecraftforge.client.event.RenderWorldLastEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
-import java.util.*
class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) {
@@ -223,8 +223,8 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) {
fun render(display: MutableList<List<Any>>) {
val done = quests.count { it.state == QuestState.COLLECTED }
- display.add(Collections.singletonList(""))
- display.add(Collections.singletonList("§7Daily Quests (§e$done§8/§e5 collected§7)"))
+ display.addAsSingletonList("")
+ display.addAsSingletonList("§7Daily Quests (§e$done§8/§e5 collected§7)")
if (done != 5) {
quests.mapTo(display) { renderQuest(it) }
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt
index 0eaa0be66..2e0673746 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt
@@ -11,11 +11,11 @@ import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled
import at.hannibal2.skyhanni.utils.LocationUtils
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
import net.minecraftforge.client.event.RenderWorldLastEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import java.util.*
import java.util.regex.Pattern
class DailyMiniBossHelper(private val reputationHelper: CrimsonIsleReputationHelper) {
@@ -75,15 +75,15 @@ class DailyMiniBossHelper(private val reputationHelper: CrimsonIsleReputationHel
fun render(display: MutableList<List<Any>>) {
val done = miniBosses.count { it.doneToday }
- display.add(Collections.singletonList(""))
- display.add(Collections.singletonList("§7Daily Bosses (§e$done§8/§e5 killed§7)"))
+ display.addAsSingletonList("")
+ display.addAsSingletonList("§7Daily Bosses (§e$done§8/§e5 killed§7)")
if (done != 5) {
for (miniBoss in miniBosses) {
val result = if (miniBoss.doneToday) "§aDone" else "§bTodo"
val displayName = miniBoss.displayName
val displayItem = miniBoss.displayItem
if (displayItem == null) {
- display.add(Collections.singletonList(" $displayName: $result"))
+ display.addAsSingletonList(" $displayName: $result")
} else {
val lineList = mutableListOf<Any>()
lineList.add(" ")
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
index f11f45ee4..7378d6131 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
@@ -14,6 +14,7 @@ import net.minecraft.util.ChatComponentText
import java.text.DecimalFormat
import java.text.NumberFormat
import java.text.SimpleDateFormat
+import java.util.*
object LorenzUtils {
@@ -166,4 +167,8 @@ object LorenzUtils {
}
fun getPlayerUuid() = Minecraft.getMinecraft().thePlayer.uniqueID.toDashlessUUID()
+
+ fun <E> MutableList<List<E>>.addAsSingletonList(text: E) {
+ add(Collections.singletonList(text))
+ }
} \ No newline at end of file