aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2024-04-16 02:34:51 +1000
committerGitHub <noreply@github.com>2024-04-15 18:34:51 +0200
commit66b98b62ec0ef0aa56d47af48131d661d43de579 (patch)
treefaaf994f850cc1303d699654a1129d9fd6449353 /src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt
parent377fd979821296cde9d6ceb2fa4b365e4637232a (diff)
downloadskyhanni-66b98b62ec0ef0aa56d47af48131d661d43de579.tar.gz
skyhanni-66b98b62ec0ef0aa56d47af48131d661d43de579.tar.bz2
skyhanni-66b98b62ec0ef0aa56d47af48131d661d43de579.zip
Improvement: Code cleanup, bug fix and new functions (#1445)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt11
1 files changed, 9 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 eaae104ac..b3861ce27 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt
@@ -159,14 +159,21 @@ object ChatUtils {
* Sends a message to the user that they can click and run an action
* @param message The message to be sent
* @param onClick The runnable to be executed when the message is clicked
+ * @param expireAt When the click action should expire, default never
* @param prefix Whether to prefix the message with the chat prefix, default true
* @param prefixColor Color that the prefix should be, default yellow (§e)
*
* @see CHAT_PREFIX
*/
- fun clickableChat(message: String, onClick: () -> Any, prefix: Boolean = true, prefixColor: String = "§e") {
+ fun clickableChat(
+ message: String,
+ onClick: () -> Any,
+ expireAt: SimpleTimeMark = SimpleTimeMark.farFuture(),
+ prefix: Boolean = true,
+ prefixColor: String = "§e"
+ ) {
val msgPrefix = if (prefix) prefixColor + CHAT_PREFIX else ""
- ChatClickActionManager.oneTimeClick(msgPrefix + message, onClick)
+ ChatClickActionManager.oneTimeClick(msgPrefix + message, onClick, expireAt)
}
/**