diff options
author | IlmarsXd <ilmars500@gmail.com> | 2023-02-08 16:20:12 +0200 |
---|---|---|
committer | IlmarsXd <ilmars500@gmail.com> | 2023-02-08 16:20:12 +0200 |
commit | 695ca674ce4cd4d7565cbdd08986394d65fac90e (patch) | |
tree | 0ce2498cdb9f6da98e831efeeb437279eb97a14c /src/main/kotlin/dulkirmod/utils | |
parent | bae1935070891639839716892cd08053cd348829 (diff) | |
download | DulkirMod-695ca674ce4cd4d7565cbdd08986394d65fac90e.tar.gz DulkirMod-695ca674ce4cd4d7565cbdd08986394d65fac90e.tar.bz2 DulkirMod-695ca674ce4cd4d7565cbdd08986394d65fac90e.zip |
added TextUtils
Diffstat (limited to 'src/main/kotlin/dulkirmod/utils')
-rw-r--r-- | src/main/kotlin/dulkirmod/utils/TextUtils.kt | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/main/kotlin/dulkirmod/utils/TextUtils.kt b/src/main/kotlin/dulkirmod/utils/TextUtils.kt new file mode 100644 index 0000000..6da1dd8 --- /dev/null +++ b/src/main/kotlin/dulkirmod/utils/TextUtils.kt @@ -0,0 +1,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) + } +}
\ No newline at end of file |