Skip to content

Commit

Permalink
chore: Changed color
Browse files Browse the repository at this point in the history
  • Loading branch information
slmpc committed Jan 17, 2025
1 parent 1cc955a commit a8665ce
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,16 @@ abstract class AbstractModule(
enableCustomers.add {
EventBus.subscribe(this)
runSafe {
if (ChatInfo.isEnabled) ChatUtils.sendMessageWithID("${name.translation} ${ChatFormatting.GREEN}Enabled", 1337)
if (ChatInfo.isEnabled)
ChatUtils.sendMessageWithID("${name.translation} is ${ChatFormatting.GREEN}Enabled", name.hashCode())
}
}

disableCustomers.add {
EventBus.unsubscribe(this)
runSafe {
if (ChatInfo.isEnabled) ChatUtils.sendMessageWithID("${name.translation} ${ChatFormatting.RED}Disabled", 1337)
if (ChatInfo.isEnabled)
ChatUtils.sendMessageWithID("${name.translation} is ${ChatFormatting.RED}Disabled", name.hashCode())
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ object UiSetting: Module(

// Color
val primaryColor by setting("primary-color", ColorRGB(0, 0, 0, 200)) { page == Page.COLOR }
val secondaryColor by setting("secondary-color", ColorRGB(240, 120, 60)) { page == Page.COLOR }
val secondaryColor by setting("secondary-color", ColorRGB(128, 128, 128)) { page == Page.COLOR }
val textColor by setting("text-color", ColorRGB(255, 255, 255)) { page == Page.COLOR }
val outlineColor by setting("outline-color", ColorRGB(0, 0, 0)) { page == Page.COLOR }
val sliderColor by setting("slider-color", ColorRGB(255, 255, 255)) { page == Page.COLOR }
val backgroundColor by setting("background-color", ColorRGB(240, 120, 60)) { page == Page.COLOR }
val sliderColor by setting("slider-color", ColorRGB(128, 128, 128)) { page == Page.COLOR }
val backgroundColor by setting("background-color", ColorRGB(128, 128, 128)) { page == Page.COLOR }

private enum class Page(override val key: CharSequence): TranslationEnum {
GENERAL("general"),
Expand Down
24 changes: 13 additions & 11 deletions src/main/kotlin/dev/exceptionteam/sakura/utils/ingame/ChatUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,26 @@ object ChatUtils {
const val UNDER_LINE = SECTION + "n"
const val ITALIC = SECTION + "o"
const val RESET = SECTION + "r"
const val colorMSG = SECTION + "r"
const val colorKANJI = SECTION + "d"
const val colorWarn = SECTION + "6" + SECTION + "l"
const val colorError = SECTION + "4" + SECTION + "l"
const val colorBracket = SECTION + "7"
const val COLOR_MSG = SECTION + "r"
const val COLOR_KANJI = SECTION + "d"
const val COLOR_WARN = SECTION + "6" + SECTION + "l"
const val COLOR_ERROR = SECTION + "4" + SECTION + "l"
const val COLOR_BRACKET = SECTION + "7"
var msgCount = 0
private var tempMsg: String? = null

const val MAIN_COLOR = LIGHT_PURPLE

private fun bracketBuilder(kanji: String): String {
return "$RESET$colorBracket[$RESET$kanji$colorBracket] $RESET"
return "$RESET$COLOR_BRACKET[$RESET$kanji$COLOR_BRACKET] $RESET"
}

fun sendWarnMessage(message: String) {
sendMessage(bracketBuilder(colorWarn + "WARN") + RESET + colorMSG + message)
sendMessage(bracketBuilder(COLOR_WARN + "WARN") + RESET + COLOR_MSG + message)
}

fun sendErrorMessage(message: String) {
sendMessage(bracketBuilder(colorError + "ERROR") + RESET + colorMSG + message)
sendMessage(bracketBuilder(COLOR_ERROR + "ERROR") + RESET + COLOR_MSG + message)
}

fun sendMessage(messageArray: Array<String?>) {
Expand All @@ -59,18 +61,18 @@ object ChatUtils {

fun sendMessage(message: String) {
Minecraft.getInstance().gui?.let { gameHUD ->
val text = Component.literal("${bracketBuilder(AQUA + Sakura.NAME)} ${message.replace("§", SECTION)}")
val text = Component.literal("${bracketBuilder(MAIN_COLOR + Sakura.NAME)} ${message.replace("§", SECTION)}")
gameHUD.chat?.addMessage(text)
}
}

fun sendNoSpamMessage(message: String) {
val text = Component.literal("${bracketBuilder(AQUA + Sakura.NAME)} ${message.replace("§", SECTION)}")
val text = Component.literal("${bracketBuilder(MAIN_COLOR + Sakura.NAME)} ${message.replace("§", SECTION)}")
(Minecraft.getInstance().gui.chat as IChatComponent).sakuraAddMessage(text, text.hashCode())
}

fun sendMessageWithID(message: String, id: Int) {
val text = Component.literal("${bracketBuilder(AQUA + Sakura.NAME)} ${message.replace("§", SECTION)}")
val text = Component.literal("${bracketBuilder(MAIN_COLOR + Sakura.NAME)} ${message.replace("§", SECTION)}")
(Minecraft.getInstance().gui.chat as IChatComponent).sakuraAddMessage(text, id)
}
}

0 comments on commit a8665ce

Please sign in to comment.