aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/garden
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/garden')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt13
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotAPI.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenWarpCommands.kt31
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt13
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawn.kt7
7 files changed, 55 insertions, 28 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt
index 586829185..92ebceccd 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt
@@ -13,6 +13,7 @@ import at.hannibal2.skyhanni.features.garden.CropType.Companion.getTurboCrop
import at.hannibal2.skyhanni.features.garden.pests.PestAPI
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter
+import at.hannibal2.skyhanni.utils.HypixelCommands
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.LorenzUtils.round
@@ -190,7 +191,7 @@ object FarmingFortuneDisplay {
"§cshowing latest Crop Fortune."
),
onClick = {
- ChatUtils.sendCommandToServer("widget")
+ HypixelCommands.widget()
}
))
} else {
@@ -201,7 +202,7 @@ object FarmingFortuneDisplay {
"§cshowing the Farming Fortune stat."
),
onClick = {
- ChatUtils.sendCommandToServer("widget")
+ HypixelCommands.widget()
}
))
}
@@ -216,7 +217,9 @@ object FarmingFortuneDisplay {
ChatUtils.clickableChat(
"§cCan not read Farming Fortune from tab list! Open /widget and enable the Stats Widget " +
"and showing the Farming Fortune stat.",
- command = "widget"
+ onClick = {
+ HypixelCommands.widget()
+ }
)
lastUniversalFortuneMissingError = SimpleTimeMark.now()
}
@@ -225,7 +228,9 @@ object FarmingFortuneDisplay {
ChatUtils.clickableChat(
"§cCan not read Crop Fortune from tab list! Open /widget and enable the Stats Widget " +
"and showing latest Crop Fortune.",
- command = "widget"
+ onClick = {
+ HypixelCommands.widget()
+ }
)
lastCropFortuneMissingError = SimpleTimeMark.now()
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt
index e39387c97..1196c82e1 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt
@@ -10,6 +10,7 @@ import at.hannibal2.skyhanni.events.LorenzToolTipEvent
import at.hannibal2.skyhanni.events.ProfileJoinEvent
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.ConditionalUtils
+import at.hannibal2.skyhanni.utils.HypixelCommands
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.name
@@ -94,9 +95,12 @@ class GardenLevelDisplay {
ChatUtils.clickableChat(
" \n§b§lGARDEN LEVEL UP §8$oldLevel ➜ §b$newLevel\n" +
" §8+§aRespect from Elite Farmers and SkyHanni members :)\n ",
- "gardenlevels",
- false
+ onClick = {
+ HypixelCommands.gardenLevels()
+ },
+ prefix = false
)
+
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt
index 82ccc9a93..7b898f3f0 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt
@@ -17,6 +17,7 @@ import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.APIUtil
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.ConfigUtils
+import at.hannibal2.skyhanni.utils.HypixelCommands
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LorenzUtils
@@ -556,7 +557,9 @@ object GardenNextJacobContest {
}
} else {
ChatUtils.chat("This year's contests aren't available to fetch automatically yet, please load them from your calendar or wait 10 minutes.")
- ChatUtils.clickableChat("Click here to open your calendar!", "calendar")
+ ChatUtils.clickableChat("Click here to open your calendar!", onClick = {
+ HypixelCommands.calendar()
+ })
}
if (newContests.count() == MAX_CONTESTS_PER_YEAR) {
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 f71b6dbb0..400767704 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotAPI.kt
@@ -5,7 +5,7 @@ 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.HypixelCommands
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LocationUtils.isInside
@@ -210,8 +210,8 @@ object GardenPlotAPI {
fun closestCenterPlot(location: LorenzVec) = plots.find { it.box.isInside(location) }?.middle
fun Plot.sendTeleportTo() {
- if (isBarn()) ChatUtils.sendCommandToServer("tptoplot barn")
- else ChatUtils.sendCommandToServer("tptoplot $name")
+ if (isBarn()) HypixelCommands.teleportToPlot("barn")
+ else HypixelCommands.teleportToPlot(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 e0abfa77f..220c7a757 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenWarpCommands.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenWarpCommands.kt
@@ -4,6 +4,7 @@ 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.HypixelCommands
import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
@@ -32,20 +33,20 @@ class GardenWarpCommands {
if (message == "/home") {
event.isCanceled = true
- ChatUtils.sendCommandToServer("warp garden")
+ HypixelCommands.warp("garden")
ChatUtils.chat("§aTeleported you to the spawn location!", prefix = false)
}
if (message == "/barn") {
event.isCanceled = true
- ChatUtils.sendCommandToServer("tptoplot barn")
+ HypixelCommands.teleportToPlot("barn")
LockMouseLook.autoDisable()
}
tpPlotPattern.matchMatcher(event.message) {
event.isCanceled = true
val plotName = group("plot")
- ChatUtils.sendCommandToServer("tptoplot $plotName")
+ HypixelCommands.teleportToPlot(plotName)
LockMouseLook.autoDisable()
}
}
@@ -56,18 +57,24 @@ class GardenWarpCommands {
if (Minecraft.getMinecraft().currentScreen != null) return
if (NEUItems.neuHasFocus()) return
- val command = when (event.keyCode) {
- config.homeHotkey -> "warp garden"
- config.sethomeHotkey -> "sethome"
- config.barnHotkey -> "tptoplot barn"
+ if (lastWarpTime.passedSince() < 2.seconds) return
+
+ when (event.keyCode) {
+ config.homeHotkey -> {
+ HypixelCommands.warp("garden")
+ }
+
+ config.sethomeHotkey -> {
+ ChatUtils.sendCommandToServer("sethome")
+ }
+
+ config.barnHotkey -> {
+ LockMouseLook.autoDisable()
+ HypixelCommands.teleportToPlot("barn")
+ }
else -> return
}
- if (lastWarpTime.passedSince() < 2.seconds) return
lastWarpTime = SimpleTimeMark.now()
- if (command == "tptoplot barn") {
- LockMouseLook.autoDisable()
- }
- 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 0d0494bf9..6516d9a2e 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
@@ -24,6 +24,7 @@ import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.CollectionUtils.sortedDesc
import at.hannibal2.skyhanni.utils.ConfigUtils
+import at.hannibal2.skyhanni.utils.HypixelCommands
import at.hannibal2.skyhanni.utils.InventoryUtils.getAmountInInventory
import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.KeyboardManager
@@ -490,7 +491,7 @@ object ComposterOverlay {
}
val havingInSacks = internalName.getAmountInSacksOrNull() ?: run {
- ChatUtils.sendCommandToServer("gfs ${internalName.asString()} ${itemsNeeded - havingInInventory}")
+ HypixelCommands.getFromSacks(internalName.asString(), itemsNeeded - havingInInventory)
// TODO Add sack type repo data
val isDwarvenMineable =
@@ -498,7 +499,9 @@ object ComposterOverlay {
val sackType = if (isDwarvenMineable) "Mining §eor §9Dwarven" else "Enchanted Agronomy"
ChatUtils.clickableChat(
"Sacks could not be loaded. Click here and open your §9$sackType Sack §eto update the data!",
- "sax"
+ onClick = {
+ HypixelCommands.sacks()
+ }
)
return
}
@@ -513,14 +516,16 @@ object ComposterOverlay {
return
}
- ChatUtils.sendCommandToServer("gfs ${internalName.asString()} ${itemsNeeded - havingInInventory}")
+ HypixelCommands.getFromSacks(internalName.asString(), itemsNeeded - havingInInventory)
if (itemsNeeded > havingInInventory - havingInSacks) {
if (LorenzUtils.noTradeMode) {
ChatUtils.chat("You're out of $itemName §ein your sacks!")
} else {
ChatUtils.clickableChat(
"You're out of $itemName §ein your sacks! Click here to buy more on the Bazaar!",
- "bz ${itemName.removeColor()}"
+ onClick = {
+ HypixelCommands.bazaar(itemName.removeColor())
+ }
)
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawn.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawn.kt
index b8ef8a2d7..acf23f51b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawn.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawn.kt
@@ -8,6 +8,7 @@ import at.hannibal2.skyhanni.events.garden.pests.PestSpawnEvent
import at.hannibal2.skyhanni.features.garden.GardenAPI
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.ConfigUtils
+import at.hannibal2.skyhanni.utils.HypixelCommands
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.StringUtils
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
@@ -119,7 +120,7 @@ class PestSpawn {
PestSpawnEvent(amount, plotNames, unknownAmount).postAndCatch()
if (unknownAmount) return // todo make this work with offline pest spawn messages
- val plotName = plotNames.firstOrNull()
+ val plotName = plotNames.firstOrNull() ?: error("first plot name is null")
val pestName = StringUtils.pluralize(amount, "Pest")
val message = "§e$amount §a$pestName Spawned in §b$plotName§a!"
@@ -128,7 +129,9 @@ class PestSpawn {
}
if (config.chatMessageFormat == PestSpawnConfig.ChatMessageFormatEntry.COMPACT) {
- ChatUtils.clickableChat(message, "tptoplot $plotName")
+ ChatUtils.clickableChat(message, onClick = {
+ HypixelCommands.teleportToPlot(plotName)
+ })
}
}