From 727769a17058bddb756f039e2fd583c4c0eb349e Mon Sep 17 00:00:00 2001 From: Caadiq Date: Wed, 17 Dec 2025 19:16:58 +0900 Subject: [PATCH] =?UTF-8?q?=EC=B1=84=ED=8C=85=20=EB=B9=84=EC=9A=B0?= =?UTF-8?q?=EA=B8=B0=20=EB=A9=94=EC=8B=9C=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../beemer/essentials/command/ChatCommand.kt | 73 ++++++++++--------- 1 file changed, 39 insertions(+), 34 deletions(-) diff --git a/Essentials/src/main/kotlin/com/beemer/essentials/command/ChatCommand.kt b/Essentials/src/main/kotlin/com/beemer/essentials/command/ChatCommand.kt index 1832260..cf7dcd9 100644 --- a/Essentials/src/main/kotlin/com/beemer/essentials/command/ChatCommand.kt +++ b/Essentials/src/main/kotlin/com/beemer/essentials/command/ChatCommand.kt @@ -32,8 +32,9 @@ object ChatCommand { private fun hasPermissionOrSend(player: ServerPlayer?, requiredLevel: Int = 2): Boolean { if (player != null && !player.hasPermissions(requiredLevel)) { player.sendSystemMessage( - Component.literal("해당 명령어를 실행할 권한이 없습니다.") - .withStyle { it.withColor(ChatFormatting.RED) } + Component.literal("해당 명령어를 실행할 권한이 없습니다.").withStyle { + it.withColor(ChatFormatting.RED) + } ) return false } @@ -42,49 +43,53 @@ object ChatCommand { private fun registerReloadCommand(root: String, sub: String, event: RegisterCommandsEvent) { event.dispatcher.register( - Commands.literal(root).then( - Commands.literal(sub).executes { context -> - val player = getPlayerOrNull(context.source) - if (!hasPermissionOrSend(player)) return@executes 0 + Commands.literal(root) + .then( + Commands.literal(sub).executes { context -> + val player = getPlayerOrNull(context.source) + if (!hasPermissionOrSend(player)) return@executes 0 - ChatConfig.loadConfig() + ChatConfig.loadConfig() - val success = Component.literal("채팅 형식을 새로고침했습니다.") - .withStyle { it.withColor(ChatFormatting.GOLD) } + val success = + Component.literal("채팅 형식을 새로고침했습니다.").withStyle { + it.withColor(ChatFormatting.GOLD) + } - if (player == null) - context.source.sendSuccess({ success }, false) - else - player.sendSystemMessage(success) + if (player == null) + context.source.sendSuccess({ success }, false) + else player.sendSystemMessage(success) - 1 - } - ) + 1 + } + ) ) } private fun registerClearCommand(root: String, sub: String, event: RegisterCommandsEvent) { event.dispatcher.register( - Commands.literal(root).then( - Commands.literal(sub).executes { context -> - val player = getPlayerOrNull(context.source) - if (!hasPermissionOrSend(player)) return@executes 0 + Commands.literal(root) + .then( + Commands.literal(sub).executes { context -> + val player = getPlayerOrNull(context.source) + if (!hasPermissionOrSend(player)) return@executes 0 - val server = context.source.server - val allPlayers = server.playerList.players.filterIsInstance() - ChatUtils.clearChatForAll(allPlayers) + val server = context.source.server + val allPlayers = + server.playerList.players.filterIsInstance< + ServerPlayer>() + ChatUtils.clearChatForAll(allPlayers) - server.playerList.broadcastSystemMessage( - Component.literal("📢") - .append(Component.literal("\u00A0\u00A0채팅창을 비웠습니다.") - .withStyle { it.withColor(ChatFormatting.AQUA) } - ), - false - ) + server.playerList.broadcastSystemMessage( + Component.literal("\u00A0\u00A0채팅창을 비웠습니다.").withStyle { + it.withColor(ChatFormatting.AQUA) + }, + false + ) - 1 - } - ) + 1 + } + ) ) } -} \ No newline at end of file +}