Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions src/main/java/kr/pyke/notify/client/gui/HelpScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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());
Expand All @@ -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);

Expand Down Expand Up @@ -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();
Expand All @@ -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);
Expand All @@ -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;
Expand All @@ -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";
};
}

Expand Down Expand Up @@ -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));

Expand Down
46 changes: 27 additions & 19 deletions src/main/java/kr/pyke/notify/command/HelpRequestCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,19 @@ private HelpRequestCommand() { }
private static final Map<UUID, Long> lastUsed = new HashMap<>(); // 쿨타임 저장용

public static void register(CommandDispatcher<CommandSourceStack> 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")
Expand All @@ -48,17 +45,17 @@ public static void register(CommandDispatcher<CommandSourceStack> 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<CommandSourceStack> ctx) {
return requestHelp(ctx, StringArgumentType.getString(ctx, "메시지"));
return requestHelp(ctx, StringArgumentType.getString(ctx, "message"));
}

private static int requestHelp(CommandContext<CommandSourceStack> ctx, String message) {
Expand All @@ -75,7 +72,11 @@ private static int requestHelp(CommandContext<CommandSourceStack> ctx, String me
long remaining = (cooldownMs - (now - last)) / 1000L;

List<ServerPlayer> 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;
}
Expand All @@ -85,7 +86,11 @@ private static int requestHelp(CommandContext<CommandSourceStack> ctx, String me
lastUsed.put(player.getUUID(), now);

List<ServerPlayer> 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;
}
Expand All @@ -96,9 +101,12 @@ private static int setHelpCooldown(CommandContext<CommandSourceStack> ctx) {
cooldownMs = seconds * 1000L;

List<ServerPlayer> 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;
Expand Down
16 changes: 15 additions & 1 deletion src/main/resources/assets/notify/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -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"
}
16 changes: 15 additions & 1 deletion src/main/resources/assets/notify/lang/ko_kr.json
Original file line number Diff line number Diff line change
@@ -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": "메시지"
}