style: 도움말 및 웰컴 메시지 색상 커스터마이징

- 볼드체 모두 제거
- 카테고리별 고유 커스텀 RGB 색상 적용
- 도움말: 좌표(노랑), 스폰(연두), 텔레포트(하늘), 닉네임(보라), 머리(주황), 제작대(라임), 메뉴(핑크)
- 웰컴: 구분선(회색), 환영(하늘), 카테고리(노랑)
This commit is contained in:
Caadiq 2025-12-31 18:57:29 +09:00
parent 2bf161bf15
commit 2d42669545
2 changed files with 57 additions and 63 deletions

View file

@ -1,13 +1,29 @@
package com.beemer.essentials.command package com.beemer.essentials.command
import net.minecraft.ChatFormatting
import net.minecraft.commands.Commands import net.minecraft.commands.Commands
import net.minecraft.network.chat.Component import net.minecraft.network.chat.Component
import net.minecraft.network.chat.TextColor
import net.minecraft.server.level.ServerPlayer import net.minecraft.server.level.ServerPlayer
import net.neoforged.bus.api.SubscribeEvent import net.neoforged.bus.api.SubscribeEvent
import net.neoforged.neoforge.event.RegisterCommandsEvent import net.neoforged.neoforge.event.RegisterCommandsEvent
object HelpCommand { object HelpCommand {
// 커스텀 색상 정의
private val COLOR_HEADER = TextColor.fromRgb(0xFFD700) // 골드
private val COLOR_SEPARATOR = TextColor.fromRgb(0x555555) // 어두운 회색
private val COLOR_COMMAND = TextColor.fromRgb(0xFFFFFF) // 흰색
private val COLOR_DESC = TextColor.fromRgb(0xAAAAAA) // 밝은 회색
private val COLOR_DASH = TextColor.fromRgb(0x666666) // 회색
// 카테고리별 색상
private val COLOR_COORDINATE = TextColor.fromRgb(0xFFE066) // 밝은 노랑
private val COLOR_SPAWN = TextColor.fromRgb(0x7FD88C) // 연두색
private val COLOR_TELEPORT = TextColor.fromRgb(0x7DD3FC) // 하늘색
private val COLOR_NICKNAME = TextColor.fromRgb(0xE879F9) // 보라색
private val COLOR_HEAD = TextColor.fromRgb(0xFBBF24) // 주황색
private val COLOR_WORKBENCH = TextColor.fromRgb(0xA3E635) // 라임색
private val COLOR_MENU = TextColor.fromRgb(0xF472B6) // 핑크색
@SubscribeEvent @SubscribeEvent
fun onRegisterCommands(event: RegisterCommandsEvent) { fun onRegisterCommands(event: RegisterCommandsEvent) {
listOf("도움말", "help", "essentials").forEach { command -> listOf("도움말", "help", "essentials").forEach { command ->
@ -24,15 +40,11 @@ object HelpCommand {
private fun showHelp(player: ServerPlayer) { private fun showHelp(player: ServerPlayer) {
val header = val header =
Component.literal("══════════ ") Component.literal("══════════ ")
.withStyle { it.withColor(ChatFormatting.DARK_GRAY) } .withStyle { it.withColor(COLOR_SEPARATOR) }
.append( .append(Component.literal("도움말").withStyle { it.withColor(COLOR_HEADER) })
Component.literal("도움말").withStyle {
it.withColor(ChatFormatting.GOLD).withBold(true)
}
)
.append( .append(
Component.literal(" ══════════").withStyle { Component.literal(" ══════════").withStyle {
it.withColor(ChatFormatting.DARK_GRAY) it.withColor(COLOR_SEPARATOR)
} }
) )
@ -40,7 +52,7 @@ object HelpCommand {
player.sendSystemMessage(Component.empty()) player.sendSystemMessage(Component.empty())
// 좌표 관리 // 좌표 관리
sendCategory(player, "좌표 관리", ChatFormatting.YELLOW) sendCategory(player, "좌표 관리", COLOR_COORDINATE)
sendCommand(player, "/좌표", "저장된 좌표 목록 (GUI)") sendCommand(player, "/좌표", "저장된 좌표 목록 (GUI)")
sendCommand(player, "/좌표추가 <이름>", "현재 위치 저장") sendCommand(player, "/좌표추가 <이름>", "현재 위치 저장")
sendCommand(player, "/좌표이동 <이름>", "해당 좌표로 이동") sendCommand(player, "/좌표이동 <이름>", "해당 좌표로 이동")
@ -48,77 +60,61 @@ object HelpCommand {
player.sendSystemMessage(Component.empty()) player.sendSystemMessage(Component.empty())
// 스폰 // 스폰
sendCategory(player, "스폰", ChatFormatting.GREEN) sendCategory(player, "스폰", COLOR_SPAWN)
sendCommand(player, "/스폰", "스폰으로 이동") sendCommand(player, "/스폰", "스폰으로 이동")
sendCommand(player, "/스폰설정", "현재 위치를 스폰으로 설정") sendCommand(player, "/스폰설정", "현재 위치를 스폰으로 설정")
sendCommand(player, "/스폰삭제", "커스텀 스폰 삭제") sendCommand(player, "/스폰삭제", "커스텀 스폰 삭제")
player.sendSystemMessage(Component.empty()) player.sendSystemMessage(Component.empty())
// 텔레포트 // 텔레포트
sendCategory(player, "텔레포트", ChatFormatting.AQUA) sendCategory(player, "텔레포트", COLOR_TELEPORT)
sendCommand(player, "/tpa", "플레이어 선택 (GUI)") sendCommand(player, "/tpa", "플레이어 선택 (GUI)")
sendCommand(player, "/back", "이전 위치로 이동") sendCommand(player, "/back", "이전 위치로 이동")
player.sendSystemMessage(Component.empty()) player.sendSystemMessage(Component.empty())
// 닉네임 // 닉네임
sendCategory(player, "닉네임", ChatFormatting.LIGHT_PURPLE) sendCategory(player, "닉네임", COLOR_NICKNAME)
sendCommand(player, "/닉네임 변경 <닉네임>", "닉네임 설정") sendCommand(player, "/닉네임 변경 <닉네임>", "닉네임 설정")
sendCommand(player, "/닉네임 초기화", "닉네임 초기화") sendCommand(player, "/닉네임 초기화", "닉네임 초기화")
player.sendSystemMessage(Component.empty()) player.sendSystemMessage(Component.empty())
// 머리 // 머리
sendCategory(player, "머리", ChatFormatting.GOLD) sendCategory(player, "머리", COLOR_HEAD)
sendCommand(player, "/머리", "내 머리 아이템 받기") sendCommand(player, "/머리", "내 머리 아이템 받기")
sendCommand(player, "/머리 <닉네임>", "해당 플레이어 머리 받기") sendCommand(player, "/머리 <닉네임>", "해당 플레이어 머리 받기")
player.sendSystemMessage(Component.empty()) player.sendSystemMessage(Component.empty())
// 제작대 // 제작대
sendCategory(player, "제작대", ChatFormatting.WHITE) sendCategory(player, "제작대", COLOR_WORKBENCH)
sendCommand(player, "/제작대", "제작대 열기") sendCommand(player, "/제작대", "제작대 열기")
player.sendSystemMessage(Component.empty()) player.sendSystemMessage(Component.empty())
// 메뉴 // 메뉴
sendCategory(player, "메뉴", ChatFormatting.LIGHT_PURPLE) sendCategory(player, "메뉴", COLOR_MENU)
sendCommand(player, "/메뉴", "메뉴 GUI 열기") sendCommand(player, "/메뉴", "메뉴 GUI 열기")
sendCommand(player, "Shift + F", "메뉴 GUI 열기 (단축키)") sendCommand(player, "Shift + F", "메뉴 GUI 열기 (단축키)")
val footer = val footer =
Component.literal("═══════════════════════════════").withStyle { Component.literal("═══════════════════════════════").withStyle {
it.withColor(ChatFormatting.DARK_GRAY) it.withColor(COLOR_SEPARATOR)
} }
player.sendSystemMessage(footer) player.sendSystemMessage(footer)
} }
private fun sendCategory(player: ServerPlayer, name: String, color: ChatFormatting) { private fun sendCategory(player: ServerPlayer, name: String, color: TextColor) {
val message = val message =
Component.literal("") Component.literal("")
.withStyle { it.withColor(color) } .withStyle { it.withColor(color) }
.append( .append(Component.literal(name).withStyle { it.withColor(color) })
Component.literal(name).withStyle {
it.withColor(color).withBold(true)
}
)
player.sendSystemMessage(message) player.sendSystemMessage(message)
} }
private fun sendCommand(player: ServerPlayer, cmd: String, desc: String) { private fun sendCommand(player: ServerPlayer, cmd: String, desc: String) {
val message = val message =
Component.literal(" ") Component.literal(" ")
.append( .append(Component.literal(cmd).withStyle { it.withColor(COLOR_COMMAND) })
Component.literal(cmd).withStyle { .append(Component.literal(" - ").withStyle { it.withColor(COLOR_DASH) })
it.withColor(ChatFormatting.WHITE) .append(Component.literal(desc).withStyle { it.withColor(COLOR_DESC) })
}
)
.append(
Component.literal(" - ").withStyle {
it.withColor(ChatFormatting.DARK_GRAY)
}
)
.append(
Component.literal(desc).withStyle {
it.withColor(ChatFormatting.GRAY)
}
)
player.sendSystemMessage(message) player.sendSystemMessage(message)
} }
} }

View file

@ -6,7 +6,6 @@ import com.beemer.essentials.data.Location
import com.beemer.essentials.util.ChatUtils import com.beemer.essentials.util.ChatUtils
import com.beemer.essentials.util.DimensionUtils import com.beemer.essentials.util.DimensionUtils
import com.beemer.essentials.util.SoundUtils import com.beemer.essentials.util.SoundUtils
import net.minecraft.ChatFormatting
import net.minecraft.network.chat.Component import net.minecraft.network.chat.Component
import net.minecraft.server.level.ServerPlayer import net.minecraft.server.level.ServerPlayer
import net.neoforged.bus.api.SubscribeEvent import net.neoforged.bus.api.SubscribeEvent
@ -50,56 +49,55 @@ object PlayerEvents {
/** 신규 플레이어 도움말 */ /** 신규 플레이어 도움말 */
private fun sendWelcomeGuide(player: ServerPlayer) { private fun sendWelcomeGuide(player: ServerPlayer) {
// 커스텀 색상 정의
val colorSeparator = net.minecraft.network.chat.TextColor.fromRgb(0x555555)
val colorWelcome = net.minecraft.network.chat.TextColor.fromRgb(0x7DD3FC)
val colorCategory = net.minecraft.network.chat.TextColor.fromRgb(0xFFE066)
val colorCommand = net.minecraft.network.chat.TextColor.fromRgb(0xFFFFFF)
val colorDesc = net.minecraft.network.chat.TextColor.fromRgb(0xAAAAAA)
val separator = val separator =
Component.literal("═══════════════════════════════").withStyle { Component.literal("═══════════════════════════════").withStyle {
it.withColor(ChatFormatting.DARK_AQUA) it.withColor(colorSeparator)
} }
player.sendSystemMessage(Component.empty()) player.sendSystemMessage(Component.empty())
player.sendSystemMessage(separator) player.sendSystemMessage(separator)
player.sendSystemMessage( player.sendSystemMessage(
Component.literal("🎉 서버에 오신 것을 환영합니다!").withStyle { Component.literal("🎉 서버에 오신 것을 환영합니다!").withStyle { it.withColor(colorWelcome) }
it.withColor(ChatFormatting.AQUA).withBold(true)
}
) )
player.sendSystemMessage(Component.empty()) player.sendSystemMessage(Component.empty())
// 기본 명령어 안내 // 기본 명령어 안내
player.sendSystemMessage( player.sendSystemMessage(
Component.literal("▸ 기본 명령어").withStyle { Component.literal("▸ 기본 명령어").withStyle { it.withColor(colorCategory) }
it.withColor(ChatFormatting.YELLOW).withBold(true)
}
) )
sendGuideItem(player, "/도움말", "명령어 목록 보기") sendGuideItem(player, "/도움말", "명령어 목록 보기", colorCommand, colorDesc)
sendGuideItem(player, "/메뉴", "메뉴 GUI 열기") sendGuideItem(player, "/메뉴", "메뉴 GUI 열기", colorCommand, colorDesc)
sendGuideItem(player, "/스폰", "스폰으로 이동") sendGuideItem(player, "/스폰", "스폰으로 이동", colorCommand, colorDesc)
player.sendSystemMessage(Component.empty()) player.sendSystemMessage(Component.empty())
// 단축키 안내 // 단축키 안내
player.sendSystemMessage( player.sendSystemMessage(
Component.literal("▸ 단축키").withStyle { Component.literal("▸ 단축키").withStyle { it.withColor(colorCategory) }
it.withColor(ChatFormatting.YELLOW).withBold(true)
}
) )
sendGuideItem(player, "Shift + F", "메뉴 GUI 열기") sendGuideItem(player, "Shift + F", "메뉴 GUI 열기", colorCommand, colorDesc)
player.sendSystemMessage(separator) player.sendSystemMessage(separator)
player.sendSystemMessage(Component.empty()) player.sendSystemMessage(Component.empty())
} }
private fun sendGuideItem(player: ServerPlayer, key: String, desc: String) { private fun sendGuideItem(
player: ServerPlayer,
key: String,
desc: String,
colorKey: net.minecraft.network.chat.TextColor,
colorDesc: net.minecraft.network.chat.TextColor
) {
player.sendSystemMessage( player.sendSystemMessage(
Component.literal(" ") Component.literal(" ")
.append( .append(Component.literal(key).withStyle { it.withColor(colorKey) })
Component.literal(key).withStyle { .append(Component.literal(" - $desc").withStyle { it.withColor(colorDesc) })
it.withColor(ChatFormatting.WHITE)
}
)
.append(
Component.literal(" - $desc").withStyle {
it.withColor(ChatFormatting.GRAY)
}
)
) )
} }