diff options
author | CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> | 2024-04-16 02:34:51 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-15 18:34:51 +0200 |
commit | 66b98b62ec0ef0aa56d47af48131d661d43de579 (patch) | |
tree | faaf994f850cc1303d699654a1129d9fd6449353 /src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt | |
parent | 377fd979821296cde9d6ceb2fa4b365e4637232a (diff) | |
download | skyhanni-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.kt | 11 |
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) } /** |