From ad253e84995e343e6153bf797ad0ba5e53dda8f6 Mon Sep 17 00:00:00 2001 From: Caadiq Date: Thu, 18 Dec 2025 23:22:50 +0900 Subject: [PATCH] =?UTF-8?q?=EB=8F=84=EC=9B=80=EB=A7=90=20=EB=AA=85?= =?UTF-8?q?=EB=A0=B9=EC=96=B4=20=EC=B6=94=EA=B0=80,=20/=EC=95=88=ED=8B=B0?= =?UTF-8?q?=EB=AA=B9=20/=EB=B0=AD=EB=B3=B4=ED=98=B8=20=EB=AA=85=EB=A0=B9?= =?UTF-8?q?=EC=96=B4=20OP=EB=A7=8C=20=EC=82=AC=EC=9A=A9=20=EA=B0=80?= =?UTF-8?q?=EB=8A=A5=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Essentials/README.md | 8 ++ .../com/beemer/essentials/Essentials.kt | 1 + .../essentials/command/AntimobCommand.kt | 36 +++--- .../beemer/essentials/command/HelpCommand.kt | 113 ++++++++++++++++++ .../command/ProtectFarmlandCommand.kt | 34 ++++-- 5 files changed, 164 insertions(+), 28 deletions(-) create mode 100644 Essentials/src/main/kotlin/com/beemer/essentials/command/HelpCommand.kt diff --git a/Essentials/README.md b/Essentials/README.md index 99910d3..26ab9ff 100644 --- a/Essentials/README.md +++ b/Essentials/README.md @@ -17,6 +17,7 @@ - πŸ›‘οΈ **μ•ˆν‹°λͺΉ** - νŠΉμ • λͺΉ νŒ¨ν„΄ λΉ„ν™œμ„±ν™” - 🌾 **λ°­ 보호** - λ°Ÿμ•„λ„ 밭이 망가지지 μ•Šλ„λ‘ 보호 - πŸ’¬ **μ±„νŒ… 관리** - μ±„νŒ… ν˜•μ‹ λ³€κ²½ +- πŸ—Ώ **머리 μ•„μ΄ν…œ** - ν”Œλ ˆμ΄μ–΄ 머리 μ•„μ΄ν…œ μ§€κΈ‰ --- @@ -67,6 +68,13 @@ | ----------------------------- | ------------ | | `/밭보호`, `/protectfarmland` | λ°­ 보호 ν† κΈ€ | +### 머리 + +| λͺ…λ Ήμ–΄ | μ„€λͺ… | +| --------------------- | ------------------------------ | +| `/머리`, `/head` | μžμ‹ μ˜ 머리 μ•„μ΄ν…œ λ°›κΈ° | +| `/머리 <λ‹‰λ„€μž„/이름>` | ν•΄λ‹Ή ν”Œλ ˆμ΄μ–΄ 머리 μ•„μ΄ν…œ λ°›κΈ° | + ### μ±„νŒ… (κ΄€λ¦¬μž) | λͺ…λ Ήμ–΄ | μ„€λͺ… | diff --git a/Essentials/src/main/kotlin/com/beemer/essentials/Essentials.kt b/Essentials/src/main/kotlin/com/beemer/essentials/Essentials.kt index a2a8df5..94b9e0c 100644 --- a/Essentials/src/main/kotlin/com/beemer/essentials/Essentials.kt +++ b/Essentials/src/main/kotlin/com/beemer/essentials/Essentials.kt @@ -32,5 +32,6 @@ class Essentials(modEventBus: IEventBus) { NeoForge.EVENT_BUS.register(CoordinateCommand) NeoForge.EVENT_BUS.register(NicknameCommand) NeoForge.EVENT_BUS.register(HeadCommand) + NeoForge.EVENT_BUS.register(HelpCommand) } } diff --git a/Essentials/src/main/kotlin/com/beemer/essentials/command/AntimobCommand.kt b/Essentials/src/main/kotlin/com/beemer/essentials/command/AntimobCommand.kt index 99e7885..0180e0e 100644 --- a/Essentials/src/main/kotlin/com/beemer/essentials/command/AntimobCommand.kt +++ b/Essentials/src/main/kotlin/com/beemer/essentials/command/AntimobCommand.kt @@ -16,26 +16,28 @@ object AntimobCommand { fun onRegisterCommands(event: RegisterCommandsEvent) { listOf("antimob", "μ•ˆν‹°λͺΉ").forEach { command -> event.dispatcher.register( - Commands.literal(command).executes { context -> - val player = CommandUtils.getPlayerOrSendFailure(context.source) ?: return@executes 0 + Commands.literal(command).requires { it.hasPermission(2) }.executes { context -> + val player = + CommandUtils.getPlayerOrSendFailure(context.source) + ?: return@executes 0 - AntimobConfig.loadConfig() + AntimobConfig.loadConfig() - val container = SimpleContainer(9 * 2) + val container = SimpleContainer(9 * 2) - player.openMenu( - SimpleMenuProvider({ windowId, inv, _ -> - AntimobGui( - windowId, - inv, - container, - player - ) - }, Component.literal("μ•ˆν‹°λͺΉ μ„€μ •").withStyle { it.withColor(ChatFormatting.DARK_GRAY) }) - ) - 1 - } + player.openMenu( + SimpleMenuProvider( + { windowId, inv, _ -> + AntimobGui(windowId, inv, container, player) + }, + Component.literal("μ•ˆν‹°λͺΉ μ„€μ •").withStyle { + it.withColor(ChatFormatting.DARK_GRAY) + } + ) + ) + 1 + } ) } } -} \ No newline at end of file +} diff --git a/Essentials/src/main/kotlin/com/beemer/essentials/command/HelpCommand.kt b/Essentials/src/main/kotlin/com/beemer/essentials/command/HelpCommand.kt new file mode 100644 index 0000000..a348d44 --- /dev/null +++ b/Essentials/src/main/kotlin/com/beemer/essentials/command/HelpCommand.kt @@ -0,0 +1,113 @@ +package com.beemer.essentials.command + +import net.minecraft.ChatFormatting +import net.minecraft.commands.Commands +import net.minecraft.network.chat.Component +import net.minecraft.server.level.ServerPlayer +import net.neoforged.bus.api.SubscribeEvent +import net.neoforged.neoforge.event.RegisterCommandsEvent + +object HelpCommand { + @SubscribeEvent + fun onRegisterCommands(event: RegisterCommandsEvent) { + listOf("도움말", "help", "essentials").forEach { command -> + event.dispatcher.register( + Commands.literal(command).executes { context -> + val player = context.source.entity as? ServerPlayer ?: return@executes 0 + showHelp(player) + 1 + } + ) + } + } + + 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) + } + ) + .append( + Component.literal(" ══════════").withStyle { + it.withColor(ChatFormatting.DARK_GRAY) + } + ) + + player.sendSystemMessage(header) + player.sendSystemMessage(Component.empty()) + + // μ’Œν‘œ 관리 + sendCategory(player, "μ’Œν‘œ 관리", ChatFormatting.YELLOW) + sendCommand(player, "/μ’Œν‘œ", "μ €μž₯된 μ’Œν‘œ λͺ©λ‘ (GUI)") + sendCommand(player, "/μ’Œν‘œμΆ”κ°€ <이름>", "ν˜„μž¬ μœ„μΉ˜ μ €μž₯") + sendCommand(player, "/μ’Œν‘œμ΄λ™ <이름>", "ν•΄λ‹Ή μ’Œν‘œλ‘œ 이동") + sendCommand(player, "/μ’Œν‘œμ œκ±° <이름>", "μ €μž₯된 μ’Œν‘œ μ‚­μ œ") + player.sendSystemMessage(Component.empty()) + + // 슀폰 + sendCategory(player, "슀폰", ChatFormatting.GREEN) + sendCommand(player, "/슀폰", "슀폰으둜 이동") + sendCommand(player, "/μŠ€ν°μ„€μ •", "ν˜„μž¬ μœ„μΉ˜λ₯Ό 슀폰으둜 μ„€μ •") + sendCommand(player, "/μŠ€ν°μ‚­μ œ", "μ»€μŠ€ν…€ 슀폰 μ‚­μ œ") + player.sendSystemMessage(Component.empty()) + + // ν…”λ ˆν¬νŠΈ + sendCategory(player, "ν…”λ ˆν¬νŠΈ", ChatFormatting.AQUA) + sendCommand(player, "/tpa", "ν”Œλ ˆμ΄μ–΄ 선택 (GUI)") + sendCommand(player, "/back", "이전 μœ„μΉ˜λ‘œ 이동") + player.sendSystemMessage(Component.empty()) + + // λ‹‰λ„€μž„ + sendCategory(player, "λ‹‰λ„€μž„", ChatFormatting.LIGHT_PURPLE) + sendCommand(player, "/λ‹‰λ„€μž„ λ³€κ²½ <λ‹‰λ„€μž„>", "λ‹‰λ„€μž„ μ„€μ •") + sendCommand(player, "/λ‹‰λ„€μž„ μ΄ˆκΈ°ν™”", "λ‹‰λ„€μž„ μ΄ˆκΈ°ν™”") + player.sendSystemMessage(Component.empty()) + + // 머리 + sendCategory(player, "머리", ChatFormatting.GOLD) + sendCommand(player, "/머리", "λ‚΄ 머리 μ•„μ΄ν…œ λ°›κΈ°") + sendCommand(player, "/머리 <λ‹‰λ„€μž„>", "ν•΄λ‹Ή ν”Œλ ˆμ΄μ–΄ 머리 λ°›κΈ°") + + val footer = + Component.literal("═══════════════════════════════").withStyle { + it.withColor(ChatFormatting.DARK_GRAY) + } + player.sendSystemMessage(footer) + } + + private fun sendCategory(player: ServerPlayer, name: String, color: ChatFormatting) { + val message = + Component.literal("β–Έ ") + .withStyle { it.withColor(color) } + .append( + Component.literal(name).withStyle { + it.withColor(color).withBold(true) + } + ) + 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) + } + ) + player.sendSystemMessage(message) + } +} diff --git a/Essentials/src/main/kotlin/com/beemer/essentials/command/ProtectFarmlandCommand.kt b/Essentials/src/main/kotlin/com/beemer/essentials/command/ProtectFarmlandCommand.kt index af864c2..7453a51 100644 --- a/Essentials/src/main/kotlin/com/beemer/essentials/command/ProtectFarmlandCommand.kt +++ b/Essentials/src/main/kotlin/com/beemer/essentials/command/ProtectFarmlandCommand.kt @@ -13,19 +13,31 @@ object ProtectFarmlandCommand { fun onRegisterCommands(event: RegisterCommandsEvent) { listOf("protectfarmland", "밭보호").forEach { command -> event.dispatcher.register( - Commands.literal(command).executes { context -> - val player = CommandUtils.getPlayerOrSendFailure(context.source) ?: return@executes 0 + Commands.literal(command).requires { it.hasPermission(2) }.executes { context -> + val player = + CommandUtils.getPlayerOrSendFailure(context.source) + ?: return@executes 0 - val enabled = ProtectFarmlandConfig.toggle() + val enabled = ProtectFarmlandConfig.toggle() - player.sendSystemMessage( - Component.literal("λ°­ 보호λ₯Ό ").withStyle { it.withColor(ChatFormatting.GOLD) } - .append(Component.literal(if (enabled) "ν™œμ„±ν™”" else "λΉ„ν™œμ„±ν™”").withStyle { it.withColor(ChatFormatting.DARK_GREEN) }) - .append(Component.literal("ν–ˆμŠ΅λ‹ˆλ‹€.").withStyle { it.withColor(ChatFormatting.GOLD) }) - ) - 1 - } + player.sendSystemMessage( + Component.literal("λ°­ 보호λ₯Ό ") + .withStyle { it.withColor(ChatFormatting.GOLD) } + .append( + Component.literal(if (enabled) "ν™œμ„±ν™”" else "λΉ„ν™œμ„±ν™”") + .withStyle { + it.withColor(ChatFormatting.DARK_GREEN) + } + ) + .append( + Component.literal("ν–ˆμŠ΅λ‹ˆλ‹€.").withStyle { + it.withColor(ChatFormatting.GOLD) + } + ) + ) + 1 + } ) } } -} \ No newline at end of file +}