summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/commands
diff options
context:
space:
mode:
authorThunderblade73 <85900443+Thunderblade73@users.noreply.github.com>2024-02-10 00:24:52 +0100
committerGitHub <noreply@github.com>2024-02-10 00:24:52 +0100
commit4559e5ff05e19817a21ae49f1c0d8a97d273f6a1 (patch)
treee72dac91d07fc84bea80548c89e13276caa68b81 /src/main/java/at/hannibal2/skyhanni/features/commands
parentd3a7cc4ab970b457b7950489da781539e45e0dce (diff)
downloadskyhanni-4559e5ff05e19817a21ae49f1c0d8a97d273f6a1.tar.gz
skyhanni-4559e5ff05e19817a21ae49f1c0d8a97d273f6a1.tar.bz2
skyhanni-4559e5ff05e19817a21ae49f1c0d8a97d273f6a1.zip
Splitting many utils functions from LorenzUtils up into other classes: ChatUtils, CollectionUtils, ConditionalUtils. And code cleanup #978
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/commands')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/commands/PartyCommands.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt11
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/GetFromSacksTabComplete.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/PlayerTabComplete.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/WarpTabComplete.kt3
8 files changed, 20 insertions, 14 deletions
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 5f3217cdf..6b352ca8c 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/commands/PartyCommands.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/commands/PartyCommands.kt
@@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
object PartyCommands {
+
private val config get() = SkyHanniMod.feature.commands
fun kickOffline() {
@@ -61,7 +62,8 @@ object PartyCommands {
return
}
if (!event.message.startsWith("/party kick ", ignoreCase = true)
- && !event.message.startsWith("/p kick ", ignoreCase = true)) {
+ && !event.message.startsWith("/p kick ", ignoreCase = true)
+ ) {
return
}
val args = event.message.split(" ")
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 a41547c68..34797780b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt
@@ -12,11 +12,11 @@ class SendCoordinatedCommand {
val message = event.message
if (message == "/sendcoords") {
event.isCanceled = true
- LorenzUtils.sendMessageToServer(getCoordinates())
+ LorenzUtils.sendCommandToServer(getCoordinates())
} else if (message.startsWith("/sendcoords ")) {
event.isCanceled = true
val description = message.split(" ").drop(1).joinToString(" ")
- LorenzUtils.sendMessageToServer("${getCoordinates()} $description")
+ LorenzUtils.sendCommandToServer("${getCoordinates()} $description")
}
}
@@ -27,5 +27,4 @@ class SendCoordinatedCommand {
val z = location.z.toInt()
return "x: $x, y: $y, z: $z"
}
-
}
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 c486f6f50..26873a2ad 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt
@@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.utils.NEUItems
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
object ViewRecipeCommand {
+
private val config get() = SkyHanniMod.feature.commands
@SubscribeEvent
@@ -16,7 +17,7 @@ object ViewRecipeCommand {
if (message == message.uppercase()) return
if (message.startsWith("/viewrecipe ", ignoreCase = true)) {
event.isCanceled = true
- LorenzUtils.sendMessageToServer(message.uppercase())
+ LorenzUtils.sendCommandToServer(message.uppercase())
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt
index 4cb06b568..183238762 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt
@@ -14,7 +14,7 @@ class WarpIsCommand {
if (event.message.lowercase() == "/warp is") {
event.isCanceled = true
- LorenzUtils.sendMessageToServer("/is")
+ LorenzUtils.sendCommandToServer("/is")
}
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt
index c1aab3a1c..ff3b4fac3 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt
@@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.commands
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.events.MessageSendToServerEvent
+import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.ItemUtils.nameWithEnchantment
@@ -60,7 +61,7 @@ object WikiManager {
fun onKeybind(event: GuiScreenEvent.KeyboardInputEvent.Post) {
if (!LorenzUtils.inSkyBlock) return
val gui = event.gui as? GuiContainer ?: return
- if (NEUItems.neuHasFocus()) return //because good heavens if this worked on neuitems...
+ if (NEUItems.neuHasFocus()) return // because good heavens if this worked on neuitems...
val stack = gui.slotUnderMouse?.stack ?: return
if (!config.wikiKeybind.isKeyHeld()) return
@@ -78,7 +79,7 @@ object WikiManager {
fun otherWikiCommands(args: Array<String>, useFandom: Boolean, wikithis: Boolean = false) {
if (wikithis && !LorenzUtils.inSkyBlock) {
- LorenzUtils.chat("§cYou must be in SkyBlock to do this!")
+ ChatUtils.chat("§cYou must be in SkyBlock to do this!")
return
}
@@ -87,7 +88,7 @@ object WikiManager {
if (wikithis) {
val itemInHand = InventoryUtils.getItemInHand() ?: run {
- LorenzUtils.chat("§cYou must be holding an item to use this command!")
+ ChatUtils.chat("§cYou must be holding an item to use this command!")
return
}
wikiTheItem(itemInHand, false, useFandom = useFandom)
@@ -107,7 +108,7 @@ object WikiManager {
val wiki = if (useFandom) "SkyBlock Fandom Wiki" else "Official SkyBlock Wiki"
val urlPrefix = if (useFandom) FANDOM_URL_PREFIX else OFFICIAL_URL_PREFIX
if (search == "") {
- LorenzUtils.clickableLinkChat(
+ ChatUtils.clickableLinkChat(
"§7Click §e§lHERE §7to visit the §6$wiki§7!", urlPrefix, "§7The $wiki!"
)
return
@@ -116,7 +117,7 @@ object WikiManager {
val urlSearchPrefix = if (useFandom) "$urlPrefix$FANDOM_SEARCH_PREFIX" else "$urlPrefix$OFFICIAL_SEARCH_PREFIX"
val searchUrl = "$urlSearchPrefix${URLEncoder.encode(search, "UTF-8")}&scope=internal"
- LorenzUtils.clickableLinkChat(
+ ChatUtils.clickableLinkChat(
"§7Click §e§lHERE §7to find §a$displaySearch §7on the §6$wiki§7!",
searchUrl,
"§7View §a$displaySearch §7on the §6$wiki§7!",
diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/GetFromSacksTabComplete.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/GetFromSacksTabComplete.kt
index f3738c6b4..e4b0071ad 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/GetFromSacksTabComplete.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/GetFromSacksTabComplete.kt
@@ -8,6 +8,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
object GetFromSacksTabComplete {
+
private val config get() = SkyHanniMod.feature.commands.tabComplete
private var sackList = emptyList<String>()
private val commands = arrayOf("gfs", "getfromsacks")
@@ -36,7 +37,7 @@ object GetFromSacksTabComplete {
if (realName == rawName) return
if (realName !in sackList) return
event.isCanceled = true
- LorenzUtils.sendMessageToServer(message.replace(rawName, realName))
+ LorenzUtils.sendCommandToServer(message.replace(rawName, realName))
}
fun isEnabled() = LorenzUtils.inSkyBlock && config.gfsSack
diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/PlayerTabComplete.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/PlayerTabComplete.kt
index 9df128920..3384db554 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/PlayerTabComplete.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/PlayerTabComplete.kt
@@ -4,14 +4,15 @@ import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.data.FriendAPI
import at.hannibal2.skyhanni.data.PartyAPI
+import at.hannibal2.skyhanni.data.jsonobjects.repo.VipVisitsJson
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.utils.EntityUtils.isNPC
-import at.hannibal2.skyhanni.data.jsonobjects.repo.VipVisitsJson
import net.minecraft.client.Minecraft
import net.minecraft.client.entity.EntityOtherPlayerMP
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
object PlayerTabComplete {
+
private val config get() = SkyHanniMod.feature.commands.tabComplete
private var vipVisits = listOf<String>()
diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/WarpTabComplete.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/WarpTabComplete.kt
index c5487fdb8..53a0a8f84 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/WarpTabComplete.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/WarpTabComplete.kt
@@ -1,12 +1,13 @@
package at.hannibal2.skyhanni.features.commands.tabcomplete
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.jsonobjects.repo.WarpsJson
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.data.jsonobjects.repo.WarpsJson
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
object WarpTabComplete {
+
private val config get() = SkyHanniMod.feature.commands.tabComplete
private var warps = listOf<String>()