diff options
author | inglettronald <71849533+inglettronald@users.noreply.github.com> | 2023-02-13 20:10:06 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-13 20:10:06 -0600 |
commit | 7df778d6ac01a6d350608a5962b9344493444ebc (patch) | |
tree | 69abbc662cbb3a325f05aa4fbcd2f0fa0ff37cd6 /src/main/kotlin/dulkirmod/utils | |
parent | 1c27ca0e7586c27de7ddd51723b5bf7b0ab50230 (diff) | |
parent | 3985b5f7417571f4a1e90eefa287af053b740e69 (diff) | |
download | DulkirMod-7df778d6ac01a6d350608a5962b9344493444ebc.tar.gz DulkirMod-7df778d6ac01a6d350608a5962b9344493444ebc.tar.bz2 DulkirMod-7df778d6ac01a6d350608a5962b9344493444ebc.zip |
Merge pull request #10 from IlmarsXd/master
Cleaned up some code and fixed AbiphoneDND log spam
Diffstat (limited to 'src/main/kotlin/dulkirmod/utils')
-rw-r--r-- | src/main/kotlin/dulkirmod/utils/TextUtils.kt | 24 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/utils/Utils.kt | 9 |
2 files changed, 26 insertions, 7 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 diff --git a/src/main/kotlin/dulkirmod/utils/Utils.kt b/src/main/kotlin/dulkirmod/utils/Utils.kt index 81646cb..47408c3 100644 --- a/src/main/kotlin/dulkirmod/utils/Utils.kt +++ b/src/main/kotlin/dulkirmod/utils/Utils.kt @@ -3,7 +3,6 @@ package dulkirmod.utils import com.google.gson.Gson import dulkirmod.DulkirMod.Companion.mc import dulkirmod.config.Config -import net.minecraft.util.ChatComponentText import net.minecraft.util.EnumChatFormatting import java.awt.Toolkit import java.awt.datatransfer.Clipboard @@ -48,11 +47,7 @@ object Utils { Config.drinkingSelector = import.drinkingFix Config.ignoreHaste = import.ignoreHaste } catch (e: Exception) { - mc.thePlayer.addChatMessage( - ChatComponentText( - EnumChatFormatting.GOLD.toString() + "" + EnumChatFormatting.BOLD + "Current clipboard is not a recognizable Custom Animation Preset." - ) - ) + TextUtils.info("§6§lCurrent clipboard is not a recognizable Custom Animation Preset.") } mc.displayGuiScreen(null) } @@ -65,7 +60,7 @@ object Utils { return false } if (mc.thePlayer.worldScoreboard.getObjectiveInDisplaySlot(1) == null) - return false; + return false return stripColorCodes(mc.thePlayer.worldScoreboard.getObjectiveInDisplaySlot(1).displayName).contains("SKYBLOCK") } return false |