mirror of
https://github.com/System-End/Discord-MC-Chat.git
synced 2026-04-19 19:45:14 +00:00
fix: address code review feedback - fix indexed placeholders in translations, improve null handling
Co-authored-by: Xujiayao <58985541+Xujiayao@users.noreply.github.com>
This commit is contained in:
parent
bde4900e98
commit
2a6394805b
4 changed files with 10 additions and 8 deletions
|
|
@ -2,14 +2,11 @@ package com.xujiayao.discord_mc_chat.commands.impl;
|
|||
|
||||
import com.xujiayao.discord_mc_chat.commands.Command;
|
||||
import com.xujiayao.discord_mc_chat.commands.CommandSender;
|
||||
import com.xujiayao.discord_mc_chat.commands.LocalCommandSender;
|
||||
import com.xujiayao.discord_mc_chat.network.NetworkManager;
|
||||
import com.xujiayao.discord_mc_chat.network.packets.linking.LinkCodeRequestPacket;
|
||||
import com.xujiayao.discord_mc_chat.server.linking.LinkedAccountManager;
|
||||
import com.xujiayao.discord_mc_chat.server.linking.VerificationCodeManager;
|
||||
import com.xujiayao.discord_mc_chat.utils.config.ModeManager;
|
||||
import com.xujiayao.discord_mc_chat.utils.events.CoreEvents;
|
||||
import com.xujiayao.discord_mc_chat.utils.events.EventManager;
|
||||
import com.xujiayao.discord_mc_chat.utils.i18n.I18nManager;
|
||||
|
||||
/**
|
||||
|
|
@ -111,6 +108,11 @@ public class LinkCommand implements Command {
|
|||
String uuid = player.getPlayerUuid();
|
||||
String name = player.getPlayerName();
|
||||
|
||||
if (uuid == null) {
|
||||
sender.reply(I18nManager.getDmccTranslation("commands.link.player_only"));
|
||||
return;
|
||||
}
|
||||
|
||||
switch (ModeManager.getMode()) {
|
||||
case "single_server" -> {
|
||||
// Direct access to server-side managers
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ commands:
|
|||
discord_only: "This command can only be used from Discord."
|
||||
not_available: "This command is not available in the current mode."
|
||||
already_linked: "Your Minecraft account is already linked to a Discord account."
|
||||
code_generated: "Your verification code is: {}. Use /link {} on Discord to complete linking. The code expires in 5 minutes."
|
||||
code_generated: "Your verification code is: {0}. Use /link {0} on Discord to complete linking. The code expires in 5 minutes."
|
||||
code_requested: "Verification code request sent. Check your Minecraft chat for the code."
|
||||
invalid_code: "Invalid or expired verification code."
|
||||
success: "Successfully linked to Minecraft player \"{}\"!"
|
||||
|
|
@ -265,7 +265,7 @@ linking:
|
|||
saved: "Linked accounts saved successfully."
|
||||
save_failed: "Failed to save linked accounts."
|
||||
linked: "Linked Discord user {} to Minecraft UUID {}."
|
||||
unlinked_discord: "Unlinked {} Minecraft account(s) from Discord user {}."
|
||||
unlinked_discord: "Unlinked {0} Minecraft account(s) from Discord user {1}."
|
||||
unlinked_minecraft: "Unlinked Minecraft UUID {} from Discord user {}."
|
||||
uuid_already_linked: "Minecraft UUID {} is already linked to Discord user {}."
|
||||
verification:
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ commands:
|
|||
discord_only: "此命令只能在 Discord 上使用。"
|
||||
not_available: "此命令在当前模式下不可用。"
|
||||
already_linked: "你的 Minecraft 账户已绑定到一个 Discord 账户。"
|
||||
code_generated: "你的验证码是:{}。在 Discord 上使用 /link {} 来完成绑定。验证码将在 5 分钟后过期。"
|
||||
code_generated: "你的验证码是:{0}。在 Discord 上使用 /link {0} 来完成绑定。验证码将在 5 分钟后过期。"
|
||||
code_requested: "验证码请求已发送。请查看你的 Minecraft 聊天获取验证码。"
|
||||
invalid_code: "无效或已过期的验证码。"
|
||||
success: "成功绑定 Minecraft 玩家 \"{}\"!"
|
||||
|
|
@ -265,7 +265,7 @@ linking:
|
|||
saved: "已绑定账户保存成功。"
|
||||
save_failed: "保存已绑定账户失败。"
|
||||
linked: "已将 Discord 用户 {} 绑定到 Minecraft UUID {}。"
|
||||
unlinked_discord: "已解除 Discord 用户 {} 的 {} 个 Minecraft 账户绑定。"
|
||||
unlinked_discord: "已解除 Discord 用户 {1} 的 {0} 个 Minecraft 账户绑定。"
|
||||
unlinked_minecraft: "已解除 Minecraft UUID {} 与 Discord 用户 {} 的绑定。"
|
||||
uuid_already_linked: "Minecraft UUID {} 已绑定到 Discord 用户 {}。"
|
||||
verification:
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ public class MinecraftCommands {
|
|||
if (source.getEntity() instanceof ServerPlayer player) {
|
||||
return player.getName().getString();
|
||||
}
|
||||
return source.getTextName();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue