Skip to content

Commit

Permalink
less deprecated error function
Browse files Browse the repository at this point in the history
  • Loading branch information
CalMWolfs committed May 12, 2024
1 parent 654c7ae commit 034412c
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.events.HypixelJoinEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.ProfileJoinEvent
import at.hannibal2.skyhanni.events.TabListUpdateEvent
import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.HypixelCommands
import at.hannibal2.skyhanni.utils.LorenzUtils
Expand All @@ -35,12 +36,10 @@ object ProfileStorageData {
val playerSpecific = playerSpecific
val sackPlayers = sackPlayers
if (playerSpecific == null) {
ChatUtils.error("playerSpecific is null in ProfileJoinEvent!")
return
ErrorManager.skyHanniError("playerSpecific is null in ProfileJoinEvent! If you have a mod that auto-joins SkyBlock, disable it!")
}
if (sackPlayers == null) {
ChatUtils.error("sackPlayers is null in ProfileJoinEvent!")
return
ErrorManager.skyHanniError("sackPlayers is null in ProfileJoinEvent!")
}

val profileName = event.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.combat.ghostcounter
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.config.ConfigManager
import at.hannibal2.skyhanni.data.ProfileStorageData
import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.NumberUtil
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
Expand Down Expand Up @@ -84,8 +85,9 @@ object GhostUtil {
GhostData.Option.TOTALDROPS.add(json["TotalDrops"].asDouble)
c.ctDataImported = true
ChatUtils.chat("§aImported data successfully!")
} else
ChatUtils.error("GhostCounterV3 ChatTriggers module not found!")
} else {
ErrorManager.skyHanniError("GhostCounterV3 ChatTriggers module not found!")
}
}

fun String.formatText(option: GhostData.Option) = formatText(option.getInt(), option.getInt(true))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import at.hannibal2.skyhanni.events.LorenzKeyPressEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.events.PacketEvent
import at.hannibal2.skyhanni.events.SecondPassedEvent
import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy
import at.hannibal2.skyhanni.utils.EntityUtils
import at.hannibal2.skyhanni.utils.HypixelCommands
import at.hannibal2.skyhanni.utils.KeyboardManager
import at.hannibal2.skyhanni.utils.LorenzLogger
Expand Down Expand Up @@ -224,8 +224,7 @@ object InquisitorWaypointShare {
lastShareTime = System.currentTimeMillis()

if (inquisitor == -1) {
ChatUtils.error("No Inquisitor Found!")
return
ErrorManager.skyHanniError("No Inquisitor Found!")
}

val inquisitor = McWorld.getEntity(inquisitor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,8 @@ object PestAPI {
}

private fun removeNearestPest() {
val plot = getNearestInfestedPlot() ?: run {
ChatUtils.error("Can not remove nearest pest: No infested plots detected.")
return
}
val plot = getNearestInfestedPlot()
?: ErrorManager.skyHanniError("Can not remove nearest pest: No infested plots detected.")
if (!plot.isPestCountInaccurate) plot.pests--
scoreboardPests--
updatePests()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarApi
import at.hannibal2.skyhanni.features.mining.fossilexcavator.FossilExcavatorAPI
import at.hannibal2.skyhanni.features.rift.RiftAPI
import at.hannibal2.skyhanni.features.rift.RiftAPI.motesNpcPrice
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.CollectionUtils.equalsOneOf
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.InventoryUtils.getInventoryName
Expand Down Expand Up @@ -131,8 +131,7 @@ class HideNotClickableItems {
event.toolTip.add("§7" + first.removeColor())
event.toolTip.add("")
if (hideReason == "") {
event.toolTip.add("§4No hide reason!")
ChatUtils.error("No hide reason for not clickable item!")
ErrorManager.skyHanniError("No hide reason for not clickable item!")
} else {
event.toolTip.add("§c$hideReason")
if (config.itemsBypass) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ object QuickModMenuSwitch {
} catch (_: Exception) {
}
}
ChatUtils.error("Error trying to open the gui for mod " + mod.name + "!")
ChatUtils.chat("Error trying to open the gui for mod " + mod.name + "!")
}

"hytil" -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import at.hannibal2.skyhanni.features.garden.GardenNextJacobContest
import at.hannibal2.skyhanni.features.garden.visitor.GardenVisitorColorNames
import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarApi.Companion.getBazaarData
import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled
import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy
import at.hannibal2.skyhanni.utils.InventoryUtils
Expand Down Expand Up @@ -359,10 +360,7 @@ class SkyHanniDebugsAndTests {
}

val internalName = hand.getInternalNameOrNull()
if (internalName == null) {
ChatUtils.error("§cInternal name is null for item ${hand.name}")
return
}
?: ErrorManager.skyHanniError("Internal name is null for item ${hand.name}")

val rawInternalName = internalName.asString()
OS.copyToClipboard(rawInternalName)
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,9 @@ object ItemUtils {

fun getItemsInInventory(withCursorItem: Boolean = false): List<ItemStack> {
val list: LinkedList<ItemStack> = 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)
Expand Down

0 comments on commit 034412c

Please sign in to comment.