summaryrefslogtreecommitdiff
path: root/src/main/kotlin/io/dico/parcels2/command/ParcelsChatHandler.kt
blob: 52f11042446e3d02a3cfc2304dd1a359ce9d0326 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package io.dico.parcels2.command

import io.dico.dicore.Formatting
import io.dico.dicore.command.EMessageType
import io.dico.dicore.command.ExecutionContext
import io.dico.dicore.command.chat.AbstractChatHandler
import io.dico.parcels2.util.ext.plus

class ParcelsChatHandler : AbstractChatHandler() {

    override fun getMessagePrefixForType(type: EMessageType?): String {
        return Formatting.RED + "[Parcels] "
    }

    override fun createMessage(context: ExecutionContext, type: EMessageType, message: String?): String? {
        if (message.isNullOrEmpty()) return null
        var result = getChatFormatForType(type) + message
        if (context.address.mainKey != "info") {
            result = getMessagePrefixForType(type) + result
        }
        return result
    }

}