aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/utils/TextUtils.kt
blob: 6da1dd8069846786302f6011fb91d4d0c29a892a (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 dulkirmod.utils

import dulkirmod.DulkirMod
import net.minecraft.util.ChatComponentText

object TextUtils {
	fun info(text: String, prefix: Boolean = true) {
		val textPrefix = if (prefix) "${DulkirMod.CHAT_PREFIX} " else ""
		DulkirMod.mc.thePlayer.addChatMessage(ChatComponentText("$textPrefix$text§r"))
	}

	fun toggledMessage(message: String, state: Boolean) {
		val stateText = if (state) "§aON" else "§cOFF"
		info("§9Toggled $message §8[$stateText§8]§r")
	}

	fun sendPartyChatMessage(message: String) {
		sendMessage("/pc $message")
	}

	fun sendMessage(message: String) {
		DulkirMod.mc.thePlayer.sendChatMessage(message)
	}
}