diff --git a/src/main/java/kr/pyke/notify/client/gui/HelpScreen.java b/src/main/java/kr/pyke/notify/client/gui/HelpScreen.java index 2e23a98..1a1879e 100644 --- a/src/main/java/kr/pyke/notify/client/gui/HelpScreen.java +++ b/src/main/java/kr/pyke/notify/client/gui/HelpScreen.java @@ -84,12 +84,12 @@ protected void build(FlowLayout root) { top.gap(8); top.surface(Surface.flat(COL_PANEL)); top.padding(Insets.of(6)); - top.child(filterBtn("전체", null)); - top.child(filterBtn("접수", HELP_STATUS.PENDING)); - top.child(filterBtn("진행중", HELP_STATUS.PROCESSING)); - top.child(filterBtn("완료", HELP_STATUS.RESOLVED)); + top.child(filterBtn("notify.screen.help.button.all", null)); + top.child(filterBtn("notify.screen.help.button.pending", HELP_STATUS.PENDING)); + top.child(filterBtn("notify.screen.help.button.processing", HELP_STATUS.PROCESSING)); + top.child(filterBtn("notify.screen.help.button.resolved", HELP_STATUS.RESOLVED)); - btnPurge = Components.button(net.minecraft.network.chat.Component.literal("정리"), b -> NotifyPacket.requestPurgeResolved()); + btnPurge = Components.button(net.minecraft.network.chat.Component.translatable("notify.screen.help.button.purge"), b -> NotifyPacket.requestPurgeResolved()); btnPurge.sizing(Sizing.fixed(48), Sizing.fixed(22)); btnPurge.renderer(ButtonComponent.Renderer.flat(0xFF404040, 0xFF4C4C4C, 0xFF292929)); btnPurge.active(true); @@ -106,10 +106,10 @@ protected void build(FlowLayout root) { header.gap(6); header.surface(Surface.flat(COL_PANEL)); header.padding(Insets.of(4)); - header.child(colHeader("닉네임", COL_NICK_PCT)); - header.child(colHeader("상태", COL_STAT_PCT)); - header.child(colHeader("처리자", COL_HAND_PCT)); - header.child(colHeader("메시지", COL_MSG_PCT)); + header.child(colHeader("notify.screen.help.header.player", COL_NICK_PCT)); + header.child(colHeader("notify.screen.help.header.status", COL_STAT_PCT)); + header.child(colHeader("notify.screen.help.header.handler", COL_HAND_PCT)); + header.child(colHeader("notify.screen.help.header.message", COL_MSG_PCT)); // 리스트 컨테이너 listBox = Containers.verticalFlow(Sizing.fill(100), Sizing.content()); @@ -130,9 +130,9 @@ protected void build(FlowLayout root) { right.gap(8); right.surface(Surface.flat(COL_PANEL)); right.padding(Insets.of(6)); - btnPending = stateBtn("접수", () -> changeStatusSelected(HELP_STATUS.PENDING)); - btnProcessing = stateBtn("처리", () -> HelpProcessing(HelpClientState.findById(selectedID))); - btnResolved = stateBtn("완료", () -> changeStatusSelected(HELP_STATUS.RESOLVED)); + btnPending = stateBtn("notify.screen.help.button.pending", () -> changeStatusSelected(HELP_STATUS.PENDING)); + btnProcessing = stateBtn("notify.screen.help.button.processing", () -> HelpProcessing(HelpClientState.findById(selectedID))); + btnResolved = stateBtn("notify.screen.help.button.resolved", () -> changeStatusSelected(HELP_STATUS.RESOLVED)); right.child(btnPending).child(btnProcessing).child(btnResolved); FlowLayout rightWrap = wrapWithBorder(right, 1); @@ -162,7 +162,7 @@ public void removed() { } private ButtonComponent filterBtn(String name, HELP_STATUS status) { - ButtonComponent bc = Components.button(net.minecraft.network.chat.Component.literal(name), btn -> { + ButtonComponent bc = Components.button(net.minecraft.network.chat.Component.translatable(name), btn -> { currentFilter = status; selectedID = null; refresh(); @@ -173,7 +173,7 @@ private ButtonComponent filterBtn(String name, HELP_STATUS status) { } private LabelComponent colHeader(String text, int width) { - LabelComponent lbl = Components.label(net.minecraft.network.chat.Component.literal(text)); + LabelComponent lbl = Components.label(net.minecraft.network.chat.Component.translatable(text)); lbl.sizing(Sizing.fill(width), Sizing.content()); lbl.color(Color.ofArgb(COL_TEXT)); lbl.horizontalTextAlignment(HorizontalAlignment.LEFT); @@ -191,7 +191,7 @@ private LabelComponent colHeaderFill(String text) { } private LabelComponent colText(String text, int width) { - LabelComponent lbl = Components.label(net.minecraft.network.chat.Component.literal(text)); + LabelComponent lbl = Components.label(net.minecraft.network.chat.Component.translatable(text)); lbl.sizing(Sizing.fill(width), Sizing.content()); lbl.color(Color.ofArgb(COL_TEXT_DIM)); return lbl; @@ -213,17 +213,17 @@ private LabelComponent colTextFill(String text) { } private ButtonComponent stateBtn(String name, Runnable onClick) { - ButtonComponent bc = Components.button(net.minecraft.network.chat.Component.literal(name), btn -> onClick.run()); + ButtonComponent bc = Components.button(net.minecraft.network.chat.Component.translatable(name), btn -> onClick.run()); bc.sizing(Sizing.fill(100), Sizing.fixed(24)); bc.renderer(ButtonComponent.Renderer.flat(0xFF404040, 0xFF4C4C4C, 0xFF292929)); return bc; } - private String statusKo(HelpRequest request) { + private String statusTranslatable(HelpRequest request) { return switch (request.status) { - case PENDING -> "접수"; - case PROCESSING -> "진행중"; - case RESOLVED -> "완료"; + case PENDING -> "notify.screen.help.button.pending"; + case PROCESSING -> "notify.screen.help.button.processing"; + case RESOLVED -> "notify.screen.help.button.resolved"; }; } @@ -270,7 +270,7 @@ private void refresh() { String message = (null == request.message || request.message.isBlank()) ? "" : request.message; row.child(colText(senderName, COL_NICK_PCT)); - row.child(colText(statusKo(request), COL_STAT_PCT)); + row.child(colText(statusTranslatable(request), COL_STAT_PCT)); row.child(colText(handlerName, COL_HAND_PCT)); row.child(colText(message, COL_MSG_PCT)); diff --git a/src/main/java/kr/pyke/notify/command/HelpRequestCommand.java b/src/main/java/kr/pyke/notify/command/HelpRequestCommand.java index adaff1f..5b0b12d 100644 --- a/src/main/java/kr/pyke/notify/command/HelpRequestCommand.java +++ b/src/main/java/kr/pyke/notify/command/HelpRequestCommand.java @@ -23,22 +23,19 @@ private HelpRequestCommand() { } private static final Map lastUsed = new HashMap<>(); // 쿨타임 저장용 public static void register(CommandDispatcher dispatcher, CommandBuildContext context, Commands.CommandSelection selection) { - // 1. 관리자용 쿨타임 설정 노드 - var cooldownNode = Commands.literal("쿨타임") - .requires(source -> source.hasPermission(2)) - .then(Commands.argument("ms", LongArgumentType.longArg(0)) - .executes(HelpRequestCommand::setHelpCooldown) - ); - - // 2. 통합 명령어 등록 + // 통합 명령어 등록 dispatcher.register(Commands.literal("도움") - .then(cooldownNode) + .then(Commands.literal("쿨타임") + .requires(source -> source.hasPermission(2)) + .then(Commands.argument("ms", LongArgumentType.longArg(0)) + .executes(HelpRequestCommand::setHelpCooldown) + )) - .then(Commands.argument("메시지", StringArgumentType.greedyString()) + .then(Commands.argument("message", StringArgumentType.greedyString()) .executes(HelpRequestCommand::requestHelp) ) - .executes(ctx -> requestHelp(ctx, "도움이 필요합니다!")) + .executes(ctx -> requestHelp(ctx, "notify.command.help.message.default_toast")) ); dispatcher.register(Commands.literal("staff-call") @@ -48,17 +45,17 @@ public static void register(CommandDispatcher dispatcher, Co .executes(HelpRequestCommand::setHelpCooldown) )) - .then(Commands.argument("메시지", StringArgumentType.greedyString()) + .then(Commands.argument("message", StringArgumentType.greedyString()) .executes(HelpRequestCommand::requestHelp) ) - .executes(ctx -> requestHelp(ctx, "도움이 필요합니다!")) + .executes(ctx -> requestHelp(ctx, "notify.command.help.message.default_toast")) ); } // 호출 요청 처리 private static int requestHelp(CommandContext ctx) { - return requestHelp(ctx, StringArgumentType.getString(ctx, "메시지")); + return requestHelp(ctx, StringArgumentType.getString(ctx, "message")); } private static int requestHelp(CommandContext ctx, String message) { @@ -75,7 +72,11 @@ private static int requestHelp(CommandContext ctx, String me long remaining = (cooldownMs - (now - last)) / 1000L; List players = source.getServer().getPlayerList().getPlayers(); - NotifyHelper.sendSystemMessage(players, CHAT_BG_COLOR.RED, Component.literal("아직 다시 호출할 수 없습니다. (남은 시간: " + remaining + "초)")); + NotifyHelper.sendSystemMessage( + players, + CHAT_BG_COLOR.RED, + Component.translatable("notify.command.help.message.cooldown_active", remaining) + ); return 0; } @@ -85,7 +86,11 @@ private static int requestHelp(CommandContext ctx, String me lastUsed.put(player.getUUID(), now); List players = source.getServer().getPlayerList().getPlayers(); - NotifyHelper.sendSystemMessage(players, CHAT_BG_COLOR.LIME, Component.literal("운영진에게 도움을 요청했습니다.")); + NotifyHelper.sendSystemMessage( + players, + CHAT_BG_COLOR.LIME, + Component.translatable("notify.command.help.message.request_sent") + ); return 1; } @@ -96,9 +101,12 @@ private static int setHelpCooldown(CommandContext ctx) { cooldownMs = seconds * 1000L; List players = ctx.getSource().getServer().getPlayerList().getPlayers(); - NotifyHelper.sendSystemMessage(players, CHAT_BG_COLOR.LIME, Component.literal("도움 명령어 대기시간이 ").withStyle(ChatFormatting.WHITE) - .append(Component.literal(String.valueOf(seconds)).withStyle(ChatFormatting.YELLOW)) - .append("초로 변경되었습니다.") + NotifyHelper.sendSystemMessage( + players, + CHAT_BG_COLOR.LIME, + Component.translatable("notify.command.help.message.config_changed", + Component.literal(String.valueOf(seconds)).withStyle(ChatFormatting.YELLOW) + ) ); return 1; diff --git a/src/main/resources/assets/notify/lang/en_us.json b/src/main/resources/assets/notify/lang/en_us.json index f6139b9..ce068ef 100644 --- a/src/main/resources/assets/notify/lang/en_us.json +++ b/src/main/resources/assets/notify/lang/en_us.json @@ -1,4 +1,18 @@ { "key.notify.openrequest": "Open Request UI", - "category.notify.general": "Notify" + "category.notify.general": "Notify", + "notify.command.help.message.default_toast": "I need help!", + "notify.command.help.message.cooldown": "Cooldown", + "notify.command.help.message.cooldown_active": "You cannot request help yet. (Remaining: %ss)", + "notify.command.help.message.request_sent": "Help request sent to staff.", + "notify.command.help.message.config_changed": "Help command cooldown changed to %s seconds.", + "notify.screen.help.button.all": "All", + "notify.screen.help.button.pending": "Pending", + "notify.screen.help.button.processing": "Processing", + "notify.screen.help.button.resolved": "Resolved", + "notify.screen.help.button.purge": "Clear", + "notify.screen.help.header.player": "Player", + "notify.screen.help.header.status": "Status", + "notify.screen.help.header.handler": "Handler", + "notify.screen.help.header.message": "Message" } \ No newline at end of file diff --git a/src/main/resources/assets/notify/lang/ko_kr.json b/src/main/resources/assets/notify/lang/ko_kr.json index f6139b9..2990ce4 100644 --- a/src/main/resources/assets/notify/lang/ko_kr.json +++ b/src/main/resources/assets/notify/lang/ko_kr.json @@ -1,4 +1,18 @@ { "key.notify.openrequest": "Open Request UI", - "category.notify.general": "Notify" + "category.notify.general": "Notify", + "notify.command.help.message.default_toast": "도움이 필요합니다!", + "notify.command.help.message.cooldown": "쿨타임", + "notify.command.help.message.cooldown_active": "아직 다시 호출할 수 없습니다. (남은 시간: %s초)", + "notify.command.help.message.request_sent": "운영진에게 도움을 요청했습니다.", + "notify.command.help.message.config_changed": "도움 명령어 대기시간이 %s초로 변경되었습니다.", + "notify.screen.help.button.all": "전체", + "notify.screen.help.button.pending": "접수", + "notify.screen.help.button.processing": "진행중", + "notify.screen.help.button.resolved": "완료", + "notify.screen.help.button.purge": "정리", + "notify.screen.help.header.player": "닉네임", + "notify.screen.help.header.status": "상태", + "notify.screen.help.header.handler": "처리자", + "notify.screen.help.header.message": "메시지" } \ No newline at end of file