aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/command/CopyTabListCommand.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt9
6 files changed, 17 insertions, 19 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt
index e32f1d899..292c87836 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt
@@ -63,12 +63,11 @@ class ConfigManager {
Features::class.java
)
logger.log("Loaded config from file")
- } catch (e: Exception) {
- println("config error")
- e.printStackTrace()
+ } catch (error: Exception) {
+ error.printStackTrace()
val backupFile = configFile!!.resolveSibling("config-${System.currentTimeMillis()}-backup.json")
logger.log("Exception while reading $configFile. Will load blank config and save backup to $backupFile")
- e.printStackTrace()
+ logger.log("Exception was $error")
try {
configFile!!.copyTo(backupFile)
} catch (e: Exception) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
index 6c51b51fa..4018f170f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
@@ -423,7 +423,7 @@ class GardenVisitorFeatures {
logger.log("New visitor detected: '$name'")
- if (config.visitorNotificationTitle) {
+ if (config.visitorNotificationTitle && System.currentTimeMillis() > LorenzUtils.lastWorldSwitch + 2_000) {
TitleUtils.sendTitle("§eNew Visitor", 5_000)
}
if (config.visitorNotificationChat) {
@@ -519,9 +519,8 @@ class GardenVisitorFeatures {
entity,
color
) { config.visitorHighlightStatus == 0 || config.visitorHighlightStatus == 2 }
- } else {
- RenderLivingEntityHelper.removeEntityColor(entity)
}
+ if (color == -1 || !GardenAPI.inGarden()) RenderLivingEntityHelper.removeEntityColor(entity) // Have not gotten either of the known effected visitors (Vex and Leo) so cannot test for sure
}
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt
index e7b55bf14..3c64c076b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt
@@ -24,7 +24,6 @@ class GardenVisitorTimer {
private val patternVisitors = "§b§lVisitors: §r§f\\((?<amount>\\d)\\)".toPattern()
private var render = ""
private var lastMillis = 0L
- private var lastVisitors: Int = -1
private var sixthVisitorArrivalTime: Long = 0
private var visitorJustArrived: Boolean = false
private var sixthVisitorReady: Boolean = false
@@ -34,6 +33,10 @@ class GardenVisitorTimer {
SkyHanniMod.feature.hidden.visitorInterval = value
}
+ companion object {
+ var lastVisitors: Int = -1
+ }
+
@SubscribeEvent
fun onVisitorArrival(event: VisitorArrivalEvent) {
visitorJustArrived = true
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt
index 1b6b3915c..4ddfb0cf0 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt
@@ -6,7 +6,6 @@ import at.hannibal2.skyhanni.events.RenderItemTipEvent
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils
import at.hannibal2.skyhanni.utils.ItemUtils.cleanName
-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.between
@@ -21,7 +20,7 @@ class ItemDisplayOverlayFeatures {
private val wishingCompassPattern = "§7Remaining Uses: §e(?<amount>.*)§8/§e3".toPattern()
private val rangerBootsSpeedCapPattern = "§7Current Speed Cap: §a(?<cap>.*)".toPattern()
- private val petLevelPattern = "\\[Lvl (?<level>.*)] (?:.*)".toPattern()
+ private val petLevelPattern = "\\[Lvl (?<level>.*)] .*".toPattern()
@SubscribeEvent
fun onRenderItemTip(event: RenderItemTipEvent) {
@@ -152,7 +151,7 @@ class ItemDisplayOverlayFeatures {
}
if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(11)) {
- if (item.getInternalName() == "RANCHERS_BOOTS") {
+ if (itemName.contains("Rancher's Boots")) {
for (line in item.getLore()) {
rangerBootsSpeedCapPattern.matchMatcher(line) {
return group("cap")
diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyTabListCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyTabListCommand.kt
index 177b92b7d..fc41c4009 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyTabListCommand.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyTabListCommand.kt
@@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.OSUtils
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.TabListData
+import net.minecraft.client.Minecraft
object CopyTabListCommand {
fun command(args: Array<String>) {
@@ -14,7 +15,9 @@ object CopyTabListCommand {
val tabListLine = if (noColor) line.removeColor() else line
if (tabListLine != "") resultList.add("'$tabListLine'")
}
- val string = resultList.joinToString("\n")
+ val tabHeader = Minecraft.getMinecraft().ingameGUI.tabList.header.formattedText
+ val tabFooter = Minecraft.getMinecraft().ingameGUI.tabList.footer.formattedText
+ val string = "Header:\n\n" + tabHeader.toString() + "\n\nBody:\n\n" + resultList.joinToString("\n") + "\nFooter:\n\n" + tabFooter.toString()
OSUtils.copyToClipboard(string)
LorenzUtils.chat("§e[SkyHanni] tablist copied into the clipboard!")
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt
index cae0a5896..57c7b3b84 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt
@@ -178,12 +178,8 @@ object NumberUtil {
}
fun String.formatNumber(): Long {
- var hasDecimal = false
var text = replace(",", "")
- if (text.contains(".")) {
- text = replace(".", "")
- hasDecimal = true
- }
+
val multiplier = if (text.endsWith("k")) {
text = text.substring(0, text.length - 1)
1_000
@@ -191,8 +187,7 @@ object NumberUtil {
text = text.substring(0, text.length - 1)
1_000_000
} else 1
- var d = text.toDouble()
- if (hasDecimal) d /= 10
+ val d = text.toDouble()
return (d * multiplier).toLong()
}
} \ No newline at end of file