From 788fa74d1743c475576e49eaf8edeeedddf1824f Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Tue, 20 Feb 2024 19:14:13 +0100 Subject: Deprecate LorenzUtils.sendCommandToServer. #1025 --- .../at/hannibal2/skyhanni/api/GetFromSackAPI.kt | 2 +- .../config/features/garden/PlotIconConfig.java | 4 ++-- .../skyhanni/features/bazaar/BazaarApi.kt | 3 ++- .../features/bingo/card/BingoCardDisplay.kt | 2 +- .../skyhanni/features/commands/PartyCommands.kt | 25 +++++++++++----------- .../features/commands/SendCoordinatedCommand.kt | 6 +++--- .../features/commands/ViewRecipeCommand.kt | 4 ++-- .../features/event/diana/BurrowWarpHelper.kt | 2 +- .../event/diana/InquisitorWaypointShare.kt | 4 ++-- .../skyhanni/features/garden/GardenPlotAPI.kt | 4 ++-- .../skyhanni/features/garden/GardenWarpCommands.kt | 9 ++++---- .../features/garden/composter/ComposterOverlay.kt | 4 ++-- .../garden/inventory/GardenDeskInSBMenu.kt | 4 ++-- .../features/misc/trevor/TrevorFeatures.kt | 5 +++-- .../java/at/hannibal2/skyhanni/utils/ChatUtils.kt | 3 +++ .../at/hannibal2/skyhanni/utils/LorenzUtils.kt | 4 +--- 16 files changed, 44 insertions(+), 41 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/api/GetFromSackAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/GetFromSackAPI.kt index f5b8904a6..98a8a47b4 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/GetFromSackAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/GetFromSackAPI.kt @@ -78,7 +78,7 @@ object GetFromSackAPI { if (!LorenzUtils.inSkyBlock) return if (queue.isNotEmpty() && lastTimeOfCommand.passedSince() >= minimumDelay) { val item = queue.poll() - LorenzUtils.sendCommandToServer("gfs ${item.internalName.asString()} ${item.amount}") + ChatUtils.sendCommandToServer("gfs ${item.internalName.asString()} ${item.amount}") lastTimeOfCommand = ChatUtils.getTimeWhenNewlyQueuedMessageGetsExecuted() } } diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/PlotIconConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/PlotIconConfig.java index cb47862a2..2801d2bf6 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/PlotIconConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/PlotIconConfig.java @@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.config.features.garden; import at.hannibal2.skyhanni.config.FeatureToggle; import at.hannibal2.skyhanni.features.garden.inventory.GardenPlotIcon; -import at.hannibal2.skyhanni.utils.LorenzUtils; +import at.hannibal2.skyhanni.utils.ChatUtils; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; import io.github.moulberry.moulconfig.annotations.ConfigEditorButton; @@ -19,6 +19,6 @@ public class PlotIconConfig { @ConfigEditorButton(buttonText = "Reset") public Runnable hardReset = () -> { GardenPlotIcon.INSTANCE.setHardReset(true); - LorenzUtils.INSTANCE.sendCommandToServer("desk"); + ChatUtils.INSTANCE.sendCommandToServer("desk"); }; } diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt index 6a9c65b8a..3ec2630a0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt @@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name @@ -51,7 +52,7 @@ class BazaarApi { if (NEUItems.neuHasFocus()) return if (LorenzUtils.noTradeMode) return if (LorenzUtils.inDungeons || LorenzUtils.inKuudraFight) return - LorenzUtils.sendCommandToServer("bz ${displayName.removeColor()}") + ChatUtils.sendCommandToServer("bz ${displayName.removeColor()}") if (amount != -1) OSUtils.copyToClipboard(amount.toString()) currentSearchedItem = displayName.removeColor() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt index 2c0245985..e1cd1dbca 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt @@ -91,7 +91,7 @@ class BingoCardDisplay { newList.add(Renderable.clickAndHover("§cOpen the §e/bingo §ccard.", listOf("Click to run §e/bingo"), onClick = { - LorenzUtils.sendCommandToServer("bingo") + ChatUtils.sendCommandToServer("bingo") } )) } else { diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/PartyCommands.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/PartyCommands.kt index 6b352ca8c..8fcee01d0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/PartyCommands.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/PartyCommands.kt @@ -5,7 +5,7 @@ import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.FriendAPI import at.hannibal2.skyhanni.data.PartyAPI import at.hannibal2.skyhanni.events.MessageSendToServerEvent -import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.ChatUtils import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object PartyCommands { @@ -15,45 +15,46 @@ object PartyCommands { fun kickOffline() { if (!config.shortCommands) return if (PartyAPI.partyMembers.isEmpty()) return - LorenzUtils.sendCommandToServer("party kickoffline") + ChatUtils.sendCommandToServer("party kickoffline") } fun disband() { if (!config.shortCommands) return if (PartyAPI.partyMembers.isEmpty()) return - LorenzUtils.sendCommandToServer("party disband") + ChatUtils.sendCommandToServer("party disband") } fun warp() { if (!config.shortCommands) return if (PartyAPI.partyMembers.isEmpty()) return - LorenzUtils.sendCommandToServer("party warp") + ChatUtils.sendCommandToServer("party warp") } fun kick(args: Array) { if (!config.shortCommands) return if (PartyAPI.partyMembers.isEmpty()) return if (args.isEmpty()) return - if (args.size > 1 && config.partyKickReason) - LorenzUtils.sendCommandToServer("pc Kicking ${args[0]}: ${args.drop(1).joinToString(" ").trim()}") - LorenzUtils.sendCommandToServer("party kick ${args[0]}") + if (args.size > 1 && config.partyKickReason) { + ChatUtils.sendCommandToServer("pc Kicking ${args[0]}: ${args.drop(1).joinToString(" ").trim()}") + } + ChatUtils.sendCommandToServer("party kick ${args[0]}") } fun transfer(args: Array) { if (args.isEmpty()) { - LorenzUtils.sendCommandToServer("pt") + ChatUtils.sendCommandToServer("pt") return } if (!config.shortCommands) return if (PartyAPI.partyMembers.isEmpty()) return - LorenzUtils.sendCommandToServer("party transfer ${args[0]}") + ChatUtils.sendCommandToServer("party transfer ${args[0]}") } fun promote(args: Array) { if (!config.shortCommands) return if (PartyAPI.partyMembers.isEmpty()) return if (args.isEmpty()) return - LorenzUtils.sendCommandToServer("party promote ${args[0]}") + ChatUtils.sendCommandToServer("party promote ${args[0]}") } @SubscribeEvent @@ -72,8 +73,8 @@ object PartyCommands { val kickReason = args.drop(3).joinToString(" ").trim() if (kickReason.isEmpty()) return event.cancel() - LorenzUtils.sendCommandToServer("pc Kicking $kickedPlayer: $kickReason") - LorenzUtils.sendCommandToServer("p kick $kickedPlayer") + ChatUtils.sendCommandToServer("pc Kicking $kickedPlayer: $kickReason") + ChatUtils.sendCommandToServer("p kick $kickedPlayer") } fun customTabComplete(command: String): List? { diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt index 34797780b..5a81747fd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt @@ -1,8 +1,8 @@ package at.hannibal2.skyhanni.features.commands import at.hannibal2.skyhanni.events.MessageSendToServerEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LocationUtils -import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class SendCoordinatedCommand { @@ -12,11 +12,11 @@ class SendCoordinatedCommand { val message = event.message if (message == "/sendcoords") { event.isCanceled = true - LorenzUtils.sendCommandToServer(getCoordinates()) + ChatUtils.sendCommandToServer(getCoordinates()) } else if (message.startsWith("/sendcoords ")) { event.isCanceled = true val description = message.split(" ").drop(1).joinToString(" ") - LorenzUtils.sendCommandToServer("${getCoordinates()} $description") + ChatUtils.sendCommandToServer("${getCoordinates()} $description") } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt index 26873a2ad..963115b9b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt @@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.features.commands import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.MessageSendToServerEvent -import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.NEUItems import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -17,7 +17,7 @@ object ViewRecipeCommand { if (message == message.uppercase()) return if (message.startsWith("/viewrecipe ", ignoreCase = true)) { event.isCanceled = true - LorenzUtils.sendCommandToServer(message.uppercase()) + ChatUtils.sendCommandToServer(message.uppercase()) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt index 43ae77b5a..7b3e0003b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt @@ -33,7 +33,7 @@ class BurrowWarpHelper { currentWarp?.let { if (lastWarpTime.passedSince() > 5.seconds) { lastWarpTime = SimpleTimeMark.now() - LorenzUtils.sendCommandToServer("warp " + currentWarp?.name) + ChatUtils.sendCommandToServer("warp " + currentWarp?.name) lastWarp = currentWarp GriffinBurrowHelper.lastTitleSentTime = SimpleTimeMark.now() + 2.seconds TitleManager.optionalResetTitle { diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt index 66d4f2b85..d9ff8885f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt @@ -193,7 +193,7 @@ object InquisitorWaypointShare { return } inquisitor = -1 - LorenzUtils.sendCommandToServer("pc Inquisitor dead!") + ChatUtils.sendCommandToServer("pc Inquisitor dead!") } fun sendInquisitor() { @@ -220,7 +220,7 @@ object InquisitorWaypointShare { val x = location.x.toInt() val y = location.y.toInt() val z = location.z.toInt() - LorenzUtils.sendCommandToServer("pc x: $x, y: $y, z: $z ") + ChatUtils.sendCommandToServer("pc x: $x, y: $y, z: $z ") } @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotAPI.kt index 58a56c400..b6825bf43 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotAPI.kt @@ -5,9 +5,9 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.features.garden.pests.SprayType import at.hannibal2.skyhanni.features.misc.LockMouseLook +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LocationUtils.isPlayerInside -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine import at.hannibal2.skyhanni.utils.SimpleTimeMark @@ -109,7 +109,7 @@ object GardenPlotAPI { fun Plot.isPlayerInside() = box.isPlayerInside() fun Plot.sendTeleportTo() { - LorenzUtils.sendCommandToServer("tptoplot $name") + ChatUtils.sendCommandToServer("tptoplot $name") LockMouseLook.autoDisable() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenWarpCommands.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenWarpCommands.kt index fc30e3651..e0abfa77f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenWarpCommands.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenWarpCommands.kt @@ -4,7 +4,6 @@ import at.hannibal2.skyhanni.events.LorenzKeyPressEvent import at.hannibal2.skyhanni.events.MessageSendToServerEvent import at.hannibal2.skyhanni.features.misc.LockMouseLook import at.hannibal2.skyhanni.utils.ChatUtils -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher @@ -33,20 +32,20 @@ class GardenWarpCommands { if (message == "/home") { event.isCanceled = true - LorenzUtils.sendCommandToServer("warp garden") + ChatUtils.sendCommandToServer("warp garden") ChatUtils.chat("§aTeleported you to the spawn location!", prefix = false) } if (message == "/barn") { event.isCanceled = true - LorenzUtils.sendCommandToServer("tptoplot barn") + ChatUtils.sendCommandToServer("tptoplot barn") LockMouseLook.autoDisable() } tpPlotPattern.matchMatcher(event.message) { event.isCanceled = true val plotName = group("plot") - LorenzUtils.sendCommandToServer("tptoplot $plotName") + ChatUtils.sendCommandToServer("tptoplot $plotName") LockMouseLook.autoDisable() } } @@ -69,6 +68,6 @@ class GardenWarpCommands { if (command == "tptoplot barn") { LockMouseLook.autoDisable() } - LorenzUtils.sendCommandToServer(command) + ChatUtils.sendCommandToServer(command) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt index a2efc46cc..7c0987883 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt @@ -489,7 +489,7 @@ object ComposterOverlay { val sackStatus = sackItem.getStatus() if (sackStatus == SackStatus.MISSING || sackStatus == SackStatus.OUTDATED) { - LorenzUtils.sendCommandToServer("gfs ${internalName.asString()} ${itemsNeeded - having}") + ChatUtils.sendCommandToServer("gfs ${internalName.asString()} ${itemsNeeded - having}") // TODO Add sack type repo data val isDwarvenMineable = @@ -511,7 +511,7 @@ object ComposterOverlay { return } - LorenzUtils.sendCommandToServer("gfs ${internalName.asString()} ${itemsNeeded - having}") + ChatUtils.sendCommandToServer("gfs ${internalName.asString()} ${itemsNeeded - having}") if (amountInSacks <= itemsNeeded - having) { if (LorenzUtils.noTradeMode) { ChatUtils.chat("You're out of $itemName §ein your sacks!") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenDeskInSBMenu.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenDeskInSBMenu.kt index 6e0d8e400..34c55bd5a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenDeskInSBMenu.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenDeskInSBMenu.kt @@ -3,7 +3,7 @@ package at.hannibal2.skyhanni.features.garden.inventory import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.features.garden.GardenAPI -import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NEUItems.getItemStack import io.github.moulberry.notenoughupdates.events.ReplaceItemEvent @@ -51,7 +51,7 @@ class GardenDeskInSBMenu { fun onStackClick(event: SlotClickEvent) { if (showItem && event.slotId == 10) { event.isCanceled = true - LorenzUtils.sendCommandToServer("desk") + ChatUtils.sendCommandToServer("desk") } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt index 05d621f61..8f4e7ddef 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt @@ -16,6 +16,7 @@ import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper 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.ConfigUtils import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer @@ -268,7 +269,7 @@ object TrevorFeatures { val timeSince = lastChatPromptTime.passedSince() if (timeSince > 200.milliseconds && timeSince < 5.seconds) { lastChatPromptTime = SimpleTimeMark.farPast() - LorenzUtils.sendCommandToServer(lastChatPrompt) + ChatUtils.sendCommandToServer(lastChatPrompt) lastChatPrompt = "" timeLastWarped = SimpleTimeMark.now() return @@ -276,7 +277,7 @@ object TrevorFeatures { } if (config.warpToTrapper && timeLastWarped.passedSince() > 3.seconds && teleportBlock.passedSince() > 5.seconds) { - LorenzUtils.sendCommandToServer("warp trapper") + ChatUtils.sendCommandToServer("warp trapper") timeLastWarped = SimpleTimeMark.now() } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt index 533c67731..036cad877 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt @@ -208,6 +208,9 @@ object ChatUtils { } fun sendCommandToServer(command: String) { + if (command.startsWith("/")) { + debug("Sending wrong command to server? ($command)") + } sendMessageToServer("/$command") } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index 27b6a1d9d..05a7cad36 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -330,10 +330,8 @@ object LorenzUtils { FMLCommonHandler.instance().handleExit(-1) } + @Deprecated("moved", ReplaceWith("ChatUtils.sendCommandToServer")) fun sendCommandToServer(command: String) { - if (command.startsWith("/")) { - ChatUtils.debug("Sending wrong command to server? ($command)") - } ChatUtils.sendCommandToServer(command) } -- cgit