Implemented Global Chat
Added global chat feature, so players can still maintain global communication while being in their own clan chat An individual player can opt out of global chat by using the ::muteglobal command Implemented automatic message splitting for clan and global chat Implemented colour selection for global chat (prefix your message with hex colour code, e.g. //%690420 before the message)
This commit is contained in:
@@ -7,14 +7,18 @@ const val GREEN = "<col=66ff33>"
|
||||
const val BLUE = "<col=3366ff>"
|
||||
const val PURPLE = "<col=cc00ff>"
|
||||
|
||||
fun colorize(line: String): String{
|
||||
val new = line.replace("%R", RED)
|
||||
.replace("%O", ORANGE)
|
||||
.replace("%Y", YELLOW)
|
||||
.replace("%G", GREEN)
|
||||
.replace("%B", BLUE)
|
||||
.replace("%P", PURPLE).append("</col>") + " "
|
||||
return new
|
||||
private val pattern = Regex("%[0-9a-fA-F]{6}")
|
||||
private val testData = arrayOf("This is a string with no colors.", "This %R is a string with one color.", "This %R %G %B is a string with multiple colors.", "This %ffffff is an arbitrary hex string.")
|
||||
|
||||
fun colorize(line: String): String {
|
||||
return line.replace("%R", RED)
|
||||
.replace("%O", ORANGE)
|
||||
.replace("%Y", YELLOW)
|
||||
.replace("%G", GREEN)
|
||||
.replace("%B", BLUE)
|
||||
.replace("%P", PURPLE)
|
||||
.replace(pattern) { matchResult -> "<col=${matchResult.value.substring(1)}>" }
|
||||
.append("</col>") + " "
|
||||
}
|
||||
|
||||
fun colorize(line: String, hexColor: String): String{
|
||||
|
||||
Reference in New Issue
Block a user