diff --git a/proxy/src/main/java/com/velocitypowered/proxy/command/builtin/VelocityCommand.java b/proxy/src/main/java/com/velocitypowered/proxy/command/builtin/VelocityCommand.java index d7cc2d747..d808a0783 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/command/builtin/VelocityCommand.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/command/builtin/VelocityCommand.java @@ -281,18 +281,20 @@ public class VelocityCommand implements SimpleCommand { return; } - TranslatableComponent.Builder output = Component.translatable() - .key("velocity.command.plugins-list") - .color(NamedTextColor.YELLOW); + TextComponent.Builder listBuilder = Component.text(); for (int i = 0; i < pluginCount; i++) { PluginContainer plugin = plugins.get(i); - output.append(componentForPlugin(plugin.getDescription())); + listBuilder.append(componentForPlugin(plugin.getDescription())); if (i + 1 < pluginCount) { - output.append(Component.text(", ")); + listBuilder.append(Component.text(", ")); } } - source.sendMessage(Identity.nil(), output.build()); + TranslatableComponent.Builder output = Component.translatable() + .key("velocity.command.plugins-list") + .color(NamedTextColor.YELLOW) + .args(listBuilder.build()); + source.sendMessage(Identity.nil(), output); } private TextComponent componentForPlugin(PluginDescription description) { @@ -361,8 +363,8 @@ public class VelocityCommand implements SimpleCommand { JsonArray connectOrder = new JsonArray(); List attemptedConnectionOrder = ImmutableList.copyOf( server.getConfiguration().getAttemptConnectionOrder()); - for (int i = 0; i < attemptedConnectionOrder.size(); i++) { - connectOrder.add(attemptedConnectionOrder.get(i)); + for (String s : attemptedConnectionOrder) { + connectOrder.add(s); } JsonObject proxyConfig = InformationUtils.collectProxyConfig(server.getConfiguration()); diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java index 6a097a493..10d05c8b8 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java @@ -614,7 +614,11 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { case CONNECTION_IN_PROGRESS: // Fatal case case CONNECTION_CANCELLED: - disconnect(status.getReasonComponent().orElse(res.getMessageComponent())); + Component fallbackMsg = res.getMessageComponent(); + if (fallbackMsg == null) { + fallbackMsg = friendlyReason; + } + disconnect(status.getReasonComponent().orElse(fallbackMsg)); break; case SERVER_DISCONNECTED: Component reason = status.getReasonComponent() @@ -623,10 +627,14 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { getProtocolVersion()), ((Impl) status).isSafe()); break; case SUCCESS: - sendMessage(Component.translatable("velocity.error.moved-to-new-server", - NamedTextColor.RED, - Component.text(originalEvent.getServer().getServerInfo().getName()), - friendlyReason)); + Component requestedMessage = res.getMessageComponent(); + if (requestedMessage == null) { + requestedMessage = Component.translatable("velocity.error.moved-to-new-server", + NamedTextColor.RED, + Component.text(originalEvent.getServer().getServerInfo().getName()), + friendlyReason); + } + sendMessage(requestedMessage); break; default: // The only remaining value is successful (no need to do anything!)