From d26d61f0389e922317a76e749f85ebb8edc8045f Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Sun, 18 Apr 2021 11:16:11 -0400 Subject: [PATCH] Fix pluralization of /glist player summary --- .../proxy/command/builtin/GlistCommand.java | 19 ++++++------------- .../proxy/l10n/messages.properties | 5 ++--- .../proxy/l10n/messages_en_UD.properties | 5 ++--- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/command/builtin/GlistCommand.java b/proxy/src/main/java/com/velocitypowered/proxy/command/builtin/GlistCommand.java index 6d0f8f947..976a3644a 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/command/builtin/GlistCommand.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/command/builtin/GlistCommand.java @@ -37,6 +37,7 @@ import java.util.Optional; import net.kyori.adventure.identity.Identity; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.TextComponent; +import net.kyori.adventure.text.TranslatableComponent; import net.kyori.adventure.text.format.NamedTextColor; public class GlistCommand { @@ -104,19 +105,11 @@ public class GlistCommand { private void sendTotalProxyCount(CommandSource target) { int online = server.countConnectedPlayers(); - target.sendMessage(Identity.nil(), Component.text() - .append(Component.text(Integer.toString(online), NamedTextColor.GREEN)) - .append(Component.space()) - .append(Component.translatable( - online == 1 - ? "velocity.command.glist-player-singular" - : "velocity.command.glist-player-plural", - NamedTextColor.YELLOW - )) - .append(Component.space()) - .append(Component.translatable("velocity.command.glist-total-suffix", - NamedTextColor.YELLOW)) - .build()); + TranslatableComponent msg = online == 1 + ? Component.translatable("velocity.command.glist-player-singular") + : Component.translatable("velocity.command.glist-player-plural"); + target.sendMessage(msg.color(NamedTextColor.YELLOW) + .args(Component.text(Integer.toString(online), NamedTextColor.GREEN))); } private void sendServerPlayers(CommandSource target, RegisteredServer server, boolean fromAll) { diff --git a/proxy/src/main/resources/com/velocitypowered/proxy/l10n/messages.properties b/proxy/src/main/resources/com/velocitypowered/proxy/l10n/messages.properties index 28314dd44..abde8db10 100644 --- a/proxy/src/main/resources/com/velocitypowered/proxy/l10n/messages.properties +++ b/proxy/src/main/resources/com/velocitypowered/proxy/l10n/messages.properties @@ -45,9 +45,8 @@ velocity.command.server-tooltip-players-online={0} players online velocity.command.server-tooltip-current-server=Currently connected to this server velocity.command.server-tooltip-offer-connect-server=Click to connect to this server -velocity.command.glist-player-singular=player -velocity.command.glist-player-plural=players -velocity.command.glist-total-suffix= are currently connected to the proxy. +velocity.command.glist-player-singular={0} player is currently connected to the proxy. +velocity.command.glist-player-plural={0} players are currently connected to the proxy. velocity.command.glist-view-all=To view all players on servers, use /glist all. velocity.command.reload-success=Velocity configuration successfully reloaded. diff --git a/proxy/src/main/resources/com/velocitypowered/proxy/l10n/messages_en_UD.properties b/proxy/src/main/resources/com/velocitypowered/proxy/l10n/messages_en_UD.properties index 1e174330d..5f3b9abcf 100644 --- a/proxy/src/main/resources/com/velocitypowered/proxy/l10n/messages_en_UD.properties +++ b/proxy/src/main/resources/com/velocitypowered/proxy/l10n/messages_en_UD.properties @@ -45,9 +45,8 @@ velocity.command.server-tooltip-players-online=ǝuᴉluo sɹǝʎɐld {0} velocity.command.server-tooltip-current-server=ɹǝʌɹǝs sᴉɥʇ oʇ pǝʇɔǝuuoɔ ʎlʇuǝɹɹnƆ velocity.command.server-tooltip-offer-connect-server=ɹǝʌɹǝs sᴉɥʇ oʇ ʇɔǝuuoɔ oʇ ʞɔᴉlƆ -velocity.command.glist-player-singular=ɹǝʎɐld -velocity.command.glist-player-plural=sɹǝʎɐld -velocity.command.glist-total-suffix=˙ʎxoɹd ǝɥʇ oʇ pǝʇɔǝuuoɔ ʎlʇuǝɹɹnɔ ǝɹɐ +velocity.command.glist-player-singular=˙ʎxoɹd ǝɥʇ oʇ pǝʇɔǝuuoɔ ʎlʇuǝɹɹnɔ sᴉ ɹǝʎɐld {0} +velocity.command.glist-player-plural=˙ʎxoɹd ǝɥʇ oʇ pǝʇɔǝuuoɔ ʎlʇuǝɹɹnɔ ǝɹɐ sɹǝʎɐld {0} velocity.command.glist-view-all=˙/glist all ǝsn 'sɹǝʌɹǝs uo sɹǝʎɐld llɐ ʍǝᴉʌ o┴ velocity.command.reload-success=˙pǝpɐolǝɹ ʎllnɟssǝɔɔns uoᴉʇɐɹnƃᴉɟuoɔ ʎʇᴉɔolǝΛ