Skip to content

Commit ce572f5

Browse files
committed
listAsResponse implemented in ServerMessagingAPI.kt.
Signed-off-by: Pavel Erokhin (MairwunNx) <MairwunNx@gmail.com>
1 parent cafd996 commit ce572f5

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/main/kotlin/com/mairwunnx/projectessentials/core/api/v1/messaging/ServerMessagingAPI.kt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,23 @@ object ServerMessagingAPI {
3232
* @since 2.0.0-SNAPSHOT.2.
3333
*/
3434
fun response(message: () -> String) = logger.info("> ${message()}")
35+
36+
/**
37+
* Send list like response to server.
38+
*
39+
* For example, list all player homes or
40+
* warps or permissions, etc.
41+
*
42+
* @param list list to display in server console.
43+
* @param title list title, list name or something like that.
44+
* @since 2.0.0-RC.3.
45+
*/
46+
fun listAsResponse(list: List<String>, title: () -> String) = response {
47+
"""
48+
49+
${title()}
50+
51+
${list.joinToString(separator = ",\n") { " > $it" }}
52+
"""
53+
}
3554
}

0 commit comments

Comments
 (0)