From 80813c4ec241390f465231d6fccb9cf79e6096cb Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 24 Feb 2024 12:26:26 +0100 Subject: Fixed ReplaceWith auto replace feature from IDEs for deprecated functions. --- .../hannibal2/skyhanni/test/command/ErrorManager.kt | 2 +- .../java/at/hannibal2/skyhanni/utils/ChatUtils.kt | 2 +- .../java/at/hannibal2/skyhanni/utils/LorenzUtils.kt | 20 ++++++++++---------- .../java/at/hannibal2/skyhanni/utils/TimeUtils.kt | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt b/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt index 29b296baf..1c37d5249 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt @@ -47,7 +47,7 @@ object ErrorManager { } ?: "Error id not found!") } - @Deprecated("Use data as well", ReplaceWith("logErrorStateWithData()")) + @Deprecated("Use data as well", ReplaceWith("logErrorStateWithData(userMessage, internalMessage)")) fun logErrorState(userMessage: String, internalMessage: String) { logError(IllegalStateException(internalMessage), userMessage, ignoreErrorCache = false, noStackTrace = false) } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt index 036cad877..a65da4387 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt @@ -67,7 +67,7 @@ object ChatUtils { */ @Deprecated( "Do not send the user a non clickable non stacktrace containing error message.", - ReplaceWith("ErrorManager.logErrorStateWithData") + ReplaceWith("ErrorManager.logErrorStateWithData(message)") ) fun error(message: String) { println("error: '$message'") diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index 05a7cad36..77979a5aa 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -113,13 +113,13 @@ object LorenzUtils { fun formatPercentage(percentage: Double, format: String?): String = DecimalFormat(format).format(percentage * 100).replace(',', '.') + "%" - @Deprecated("old code", ReplaceWith("addSeparators()")) + @Deprecated("old code", ReplaceWith("i.addSeparators()")) fun formatInteger(i: Int): String = i.addSeparators() - @Deprecated("old code", ReplaceWith("addSeparators()")) + @Deprecated("old code", ReplaceWith("l.addSeparators()")) fun formatInteger(l: Long): String = l.addSeparators() - @Deprecated("old code", ReplaceWith("round() and addSeparators()")) + @Deprecated("old code", ReplaceWith("d.round(round).addSeparators()")) fun formatDouble(d: Double, round: Int = 1): String { return d.round(round).addSeparators() } @@ -330,7 +330,7 @@ object LorenzUtils { FMLCommonHandler.instance().handleExit(-1) } - @Deprecated("moved", ReplaceWith("ChatUtils.sendCommandToServer")) + @Deprecated("moved", ReplaceWith("ChatUtils.sendCommandToServer(command)")) fun sendCommandToServer(command: String) { ChatUtils.sendCommandToServer(command) } @@ -343,21 +343,21 @@ object LorenzUtils { return runCatching { this.group(groupName) }.getOrNull() } - @Deprecated("moved", ReplaceWith("ChatUtils.debug")) + @Deprecated("moved", ReplaceWith("ChatUtils.debug(message)")) fun debug(message: String) = ChatUtils.debug(message) - @Deprecated("moved", ReplaceWith("ChatUtils.userError")) + @Deprecated("moved", ReplaceWith("ChatUtils.userError(message)")) fun userError(message: String) = ChatUtils.userError(message) - @Deprecated("moved", ReplaceWith("ChatUtils.chat")) + @Deprecated("moved", ReplaceWith("ChatUtils.chat(message, prefix, prefixColor)")) fun chat(message: String, prefix: Boolean = true, prefixColor: String = "§e") = ChatUtils.chat(message, prefix, prefixColor) - @Deprecated("moved", ReplaceWith("ChatUtils.clickableChat")) + @Deprecated("moved", ReplaceWith("ChatUtils.clickableChat(message, command, prefix, prefixColor)")) fun clickableChat(message: String, command: String, prefix: Boolean = true, prefixColor: String = "§e") = ChatUtils.clickableChat(message, command, prefix, prefixColor) - @Deprecated("moved", ReplaceWith("ChatUtils.hoverableChat")) + @Deprecated("moved", ReplaceWith("ChatUtils.hoverableChat(message, hover, command, prefix, prefixColor)")) fun hoverableChat( message: String, hover: List, @@ -366,6 +366,6 @@ object LorenzUtils { prefixColor: String = "§e", ) = ChatUtils.hoverableChat(message, hover, command, prefix, prefixColor) - @Deprecated("moved", ReplaceWith("ChatUtils.sendMessageToServer")) + @Deprecated("moved", ReplaceWith("ChatUtils.sendMessageToServer(message)")) fun sendMessageToServer(message: String) = ChatUtils.sendMessageToServer(message) } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt index 4ca07e423..df34ec70e 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt @@ -30,7 +30,7 @@ object TimeUtils { else -> default } - @Deprecated("off sets by one second", ReplaceWith("Duration.format()")) + @Deprecated("Has an offset of one second", ReplaceWith("use kotlin Duration")) fun formatDuration( millis: Long, biggestUnit: TimeUnit = TimeUnit.YEAR, @@ -78,7 +78,7 @@ object TimeUtils { return builder.toString().trim() } - @Deprecated("Do no longer use long for time", ReplaceWith("getDuration()")) + @Deprecated("Do no longer use long for time", ReplaceWith("getDuration(string)")) fun getMillis(string: String) = getDuration(string).inWholeMilliseconds fun getDuration(string: String) = getMillis_(string.replace("m", "m ").replace(" ", " ").trim()) -- cgit