13
0
geforkt von Mirrors/Velocity

Fix some localization and API issues

Resolves #536
Dieser Commit ist enthalten in:
Andrew Steinborn 2021-07-08 03:08:02 -04:00
Ursprung a037aebfa0
Commit 0e0a14498f
2 geänderte Dateien mit 23 neuen und 13 gelöschten Zeilen

Datei anzeigen

@ -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<String> 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());

Datei anzeigen

@ -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",
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));
friendlyReason);
}
sendMessage(requestedMessage);
break;
default:
// The only remaining value is successful (no need to do anything!)