diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt | 6 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/HypixelCommands.kt | 54 |
2 files changed, 58 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt index 88d90c381..30ad1b728 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt @@ -139,6 +139,7 @@ object ChatUtils { * @see CHAT_PREFIX */ //TODO rename to runHypixelCommand + @Deprecated("Use clickableChat with onClick or use HypixelCommands", ReplaceWith("")) fun clickableChat(message: String, command: String, prefix: Boolean = true, prefixColor: String = "§e") { val msgPrefix = if (prefix) prefixColor + CHAT_PREFIX else "" val fullMessage = msgPrefix + message @@ -146,7 +147,7 @@ object ChatUtils { internalChat(createClickableChat(fullMessage, command)) } - fun createClickableChat(message: String, command: String): ChatComponentText { + private fun createClickableChat(message: String, command: String): ChatComponentText { val text = ChatComponentText(message) val fullCommand = "/" + command.removePrefix("/") text.chatStyle.chatClickEvent = ClickEvent(ClickEvent.Action.RUN_COMMAND, fullCommand) @@ -171,7 +172,7 @@ object ChatUtils { onClick: () -> Any, expireAt: SimpleTimeMark = SimpleTimeMark.farFuture(), prefix: Boolean = true, - prefixColor: String = "§e" + prefixColor: String = "§e", ) { val msgPrefix = if (prefix) prefixColor + CHAT_PREFIX else "" ChatClickActionManager.oneTimeClick(msgPrefix + message, onClick, expireAt) @@ -290,6 +291,7 @@ object ChatUtils { sendQueue.add(message) } + @Deprecated("use HypixelCommands instead", ReplaceWith("")) fun sendCommandToServer(command: String) { if (command.startsWith("/")) { debug("Sending wrong command to server? ($command)") diff --git a/src/main/java/at/hannibal2/skyhanni/utils/HypixelCommands.kt b/src/main/java/at/hannibal2/skyhanni/utils/HypixelCommands.kt new file mode 100644 index 000000000..5507f4b99 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/utils/HypixelCommands.kt @@ -0,0 +1,54 @@ +package at.hannibal2.skyhanni.utils + +object HypixelCommands { + + fun bazaar(searchTerm: String) { + send("bz $searchTerm") + } + + fun warp(warp: String) { + send("warp $warp") + } + + fun teleportToPlot(plotName: String) { + send("tptoplot $plotName") + } + + fun getFromSacks(itemName: String, amount: Int) { + send("gfs $itemName $amount") + } + + fun widget() { + send("widget") + } + + fun chocolateFactory() { + send("cf") + } + + fun openBaker() { + send("openbaker") + } + + fun gardenLevels() { + send("gardenlevels") + } + + fun calendar() { + send("calendar") + } + + fun sacks() { + send("sax") + } + + fun toggleMusic() { + send("togglemusic") + } + + private fun send(command: String) { + @Suppress("DEPRECATION") + // TODO rename function + ChatUtils.sendCommandToServer(command) + } +} |