style: 도움말 및 웰컴 메시지 색상 커스터마이징
- 볼드체 모두 제거 - 카테고리별 고유 커스텀 RGB 색상 적용 - 도움말: 좌표(노랑), 스폰(연두), 텔레포트(하늘), 닉네임(보라), 머리(주황), 제작대(라임), 메뉴(핑크) - 웰컴: 구분선(회색), 환영(하늘), 카테고리(노랑)
This commit is contained in:
parent
2bf161bf15
commit
2d42669545
2 changed files with 57 additions and 63 deletions
|
|
@ -1,13 +1,29 @@
|
|||
package com.beemer.essentials.command
|
||||
|
||||
import net.minecraft.ChatFormatting
|
||||
import net.minecraft.commands.Commands
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.network.chat.TextColor
|
||||
import net.minecraft.server.level.ServerPlayer
|
||||
import net.neoforged.bus.api.SubscribeEvent
|
||||
import net.neoforged.neoforge.event.RegisterCommandsEvent
|
||||
|
||||
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
|
||||
fun onRegisterCommands(event: RegisterCommandsEvent) {
|
||||
listOf("도움말", "help", "essentials").forEach { command ->
|
||||
|
|
@ -24,15 +40,11 @@ object HelpCommand {
|
|||
private fun showHelp(player: ServerPlayer) {
|
||||
val header =
|
||||
Component.literal("══════════ ")
|
||||
.withStyle { it.withColor(ChatFormatting.DARK_GRAY) }
|
||||
.append(
|
||||
Component.literal("도움말").withStyle {
|
||||
it.withColor(ChatFormatting.GOLD).withBold(true)
|
||||
}
|
||||
)
|
||||
.withStyle { it.withColor(COLOR_SEPARATOR) }
|
||||
.append(Component.literal("도움말").withStyle { it.withColor(COLOR_HEADER) })
|
||||
.append(
|
||||
Component.literal(" ══════════").withStyle {
|
||||
it.withColor(ChatFormatting.DARK_GRAY)
|
||||
it.withColor(COLOR_SEPARATOR)
|
||||
}
|
||||
)
|
||||
|
||||
|
|
@ -40,7 +52,7 @@ object HelpCommand {
|
|||
player.sendSystemMessage(Component.empty())
|
||||
|
||||
// 좌표 관리
|
||||
sendCategory(player, "좌표 관리", ChatFormatting.YELLOW)
|
||||
sendCategory(player, "좌표 관리", COLOR_COORDINATE)
|
||||
sendCommand(player, "/좌표", "저장된 좌표 목록 (GUI)")
|
||||
sendCommand(player, "/좌표추가 <이름>", "현재 위치 저장")
|
||||
sendCommand(player, "/좌표이동 <이름>", "해당 좌표로 이동")
|
||||
|
|
@ -48,77 +60,61 @@ object HelpCommand {
|
|||
player.sendSystemMessage(Component.empty())
|
||||
|
||||
// 스폰
|
||||
sendCategory(player, "스폰", ChatFormatting.GREEN)
|
||||
sendCategory(player, "스폰", COLOR_SPAWN)
|
||||
sendCommand(player, "/스폰", "스폰으로 이동")
|
||||
sendCommand(player, "/스폰설정", "현재 위치를 스폰으로 설정")
|
||||
sendCommand(player, "/스폰삭제", "커스텀 스폰 삭제")
|
||||
player.sendSystemMessage(Component.empty())
|
||||
|
||||
// 텔레포트
|
||||
sendCategory(player, "텔레포트", ChatFormatting.AQUA)
|
||||
sendCategory(player, "텔레포트", COLOR_TELEPORT)
|
||||
sendCommand(player, "/tpa", "플레이어 선택 (GUI)")
|
||||
sendCommand(player, "/back", "이전 위치로 이동")
|
||||
player.sendSystemMessage(Component.empty())
|
||||
|
||||
// 닉네임
|
||||
sendCategory(player, "닉네임", ChatFormatting.LIGHT_PURPLE)
|
||||
sendCategory(player, "닉네임", COLOR_NICKNAME)
|
||||
sendCommand(player, "/닉네임 변경 <닉네임>", "닉네임 설정")
|
||||
sendCommand(player, "/닉네임 초기화", "닉네임 초기화")
|
||||
player.sendSystemMessage(Component.empty())
|
||||
|
||||
// 머리
|
||||
sendCategory(player, "머리", ChatFormatting.GOLD)
|
||||
sendCategory(player, "머리", COLOR_HEAD)
|
||||
sendCommand(player, "/머리", "내 머리 아이템 받기")
|
||||
sendCommand(player, "/머리 <닉네임>", "해당 플레이어 머리 받기")
|
||||
player.sendSystemMessage(Component.empty())
|
||||
|
||||
// 제작대
|
||||
sendCategory(player, "제작대", ChatFormatting.WHITE)
|
||||
sendCategory(player, "제작대", COLOR_WORKBENCH)
|
||||
sendCommand(player, "/제작대", "제작대 열기")
|
||||
player.sendSystemMessage(Component.empty())
|
||||
|
||||
// 메뉴
|
||||
sendCategory(player, "메뉴", ChatFormatting.LIGHT_PURPLE)
|
||||
sendCategory(player, "메뉴", COLOR_MENU)
|
||||
sendCommand(player, "/메뉴", "메뉴 GUI 열기")
|
||||
sendCommand(player, "Shift + F", "메뉴 GUI 열기 (단축키)")
|
||||
|
||||
val footer =
|
||||
Component.literal("═══════════════════════════════").withStyle {
|
||||
it.withColor(ChatFormatting.DARK_GRAY)
|
||||
it.withColor(COLOR_SEPARATOR)
|
||||
}
|
||||
player.sendSystemMessage(footer)
|
||||
}
|
||||
|
||||
private fun sendCategory(player: ServerPlayer, name: String, color: ChatFormatting) {
|
||||
private fun sendCategory(player: ServerPlayer, name: String, color: TextColor) {
|
||||
val message =
|
||||
Component.literal("▸ ")
|
||||
.withStyle { it.withColor(color) }
|
||||
.append(
|
||||
Component.literal(name).withStyle {
|
||||
it.withColor(color).withBold(true)
|
||||
}
|
||||
)
|
||||
.append(Component.literal(name).withStyle { it.withColor(color) })
|
||||
player.sendSystemMessage(message)
|
||||
}
|
||||
|
||||
private fun sendCommand(player: ServerPlayer, cmd: String, desc: String) {
|
||||
val message =
|
||||
Component.literal(" ")
|
||||
.append(
|
||||
Component.literal(cmd).withStyle {
|
||||
it.withColor(ChatFormatting.WHITE)
|
||||
}
|
||||
)
|
||||
.append(
|
||||
Component.literal(" - ").withStyle {
|
||||
it.withColor(ChatFormatting.DARK_GRAY)
|
||||
}
|
||||
)
|
||||
.append(
|
||||
Component.literal(desc).withStyle {
|
||||
it.withColor(ChatFormatting.GRAY)
|
||||
}
|
||||
)
|
||||
.append(Component.literal(cmd).withStyle { it.withColor(COLOR_COMMAND) })
|
||||
.append(Component.literal(" - ").withStyle { it.withColor(COLOR_DASH) })
|
||||
.append(Component.literal(desc).withStyle { it.withColor(COLOR_DESC) })
|
||||
player.sendSystemMessage(message)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import com.beemer.essentials.data.Location
|
|||
import com.beemer.essentials.util.ChatUtils
|
||||
import com.beemer.essentials.util.DimensionUtils
|
||||
import com.beemer.essentials.util.SoundUtils
|
||||
import net.minecraft.ChatFormatting
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.server.level.ServerPlayer
|
||||
import net.neoforged.bus.api.SubscribeEvent
|
||||
|
|
@ -50,56 +49,55 @@ object PlayerEvents {
|
|||
|
||||
/** 신규 플레이어 도움말 */
|
||||
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 =
|
||||
Component.literal("═══════════════════════════════").withStyle {
|
||||
it.withColor(ChatFormatting.DARK_AQUA)
|
||||
it.withColor(colorSeparator)
|
||||
}
|
||||
|
||||
player.sendSystemMessage(Component.empty())
|
||||
player.sendSystemMessage(separator)
|
||||
player.sendSystemMessage(
|
||||
Component.literal("🎉 서버에 오신 것을 환영합니다!").withStyle {
|
||||
it.withColor(ChatFormatting.AQUA).withBold(true)
|
||||
}
|
||||
Component.literal("🎉 서버에 오신 것을 환영합니다!").withStyle { it.withColor(colorWelcome) }
|
||||
)
|
||||
player.sendSystemMessage(Component.empty())
|
||||
|
||||
// 기본 명령어 안내
|
||||
player.sendSystemMessage(
|
||||
Component.literal("▸ 기본 명령어").withStyle {
|
||||
it.withColor(ChatFormatting.YELLOW).withBold(true)
|
||||
}
|
||||
Component.literal("▸ 기본 명령어").withStyle { it.withColor(colorCategory) }
|
||||
)
|
||||
sendGuideItem(player, "/도움말", "명령어 목록 보기")
|
||||
sendGuideItem(player, "/메뉴", "메뉴 GUI 열기")
|
||||
sendGuideItem(player, "/스폰", "스폰으로 이동")
|
||||
sendGuideItem(player, "/도움말", "명령어 목록 보기", colorCommand, colorDesc)
|
||||
sendGuideItem(player, "/메뉴", "메뉴 GUI 열기", colorCommand, colorDesc)
|
||||
sendGuideItem(player, "/스폰", "스폰으로 이동", colorCommand, colorDesc)
|
||||
player.sendSystemMessage(Component.empty())
|
||||
|
||||
// 단축키 안내
|
||||
player.sendSystemMessage(
|
||||
Component.literal("▸ 단축키").withStyle {
|
||||
it.withColor(ChatFormatting.YELLOW).withBold(true)
|
||||
}
|
||||
Component.literal("▸ 단축키").withStyle { it.withColor(colorCategory) }
|
||||
)
|
||||
sendGuideItem(player, "Shift + F", "메뉴 GUI 열기")
|
||||
sendGuideItem(player, "Shift + F", "메뉴 GUI 열기", colorCommand, colorDesc)
|
||||
|
||||
player.sendSystemMessage(separator)
|
||||
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(
|
||||
Component.literal(" ")
|
||||
.append(
|
||||
Component.literal(key).withStyle {
|
||||
it.withColor(ChatFormatting.WHITE)
|
||||
}
|
||||
)
|
||||
.append(
|
||||
Component.literal(" - $desc").withStyle {
|
||||
it.withColor(ChatFormatting.GRAY)
|
||||
}
|
||||
)
|
||||
.append(Component.literal(key).withStyle { it.withColor(colorKey) })
|
||||
.append(Component.literal(" - $desc").withStyle { it.withColor(colorDesc) })
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue