From 90b72279dc875cbbab497115e27e9935483f1e56 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Mon, 12 Jul 2021 08:48:25 -0400 Subject: [PATCH] Forward-port changes from 0e0a1449 --- .../proxy/command/builtin/VelocityCommand.java | 10 +++++----- .../proxy/connection/client/ConnectedPlayer.java | 12 ++++++++---- 2 files changed, 13 insertions(+), 9 deletions(-) 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 61931379f..a7ed7d53a 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 @@ -279,10 +279,6 @@ 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); @@ -292,7 +288,11 @@ public class VelocityCommand implements SimpleCommand { } } - source.sendMessage(Identity.nil(), output.args(listBuilder.build()).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) { 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 048d55c1f..3bfe35743 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 @@ -580,10 +580,14 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { protocolVersion()), ((Impl) status).isSafe()); break; case SUCCESS: - sendMessage(Component.translatable("velocity.error.moved-to-new-server", - NamedTextColor.RED, - Component.text(originalEvent.server().serverInfo().name()), - friendlyReason)); + Component requestedMessage = res.message(); + if (requestedMessage == null) { + requestedMessage = Component.translatable("velocity.error.moved-to-new-server", + NamedTextColor.RED, + Component.text(originalEvent.server().serverInfo().name()), + friendlyReason); + } + sendMessage(requestedMessage); break; default: // The only remaining value is successful (no need to do anything!)