Log messages we throw out to debug

This commit is contained in:
DaMachinator 2018-01-23 13:45:33 -05:00 committed by Arcanitor
parent 2f4b4c0651
commit f1b37bd99f
1 changed files with 10 additions and 3 deletions

View File

@ -18,15 +18,22 @@ class ServerChatHelper {
val user = nextMessage.username val user = nextMessage.username
val text = nextMessage.text.trim() val text = nextMessage.text.trim()
val message: String var message: String = ""
if (!text.isEmpty()) { if (!text.isEmpty()) {
val section: Char = '\u00A7' val section: Char = '\u00A7'
message = when (nextMessage.event) { val event = nextMessage.event
message = when (event) {
"user_action" -> "* $user $text" "user_action" -> "* $user $text"
"" -> "<$user> $text" "" -> "<$user> $text"
"join_leave" -> section.toString()+"6-- $user $text" "join_leave" -> section.toString()+"6-- $user $text"
else -> "" else -> {
CivilEngineering.logger.debug("Threw out message with unhandled event: $event")
CivilEngineering.logger.debug(" Message contents:")
CivilEngineering.logger.debug(" User: $user")
CivilEngineering.logger.debug(" Text: $text")
return
}
} }
if (message.isNotEmpty()) if (message.isNotEmpty())
FMLCommonHandler.instance().minecraftServerInstance.playerList.sendMessage(TextComponentString(message)) FMLCommonHandler.instance().minecraftServerInstance.playerList.sendMessage(TextComponentString(message))