aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-10-07 04:41:11 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-10-07 04:41:11 +0200
commita0bcfd95857ee9ff1caa5eec4eec3cfe077596dc (patch)
tree48c1661bbd81927471fe62b3ea9b75c769a29ea9 /src/main/java/at/hannibal2/skyhanni
parentf25715ff6b010876cf2da64f8419bed5e2b2aa83 (diff)
downloadskyhanni-a0bcfd95857ee9ff1caa5eec4eec3cfe077596dc.tar.gz
skyhanni-a0bcfd95857ee9ff1caa5eec4eec3cfe077596dc.tar.bz2
skyhanni-a0bcfd95857ee9ff1caa5eec4eec3cfe077596dc.zip
Added more options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java26
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.kt55
2 files changed, 69 insertions, 12 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java
index ddc3fafde..84a8dbacb 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java
@@ -563,6 +563,32 @@ public class MiscConfig {
@ConfigOption(name = "Invert Sort", desc = "Flip the player list order on its head (also works with default rank).")
@ConfigEditorBoolean
public boolean reverseSort = false;
+
+ @Expose
+ @ConfigOption(name = "Hide Rank Color", desc = "Hide the player rank color.")
+ @ConfigEditorBoolean
+ public boolean hideRankColor = false;
+
+ @Expose
+ @ConfigOption(name = "Hide Emblems", desc = "Hide the emblems behind the player name.")
+ @ConfigEditorBoolean
+ public boolean hideEmblem = false;
+
+ @Expose
+ @ConfigOption(name = "Hide Level", desc = "Hide the SkyBlock level numbers.")
+ @ConfigEditorBoolean
+ public boolean hideLevel = false;
+
+ @Expose
+ @ConfigOption(name = "Hide Level Brackets", desc = "Hide the emblems behind the player name.")
+ @ConfigEditorBoolean
+ public boolean hideLevelBrackets = false;
+
+ @Expose
+ @ConfigOption(name = "Level Color As Name", desc = "Use the color of the skyblock level as the player color.")
+ @ConfigEditorBoolean
+ public boolean useLevelColorForName = false;
+
}
@Expose
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.kt
index d4268a39f..3d0275f28 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.kt
@@ -80,11 +80,10 @@ object TabListReader {
}
private fun newSorting(original: List<String>): List<String> {
-
if (LorenzUtils.inKuudraFight) return original
if (LorenzUtils.inDungeons) return original
- val pattern = ".*\\[(?<rank>.*)] (?<name>.*)".toPattern()
+ val pattern = ".*\\[(?<level>.*)] (?<name>.*)".toPattern()
val newList = mutableListOf<String>()
val playerDatas = mutableMapOf<String, PlayerData>()
newList.add(original.first())
@@ -101,21 +100,28 @@ object TabListReader {
continue
}
pattern.matchMatcher(line) {
- val removeColor = group("rank").removeColor()
+ val levelText = group("level")
+ val removeColor = levelText.removeColor()
try {
val playerData = PlayerData(removeColor.toInt())
playerDatas[line] = playerData
val fullName = group("name")
val name = fullName.split(" ")
- playerData.name = name[0].removeColor()
+ val coloredName = name[0]
+ playerData.coloredName = coloredName
+ playerData.name = coloredName.removeColor()
+ playerData.levelText = levelText
if (name.size > 1) {
- val rest = name.drop(1).joinToString(" ")
- if (rest.contains("♲")) {
+ val nameSuffix = name.drop(1).joinToString(" ")
+ playerData.nameSuffix = nameSuffix
+ if (nameSuffix.contains("♲")) {
playerData.ironman = true
} else {
playerData.bingoLevel = getBingoRank(line)
}
+ } else {
+ playerData.nameSuffix = ""
}
} catch (e: NumberFormatException) {
@@ -147,7 +153,7 @@ object TabListReader {
else -> prepare
}
- var newPlayerList = sorted.map { it.key }.toMutableList()
+ var newPlayerList = sorted.map { buildName(it.value) }.toMutableList()
if (config.reverseSort) {
newPlayerList = newPlayerList.reversed().toMutableList()
}
@@ -161,6 +167,29 @@ object TabListReader {
return newList
}
+ private fun buildName(data: PlayerData): String {
+ val playerName = if (config.useLevelColorForName) {
+ val c = data.levelText[3]
+ "§$c" + data.name
+ } else if (config.hideRankColor) "§b" + data.name else data.coloredName
+
+ val level = if (!config.hideLevel) {
+ if (config.hideLevelBrackets) data.levelText else "§8[${data.levelText}§8]"
+ } else ""
+
+ val suffix = if (config.hideEmblem) {
+ if (data.ironman) {
+ "§8[§7Iron Man§8]"
+ } else {
+ if (data.bingoLevel > -1) {
+ "§rBingo ${data.bingoLevel}"
+ } else ""
+ }
+ } else data.nameSuffix
+
+ return "$level $playerName $suffix"
+ }
+
private var randomOrderCache =
CacheBuilder.newBuilder().expireAfterWrite(20, TimeUnit.MINUTES).build<String, Int>()
@@ -194,12 +223,14 @@ object TabListReader {
else -> -1
}
- class PlayerData(
- val sbLevel: Int,
- var name: String = "",
- var ironman: Boolean = false,
+ class PlayerData(val sbLevel: Int) {
+ var name: String = "?"
+ var coloredName: String = "?"
+ var nameSuffix: String = "?"
+ var levelText: String = "?"
+ var ironman: Boolean = false
var bingoLevel: Int = -1
- )
+ }
private fun parseFooterAsColumn(): TabColumn? {
val tabList = Minecraft.getMinecraft().ingameGUI.tabList as AccessorGuiPlayerTabOverlay