From d534f73b63578d384c7a69462ca18cf0883926f5 Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Fri, 21 Jun 2024 07:39:24 +1000 Subject: Backend: Remove deprecated function ChatUtils.error (#2021) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../java/at/hannibal2/skyhanni/utils/ChatUtils.kt | 23 ---------------------- .../java/at/hannibal2/skyhanni/utils/ItemUtils.kt | 7 ++----- 2 files changed, 2 insertions(+), 28 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/utils') diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt index aff0e745a..664def423 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt @@ -33,7 +33,6 @@ object ChatUtils { private const val DEBUG_PREFIX = "[SkyHanni Debug] §7" private const val USER_ERROR_PREFIX = "§c[SkyHanni] " - private val ERROR_PREFIX by lazy { "§c[SkyHanni-${SkyHanniMod.version}] " } private const val CHAT_PREFIX = "[SkyHanni] " /** @@ -62,28 +61,6 @@ object ChatUtils { internalChat(USER_ERROR_PREFIX + message) } - /** - * Sends a message to the user that an error occurred caused by something in the code. - * This should be used for errors that are not caused by the user. - * - * Why deprecate this? Even if this message is descriptive for the user and the developer, - * we don't want inconsistencies in errors, and we would need to search - * for the code line where this error gets printed any way. - * So it's better to use the stack trace still. - * - * @param message The message to be sent - * - * @see ERROR_PREFIX - */ - @Deprecated( - "Do not send the user a non clickable non stacktrace containing error message.", - ReplaceWith("ErrorManager.logErrorStateWithData(message)") - ) - fun error(message: String) { - println("error: '$message'") - internalChat(ERROR_PREFIX + message) - } - /** * Sends a message to the user * @param message The message to be sent diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt index 6af19e382..54cdfa91e 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt @@ -7,7 +7,6 @@ import at.hannibal2.skyhanni.utils.NEUItems.getItemStackOrNull import at.hannibal2.skyhanni.utils.NumberUtil.formatInt import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.RegexUtils.matches -import at.hannibal2.skyhanni.utils.SimpleTimeMark.Companion.asTimeMark import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.cachedData import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getEnchantments import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.isRecombobulated @@ -61,10 +60,8 @@ object ItemUtils { fun getItemsInInventory(withCursorItem: Boolean = false): List { val list: LinkedList = LinkedList() val player = Minecraft.getMinecraft().thePlayer - if (player == null) { - ChatUtils.error("getItemsInInventoryWithSlots: player is null!") - return list - } + ?: ErrorManager.skyHanniError("getItemsInInventoryWithSlots: player is null!") + for (slot in player.openContainer.inventorySlots) { if (slot.hasStack) { list.add(slot.stack) -- cgit