mirror of
https://github.com/PaperMC/Velocity.git
synced 2026-02-17 14:37:43 +01:00
Even more renames, start hiding some API internals
This commit is contained in:
@@ -24,8 +24,7 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* The main class. Responsible for parsing command line arguments and then launching the
|
||||
* proxy.
|
||||
* The main class. Responsible for parsing command line arguments and then launching the proxy.
|
||||
*/
|
||||
public class Velocity {
|
||||
|
||||
|
||||
@@ -28,8 +28,8 @@ import com.velocitypowered.api.event.proxy.ProxyShutdownEvent;
|
||||
import com.velocitypowered.api.network.ProtocolVersion;
|
||||
import com.velocitypowered.api.plugin.PluginContainer;
|
||||
import com.velocitypowered.api.plugin.PluginManager;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import com.velocitypowered.api.proxy.player.Player;
|
||||
import com.velocitypowered.api.proxy.player.ResourcePackInfo;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import com.velocitypowered.api.proxy.server.ServerInfo;
|
||||
|
||||
@@ -33,7 +33,7 @@ import com.spotify.futures.CompletableFutures;
|
||||
import com.velocitypowered.api.command.Command;
|
||||
import com.velocitypowered.api.command.CommandMeta;
|
||||
import com.velocitypowered.api.command.CommandSource;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.player.Player;
|
||||
import com.velocitypowered.proxy.command.brigadier.VelocityArgumentCommandNode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -157,8 +157,8 @@ final class SuggestionsProvider<S> {
|
||||
}
|
||||
|
||||
final Collection<CommandNode<S>> aliases = contextSoFar.getRootNode().getChildren();
|
||||
@SuppressWarnings("unchecked")
|
||||
final CompletableFuture<Suggestions>[] futures = new CompletableFuture[aliases.size()];
|
||||
@SuppressWarnings("unchecked") final CompletableFuture<Suggestions>[] futures =
|
||||
new CompletableFuture[aliases.size()];
|
||||
int i = 0;
|
||||
for (final CommandNode<S> node : aliases) {
|
||||
CompletableFuture<Suggestions> future = Suggestions.empty();
|
||||
|
||||
@@ -122,15 +122,15 @@ public class VelocityCommandManager implements CommandManager {
|
||||
final List<CommandRegistrar<?>> commandRegistrars = this.implementedRegistrars(command);
|
||||
if (commandRegistrars.isEmpty()) {
|
||||
throw new IllegalArgumentException(
|
||||
command + " does not implement a registrable Command subinterface");
|
||||
command + " does not implement a registrable Command subinterface");
|
||||
} else if (commandRegistrars.size() > 1) {
|
||||
final String implementedInterfaces = commandRegistrars.stream()
|
||||
.map(CommandRegistrar::registrableSuperInterface)
|
||||
.map(Class::getSimpleName)
|
||||
.collect(Collectors.joining(", "));
|
||||
.map(CommandRegistrar::registrableSuperInterface)
|
||||
.map(Class::getSimpleName)
|
||||
.collect(Collectors.joining(", "));
|
||||
throw new IllegalArgumentException(
|
||||
command + " implements multiple registrable Command subinterfaces: "
|
||||
+ implementedInterfaces);
|
||||
command + " implements multiple registrable Command subinterfaces: "
|
||||
+ implementedInterfaces);
|
||||
} else {
|
||||
this.internalRegister(commandRegistrars.get(0), command, meta);
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ import com.mojang.brigadier.tree.ArgumentCommandNode;
|
||||
import com.mojang.brigadier.tree.LiteralCommandNode;
|
||||
import com.velocitypowered.api.command.BrigadierCommand;
|
||||
import com.velocitypowered.api.command.CommandSource;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import com.velocitypowered.api.proxy.player.Player;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -25,9 +25,9 @@ import com.mojang.brigadier.tree.ArgumentCommandNode;
|
||||
import com.mojang.brigadier.tree.LiteralCommandNode;
|
||||
import com.velocitypowered.api.command.BrigadierCommand;
|
||||
import com.velocitypowered.api.command.CommandSource;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.network.connection.ServerConnection;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import com.velocitypowered.api.proxy.ServerConnection;
|
||||
import com.velocitypowered.api.proxy.player.Player;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
@@ -39,6 +39,7 @@ import net.kyori.adventure.util.TriState;
|
||||
* Implements the Velocity default {@code /send} command.
|
||||
*/
|
||||
public class SendCommand {
|
||||
|
||||
private final ProxyServer server;
|
||||
private static final String SERVER_ARG = "server";
|
||||
private static final String PLAYER_ARG = "player";
|
||||
@@ -52,44 +53,44 @@ public class SendCommand {
|
||||
*/
|
||||
public void register() {
|
||||
LiteralCommandNode<CommandSource> totalNode = LiteralArgumentBuilder
|
||||
.<CommandSource>literal("send")
|
||||
.requires(source ->
|
||||
source.getPermissionValue("velocity.command.send") == TriState.TRUE)
|
||||
.executes(this::usage)
|
||||
.build();
|
||||
.<CommandSource>literal("send")
|
||||
.requires(source ->
|
||||
source.getPermissionValue("velocity.command.send") == TriState.TRUE)
|
||||
.executes(this::usage)
|
||||
.build();
|
||||
ArgumentCommandNode<CommandSource, String> playerNode = RequiredArgumentBuilder
|
||||
.<CommandSource, String>argument("player", StringArgumentType.word())
|
||||
.suggests((context, builder) -> {
|
||||
String argument = context.getArguments().containsKey(PLAYER_ARG)
|
||||
? context.getArgument(PLAYER_ARG, String.class)
|
||||
: "";
|
||||
for (Player player : server.getAllPlayers()) {
|
||||
String playerName = player.username();
|
||||
if (playerName.regionMatches(true, 0, argument, 0, argument.length())) {
|
||||
builder.suggest(playerName);
|
||||
}
|
||||
}
|
||||
if ("all".regionMatches(true, 0, argument, 0, argument.length())) {
|
||||
builder.suggest("all");
|
||||
}
|
||||
if ("current".regionMatches(true, 0, argument, 0, argument.length())
|
||||
&& context.getSource() instanceof Player) {
|
||||
builder.suggest("current");
|
||||
}
|
||||
return builder.buildFuture();
|
||||
})
|
||||
.executes(this::usage)
|
||||
.build();
|
||||
.<CommandSource, String>argument("player", StringArgumentType.word())
|
||||
.suggests((context, builder) -> {
|
||||
String argument = context.getArguments().containsKey(PLAYER_ARG)
|
||||
? context.getArgument(PLAYER_ARG, String.class)
|
||||
: "";
|
||||
for (Player player : server.onlinePlayers()) {
|
||||
String playerName = player.username();
|
||||
if (playerName.regionMatches(true, 0, argument, 0, argument.length())) {
|
||||
builder.suggest(playerName);
|
||||
}
|
||||
}
|
||||
if ("all".regionMatches(true, 0, argument, 0, argument.length())) {
|
||||
builder.suggest("all");
|
||||
}
|
||||
if ("current".regionMatches(true, 0, argument, 0, argument.length())
|
||||
&& context.getSource() instanceof Player) {
|
||||
builder.suggest("current");
|
||||
}
|
||||
return builder.buildFuture();
|
||||
})
|
||||
.executes(this::usage)
|
||||
.build();
|
||||
ArgumentCommandNode<CommandSource, String> serverNode = RequiredArgumentBuilder
|
||||
.<CommandSource, String>argument("server", StringArgumentType.word())
|
||||
.suggests((context, builder) -> {
|
||||
for (RegisteredServer server : server.registeredServers()) {
|
||||
builder.suggest(server.serverInfo().name());
|
||||
}
|
||||
return builder.buildFuture();
|
||||
})
|
||||
.executes(this::send)
|
||||
.build();
|
||||
.<CommandSource, String>argument("server", StringArgumentType.word())
|
||||
.suggests((context, builder) -> {
|
||||
for (RegisteredServer server : server.registeredServers()) {
|
||||
builder.suggest(server.serverInfo().name());
|
||||
}
|
||||
return builder.buildFuture();
|
||||
})
|
||||
.executes(this::send)
|
||||
.build();
|
||||
totalNode.addChild(playerNode);
|
||||
playerNode.addChild(serverNode);
|
||||
server.commandManager().register(new BrigadierCommand(totalNode));
|
||||
@@ -97,7 +98,7 @@ public class SendCommand {
|
||||
|
||||
private int usage(CommandContext<CommandSource> context) {
|
||||
context.getSource().sendMessage(
|
||||
Component.translatable("velocity.command.send-usage", NamedTextColor.YELLOW)
|
||||
Component.translatable("velocity.command.send-usage", NamedTextColor.YELLOW)
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
@@ -110,7 +111,7 @@ public class SendCommand {
|
||||
|
||||
if (maybeServer.isEmpty()) {
|
||||
context.getSource().sendMessage(
|
||||
CommandMessages.SERVER_DOES_NOT_EXIST.args(Component.text(serverName))
|
||||
CommandMessages.SERVER_DOES_NOT_EXIST.args(Component.text(serverName))
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
@@ -119,7 +120,7 @@ public class SendCommand {
|
||||
&& !Objects.equals(player, "all")
|
||||
&& !Objects.equals(player, "current")) {
|
||||
context.getSource().sendMessage(
|
||||
CommandMessages.PLAYER_NOT_FOUND.args(Component.text(player))
|
||||
CommandMessages.PLAYER_NOT_FOUND.args(Component.text(player))
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -22,9 +22,9 @@ import static net.kyori.adventure.text.event.HoverEvent.showText;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.velocitypowered.api.command.CommandSource;
|
||||
import com.velocitypowered.api.command.SimpleCommand;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.network.connection.ServerConnection;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import com.velocitypowered.api.proxy.ServerConnection;
|
||||
import com.velocitypowered.api.proxy.player.Player;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import com.velocitypowered.api.proxy.server.ServerInfo;
|
||||
import java.util.List;
|
||||
|
||||
@@ -413,6 +413,7 @@ public class VelocityCommand implements SimpleCommand {
|
||||
* Heap SubCommand.
|
||||
*/
|
||||
public static class Heap implements SubCommand {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(Heap.class);
|
||||
private MethodHandle heapGenerator;
|
||||
private Consumer<CommandSource> heapConsumer;
|
||||
|
||||
@@ -381,8 +381,8 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter {
|
||||
public void addPlayPacketQueueHandler() {
|
||||
if (this.channel.pipeline().get(Connections.PLAY_PACKET_QUEUE) == null) {
|
||||
this.channel.pipeline().addAfter(Connections.MINECRAFT_ENCODER, Connections.PLAY_PACKET_QUEUE,
|
||||
new PlayPacketQueueHandler(this.protocolVersion,
|
||||
channel.pipeline().get(MinecraftEncoder.class).getDirection()));
|
||||
new PlayPacketQueueHandler(this.protocolVersion,
|
||||
channel.pipeline().get(MinecraftEncoder.class).getDirection()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -429,7 +429,7 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter {
|
||||
* @param sessionHandler the handler to use
|
||||
*/
|
||||
public void setActiveSessionHandler(StateRegistry registry,
|
||||
MinecraftSessionHandler sessionHandler) {
|
||||
MinecraftSessionHandler sessionHandler) {
|
||||
Preconditions.checkNotNull(registry);
|
||||
ensureInEventLoop();
|
||||
|
||||
@@ -487,8 +487,8 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the compression threshold on the connection. You are responsible for sending {@link
|
||||
* SetCompression} beforehand.
|
||||
* Sets the compression threshold on the connection. You are responsible for sending
|
||||
* {@link SetCompression} beforehand.
|
||||
*
|
||||
* @param threshold the compression threshold to use
|
||||
*/
|
||||
|
||||
@@ -32,8 +32,8 @@ public interface BackendConnectionPhase {
|
||||
/**
|
||||
* Handle a plugin message in the context of this phase.
|
||||
*
|
||||
* @param server the server connection
|
||||
* @param player the player
|
||||
* @param server the server connection
|
||||
* @param player the player
|
||||
* @param message The message to handle
|
||||
* @return true if handled, false otherwise.
|
||||
*/
|
||||
|
||||
@@ -18,10 +18,9 @@
|
||||
package com.velocitypowered.proxy.connection.backend;
|
||||
|
||||
import com.velocitypowered.api.network.ProtocolVersion;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.ServerConnection;
|
||||
import com.velocitypowered.api.proxy.messages.LegacyChannelIdentifier;
|
||||
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
|
||||
import com.velocitypowered.api.network.connection.ServerConnection;
|
||||
import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
|
||||
import com.velocitypowered.api.proxy.player.Player;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import com.velocitypowered.api.proxy.server.ServerInfo;
|
||||
import com.velocitypowered.api.util.UuidUtils;
|
||||
@@ -41,27 +40,28 @@ import java.net.SocketAddress;
|
||||
import java.util.Optional;
|
||||
import java.util.StringJoiner;
|
||||
import net.kyori.adventure.identity.Identity;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.ComponentSerializer;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
|
||||
/**
|
||||
* Handles messages coming from servers trying to communicate with the BungeeCord plugin
|
||||
* messaging channel interface.
|
||||
* Handles messages coming from servers trying to communicate with the BungeeCord plugin messaging
|
||||
* channel interface.
|
||||
*/
|
||||
@SuppressFBWarnings(
|
||||
value = "OS_OPEN_STREAM",
|
||||
justification = "Most methods in this class open "
|
||||
+ "instances of ByteBufDataOutput backed by heap-allocated ByteBufs. Closing them does "
|
||||
+ "nothing."
|
||||
+ "instances of ByteBufDataOutput backed by heap-allocated ByteBufs. Closing them does "
|
||||
+ "nothing."
|
||||
)
|
||||
public class BungeeCordMessageResponder {
|
||||
|
||||
private static final MinecraftChannelIdentifier MODERN_CHANNEL = MinecraftChannelIdentifier
|
||||
.create("bungeecord", "main");
|
||||
private static final LegacyChannelIdentifier LEGACY_CHANNEL =
|
||||
new LegacyChannelIdentifier("BungeeCord");
|
||||
private static final ChannelIdentifier MODERN_CHANNEL = ChannelIdentifier.ofKey(
|
||||
Key.key("bungeecord", "main"));
|
||||
private static final ChannelIdentifier LEGACY_CHANNEL =
|
||||
ChannelIdentifier.legacy("BungeeCord");
|
||||
|
||||
private final VelocityServer proxy;
|
||||
private final ConnectedPlayer player;
|
||||
|
||||
@@ -72,7 +72,7 @@ public class ConfigSessionHandler implements MinecraftSessionHandler {
|
||||
* @param resultFuture the result future
|
||||
*/
|
||||
ConfigSessionHandler(VelocityServer server, VelocityServerConnection serverConn,
|
||||
CompletableFuture<Impl> resultFuture) {
|
||||
CompletableFuture<Impl> resultFuture) {
|
||||
this.server = server;
|
||||
this.serverConn = serverConn;
|
||||
this.resultFuture = resultFuture;
|
||||
|
||||
@@ -20,7 +20,7 @@ package com.velocitypowered.proxy.connection.backend;
|
||||
import com.velocitypowered.api.event.player.ServerLoginPluginMessageEvent;
|
||||
import com.velocitypowered.api.network.ProtocolVersion;
|
||||
import com.velocitypowered.api.proxy.crypto.IdentifiedKey;
|
||||
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
|
||||
import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
|
||||
import com.velocitypowered.proxy.VelocityServer;
|
||||
import com.velocitypowered.proxy.config.PlayerInfoForwarding;
|
||||
import com.velocitypowered.proxy.config.VelocityConfiguration;
|
||||
@@ -50,6 +50,7 @@ import java.util.concurrent.CompletableFuture;
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -108,8 +109,7 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
|
||||
}
|
||||
|
||||
final byte[] contents = ByteBufUtil.getBytes(packet.content());
|
||||
final MinecraftChannelIdentifier identifier = MinecraftChannelIdentifier
|
||||
.from(packet.getChannel());
|
||||
final ChannelIdentifier identifier = ChannelIdentifier.ofKey(Key.key(packet.getChannel()));
|
||||
this.server.eventManager().fire(new ServerLoginPluginMessageEvent(serverConn, identifier,
|
||||
contents, packet.getId()))
|
||||
.thenAcceptAsync(event -> {
|
||||
|
||||
@@ -24,7 +24,7 @@ import static com.velocitypowered.proxy.network.Connections.HANDLER;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.velocitypowered.api.network.ProtocolVersion;
|
||||
import com.velocitypowered.api.proxy.ServerConnection;
|
||||
import com.velocitypowered.api.network.connection.ServerConnection;
|
||||
import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import com.velocitypowered.api.proxy.server.ServerInfo;
|
||||
@@ -95,8 +95,8 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation,
|
||||
/**
|
||||
* Connects to the server.
|
||||
*
|
||||
* @return a {@link com.velocitypowered.api.proxy.ConnectionRequestBuilder.Result}
|
||||
* representing whether the connection succeeded
|
||||
* @return a {@link com.velocitypowered.api.proxy.ConnectionRequestBuilder.Result} representing
|
||||
* whether the connection succeeded
|
||||
*/
|
||||
public CompletableFuture<Impl> connect() {
|
||||
CompletableFuture<Impl> result = new CompletableFuture<>();
|
||||
@@ -357,8 +357,7 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation,
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether the {@link JoinGame} packet has been
|
||||
* sent by this server.
|
||||
* Gets whether the {@link JoinGame} packet has been sent by this server.
|
||||
*
|
||||
* @return Whether the join has been completed.
|
||||
*/
|
||||
|
||||
@@ -28,8 +28,6 @@ import com.velocitypowered.api.event.player.PlayerClientBrandEvent;
|
||||
import com.velocitypowered.api.event.player.TabCompleteEvent;
|
||||
import com.velocitypowered.api.network.ProtocolVersion;
|
||||
import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
|
||||
import com.velocitypowered.api.proxy.messages.LegacyChannelIdentifier;
|
||||
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
|
||||
import com.velocitypowered.proxy.VelocityServer;
|
||||
import com.velocitypowered.proxy.connection.ConnectionTypes;
|
||||
import com.velocitypowered.proxy.connection.MinecraftConnection;
|
||||
@@ -80,6 +78,7 @@ import java.util.Queue;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -288,9 +287,9 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
|
||||
// Handling edge case when packet with FML client handshake (state COMPLETE)
|
||||
// arrives after JoinGame packet from destination server
|
||||
VelocityServerConnection serverConn =
|
||||
(player.getConnectedServer() == null
|
||||
&& packet.getChannel().equals(
|
||||
LegacyForgeConstants.FORGE_LEGACY_HANDSHAKE_CHANNEL))
|
||||
(player.getConnectedServer() == null
|
||||
&& packet.getChannel().equals(
|
||||
LegacyForgeConstants.FORGE_LEGACY_HANDSHAKE_CHANNEL))
|
||||
? player.getConnectionInFlight() : player.getConnectedServer();
|
||||
|
||||
MinecraftConnection backendConn = serverConn != null ? serverConn.getConnection() : null;
|
||||
@@ -303,9 +302,9 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
|
||||
List<ChannelIdentifier> channelIdentifiers = new ArrayList<>();
|
||||
for (String channel : channels) {
|
||||
try {
|
||||
channelIdentifiers.add(MinecraftChannelIdentifier.from(channel));
|
||||
channelIdentifiers.add(ChannelIdentifier.ofKey(Key.key(channel)));
|
||||
} catch (IllegalArgumentException e) {
|
||||
channelIdentifiers.add(new LegacyChannelIdentifier(channel));
|
||||
channelIdentifiers.add(ChannelIdentifier.legacy(channel));
|
||||
}
|
||||
}
|
||||
server.eventManager()
|
||||
@@ -539,7 +538,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
|
||||
// Tell the server about the proxy's plugin message channels.
|
||||
ProtocolVersion serverVersion = serverMc.getProtocolVersion();
|
||||
final Collection<String> channels = server.channelRegistrar()
|
||||
.getChannelsForProtocol(serverMc.getProtocolVersion());
|
||||
.getChannelsForProtocol(serverMc.getProtocolVersion());
|
||||
if (!channels.isEmpty()) {
|
||||
serverMc.delayedWrite(constructChannelsPacket(serverVersion, channels));
|
||||
}
|
||||
|
||||
@@ -35,13 +35,13 @@ import com.velocitypowered.api.event.player.PlayerResourcePackStatusEvent;
|
||||
import com.velocitypowered.api.event.player.PlayerSettingsChangedEvent;
|
||||
import com.velocitypowered.api.event.player.ServerPreConnectEvent;
|
||||
import com.velocitypowered.api.network.ProtocolVersion;
|
||||
import com.velocitypowered.api.network.connection.ServerConnection;
|
||||
import com.velocitypowered.api.permission.PermissionProvider;
|
||||
import com.velocitypowered.api.proxy.ConnectionRequestBuilder;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.ServerConnection;
|
||||
import com.velocitypowered.api.proxy.crypto.IdentifiedKey;
|
||||
import com.velocitypowered.api.proxy.crypto.KeyIdentifiable;
|
||||
import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
|
||||
import com.velocitypowered.api.proxy.player.Player;
|
||||
import com.velocitypowered.api.proxy.player.PlayerSettings;
|
||||
import com.velocitypowered.api.proxy.player.ResourcePackInfo;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
@@ -709,7 +709,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player,
|
||||
}
|
||||
|
||||
private void handleKickEvent(KickedFromServerEvent originalEvent, Component friendlyReason,
|
||||
boolean kickedFromCurrent) {
|
||||
boolean kickedFromCurrent) {
|
||||
server.eventManager().fire(originalEvent).thenAcceptAsync(event -> {
|
||||
// There can't be any connection in flight now.
|
||||
connectionInFlight = null;
|
||||
@@ -1093,7 +1093,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player,
|
||||
*/
|
||||
public void sendKeepAlive() {
|
||||
if (connection.getState() == StateRegistry.PLAY
|
||||
|| connection.getState() == StateRegistry.CONFIG) {
|
||||
|| connection.getState() == StateRegistry.CONFIG) {
|
||||
KeepAlive keepAlive = new KeepAlive();
|
||||
keepAlive.setRandomId(ThreadLocalRandom.current().nextLong());
|
||||
connection.write(keepAlive);
|
||||
@@ -1107,7 +1107,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player,
|
||||
CompletableFuture.runAsync(() -> {
|
||||
connection.write(new StartUpdate());
|
||||
connection.getChannel().pipeline()
|
||||
.get(MinecraftEncoder.class).setState(StateRegistry.CONFIG);
|
||||
.get(MinecraftEncoder.class).setState(StateRegistry.CONFIG);
|
||||
// Make sure we don't send any play packets to the player after update start
|
||||
connection.addPlayPacketQueueHandler();
|
||||
}, connection.eventLoop()).exceptionally((ex) -> {
|
||||
|
||||
@@ -30,8 +30,8 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Handles the play state between exiting the login phase and establishing the first connection
|
||||
* to a backend server.
|
||||
* Handles the play state between exiting the login phase and establishing the first connection to a
|
||||
* backend server.
|
||||
*/
|
||||
public class InitialConnectSessionHandler implements MinecraftSessionHandler {
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
package com.velocitypowered.proxy.connection.client;
|
||||
|
||||
import com.velocitypowered.api.network.ProtocolVersion;
|
||||
import com.velocitypowered.api.proxy.InboundConnection;
|
||||
import com.velocitypowered.api.network.connection.InboundConnection;
|
||||
import com.velocitypowered.proxy.connection.MinecraftConnection;
|
||||
import com.velocitypowered.proxy.connection.MinecraftConnectionAssociation;
|
||||
import com.velocitypowered.proxy.connection.util.VelocityInboundConnection;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
package com.velocitypowered.proxy.connection.client;
|
||||
|
||||
import com.velocitypowered.api.network.ProtocolVersion;
|
||||
import com.velocitypowered.api.proxy.LoginPhaseConnection;
|
||||
import com.velocitypowered.api.network.connection.LoginPhaseConnection;
|
||||
import com.velocitypowered.api.proxy.crypto.IdentifiedKey;
|
||||
import com.velocitypowered.api.proxy.crypto.KeyIdentifiable;
|
||||
import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
|
||||
|
||||
@@ -76,9 +76,9 @@ public enum LegacyForgeHandshakeClientPhase implements ClientConnectionPhase {
|
||||
},
|
||||
|
||||
/**
|
||||
* The Mod list is sent to the server, captured by Velocity. Transition to {@link
|
||||
* #WAITING_SERVER_DATA} when an ACK is sent, which indicates to the server to start sending state
|
||||
* data.
|
||||
* The Mod list is sent to the server, captured by Velocity. Transition to
|
||||
* {@link #WAITING_SERVER_DATA} when an ACK is sent, which indicates to the server to start
|
||||
* sending state data.
|
||||
*/
|
||||
MOD_LIST(LegacyForgeConstants.ACK_DISCRIMINATOR) {
|
||||
@Override
|
||||
@@ -139,9 +139,10 @@ public enum LegacyForgeHandshakeClientPhase implements ClientConnectionPhase {
|
||||
* The handshake is complete. The handshake can be reset.
|
||||
*
|
||||
* <p>Note that a successful connection to a server does not mean that we will be in this state.
|
||||
* After a handshake reset, if the next server is vanilla we will still be in the {@link
|
||||
* #NOT_STARTED} phase, which means we must NOT send a reset packet. This is handled by overriding
|
||||
* the {@link #resetConnectionPhase(ConnectedPlayer)} in this element (it is usually a no-op).
|
||||
* After a handshake reset, if the next server is vanilla we will still be in the
|
||||
* {@link #NOT_STARTED} phase, which means we must NOT send a reset packet. This is handled by
|
||||
* overriding the {@link #resetConnectionPhase(ConnectedPlayer)} in this element (it is usually a
|
||||
* no-op).
|
||||
*/
|
||||
COMPLETE(null) {
|
||||
@Override
|
||||
@@ -181,8 +182,8 @@ public enum LegacyForgeHandshakeClientPhase implements ClientConnectionPhase {
|
||||
*
|
||||
* @param packetToAdvanceOn The ID of the packet discriminator that indicates that the client has
|
||||
* moved onto a new phase, and as such, Velocity should do so too
|
||||
* (inspecting {@link #nextPhase()}. A null indicates there is
|
||||
* no further phase to transition to.
|
||||
* (inspecting {@link #nextPhase()}. A null indicates there is no further
|
||||
* phase to transition to.
|
||||
*/
|
||||
LegacyForgeHandshakeClientPhase(Integer packetToAdvanceOn) {
|
||||
this.packetToAdvanceOn = packetToAdvanceOn;
|
||||
|
||||
@@ -23,8 +23,7 @@ import net.kyori.adventure.key.Key;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Holds the registry data that is sent
|
||||
* to the client during the config stage.
|
||||
* Holds the registry data that is sent to the client during the config stage.
|
||||
*/
|
||||
public class ClientConfigData {
|
||||
|
||||
@@ -35,7 +34,7 @@ public class ClientConfigData {
|
||||
private final String brand;
|
||||
|
||||
private ClientConfigData(@Nullable VelocityResourcePackInfo resourcePackInfo, DataTag tag,
|
||||
RegistrySync registry, Key[] features, String brand) {
|
||||
RegistrySync registry, Key[] features, String brand) {
|
||||
this.resourcePackInfo = resourcePackInfo;
|
||||
this.tag = tag;
|
||||
this.registry = registry;
|
||||
@@ -76,6 +75,7 @@ public class ClientConfigData {
|
||||
* Builder for ClientConfigData.
|
||||
*/
|
||||
public static class Builder {
|
||||
|
||||
private VelocityResourcePackInfo resourcePackInfo;
|
||||
private DataTag tag;
|
||||
private RegistrySync registry;
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
* Represents a data tag.
|
||||
*/
|
||||
public class DataTag {
|
||||
|
||||
private final ImmutableList<DataTag.Set> entrySets;
|
||||
|
||||
public DataTag(ImmutableList<DataTag.Set> entrySets) {
|
||||
|
||||
@@ -53,4 +53,3 @@ public class ConnectionTypeImpl implements ConnectionType {
|
||||
return original;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ public class ServerListPingHandler {
|
||||
}
|
||||
VelocityRegisteredServer vrs = (VelocityRegisteredServer) rs.get();
|
||||
pings.add(vrs.ping(connection.getConnection().eventLoop(), PingOptions.builder()
|
||||
.version(responseProtocolVersion).build()));
|
||||
.version(responseProtocolVersion).build()));
|
||||
}
|
||||
if (pings.isEmpty()) {
|
||||
return CompletableFuture.completedFuture(fallback);
|
||||
@@ -162,11 +162,10 @@ public class ServerListPingHandler {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current server ping for this connection, firing {@code ProxyPingEvent} if the
|
||||
* ping is not cached.
|
||||
* Gets the current server ping for this connection, firing {@code ProxyPingEvent} if the ping is
|
||||
* not cached.
|
||||
*
|
||||
* @param connection the connection being pinged
|
||||
*
|
||||
* @return the server ping as a completable future
|
||||
*/
|
||||
public CompletableFuture<ServerPing> getPing(VelocityInboundConnection connection) {
|
||||
@@ -176,11 +175,10 @@ public class ServerListPingHandler {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current server ping for this connection, firing {@code ProxyPingEvent} if the
|
||||
* ping is not cached.
|
||||
* Gets the current server ping for this connection, firing {@code ProxyPingEvent} if the ping is
|
||||
* not cached.
|
||||
*
|
||||
* @param connection the connection being pinged
|
||||
*
|
||||
* @return the server ping as a completable future
|
||||
*/
|
||||
public CompletableFuture<StatusResponse> getPacketResponse(VelocityInboundConnection connection) {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
package com.velocitypowered.proxy.connection.util;
|
||||
|
||||
import com.velocitypowered.api.proxy.InboundConnection;
|
||||
import com.velocitypowered.api.network.connection.InboundConnection;
|
||||
import com.velocitypowered.proxy.connection.MinecraftConnection;
|
||||
|
||||
/**
|
||||
|
||||
@@ -45,14 +45,14 @@ import org.jline.reader.LineReader;
|
||||
import org.jline.reader.LineReaderBuilder;
|
||||
|
||||
/**
|
||||
* Implements the Velocity console, including sending commands and being the recipient
|
||||
* of messages from plugins.
|
||||
* Implements the Velocity console, including sending commands and being the recipient of messages
|
||||
* from plugins.
|
||||
*/
|
||||
public final class VelocityConsole extends SimpleTerminalConsole implements ConsoleCommandSource {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(VelocityConsole.class);
|
||||
private static final ComponentLogger componentLogger = ComponentLogger
|
||||
.logger(VelocityConsole.class);
|
||||
.logger(VelocityConsole.class);
|
||||
|
||||
private final VelocityServer server;
|
||||
private PermissionChecker permissionChecker = PermissionChecker.always(TriState.TRUE);
|
||||
|
||||
@@ -561,8 +561,8 @@ public class VelocityEventManager implements EventManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the task and returns whether the next handler should be executed immediately
|
||||
* after this one, without additional scheduling.
|
||||
* Executes the task and returns whether the next handler should be executed immediately after
|
||||
* this one, without additional scheduling.
|
||||
*/
|
||||
boolean execute() {
|
||||
state = TASK_STATE_EXECUTING;
|
||||
|
||||
@@ -27,7 +27,7 @@ import com.velocitypowered.api.event.query.ProxyQueryEvent;
|
||||
import com.velocitypowered.api.network.ProtocolVersion;
|
||||
import com.velocitypowered.api.plugin.PluginContainer;
|
||||
import com.velocitypowered.api.plugin.PluginDescription;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.player.Player;
|
||||
import com.velocitypowered.api.proxy.server.QueryResponse;
|
||||
import com.velocitypowered.proxy.VelocityServer;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
package com.velocitypowered.proxy.network.protocol.packet.chat.builder;
|
||||
|
||||
import com.velocitypowered.api.network.ProtocolVersion;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.player.Player;
|
||||
import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
|
||||
import com.velocitypowered.proxy.network.protocol.packet.chat.ChatType;
|
||||
import java.time.Instant;
|
||||
|
||||
@@ -59,10 +59,10 @@ public class VelocityPluginContainer implements PluginContainer {
|
||||
String name = this.description.name().orElse(this.description.id());
|
||||
this.service = Executors.unconfigurableExecutorService(
|
||||
Executors.newCachedThreadPool(
|
||||
new ThreadFactoryBuilder().setDaemon(true)
|
||||
.setNameFormat(name + " - Task Executor #%d")
|
||||
.setDaemon(true)
|
||||
.build()
|
||||
new ThreadFactoryBuilder().setDaemon(true)
|
||||
.setNameFormat(name + " - Task Executor #%d")
|
||||
.setDaemon(true)
|
||||
.build()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -29,14 +29,15 @@ import org.slf4j.LoggerFactory;
|
||||
*/
|
||||
@SuppressWarnings("UnstableApiUsage")
|
||||
public final class ComponentLoggerProviderImpl implements ComponentLoggerProvider {
|
||||
|
||||
private static final ANSIComponentSerializer SERIALIZER = ANSIComponentSerializer.builder()
|
||||
.flattener(TranslatableMapper.FLATTENER)
|
||||
.build();
|
||||
.flattener(TranslatableMapper.FLATTENER)
|
||||
.build();
|
||||
|
||||
@Override
|
||||
public @NotNull ComponentLogger logger(
|
||||
final @NotNull LoggerHelper helper,
|
||||
final @NotNull String name
|
||||
final @NotNull LoggerHelper helper,
|
||||
final @NotNull String name
|
||||
) {
|
||||
return helper.delegating(LoggerFactory.getLogger(name), SERIALIZER::serialize);
|
||||
}
|
||||
|
||||
@@ -53,9 +53,8 @@ import org.jetbrains.annotations.VisibleForTesting;
|
||||
|
||||
/**
|
||||
* The Velocity "scheduler", which is actually a thin wrapper around
|
||||
* {@link ScheduledExecutorService} and a dynamically-sized {@link ExecutorService}.
|
||||
* Many plugins are accustomed to the Bukkit Scheduler model, although it is not relevant
|
||||
* in a proxy context.
|
||||
* {@link ScheduledExecutorService} and a dynamically-sized {@link ExecutorService}. Many plugins
|
||||
* are accustomed to the Bukkit Scheduler model, although it is not relevant in a proxy context.
|
||||
*/
|
||||
public class VelocityScheduler implements Scheduler {
|
||||
|
||||
|
||||
@@ -34,8 +34,8 @@ import java.net.SocketAddress;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
* Session handler used to implement {@link VelocityRegisteredServer#ping(EventLoop,
|
||||
* ProtocolVersion)}.
|
||||
* Session handler used to implement
|
||||
* {@link VelocityRegisteredServer#ping(EventLoop, ProtocolVersion)}.
|
||||
*/
|
||||
public class PingSessionHandler implements MinecraftSessionHandler {
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@ import static com.velocitypowered.proxy.network.Connections.HANDLER;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
|
||||
import com.velocitypowered.api.proxy.player.Player;
|
||||
import com.velocitypowered.api.proxy.server.PingOptions;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import com.velocitypowered.api.proxy.server.ServerInfo;
|
||||
@@ -83,10 +83,10 @@ public class VelocityRegisteredServer implements RegisteredServer, ForwardingAud
|
||||
}
|
||||
|
||||
/**
|
||||
* Pings the specified server using the specified event {@code loop}, claiming to be {@code
|
||||
* version}.
|
||||
* Pings the specified server using the specified event {@code loop}, claiming to be
|
||||
* {@code version}.
|
||||
*
|
||||
* @param loop the event loop to use
|
||||
* @param loop the event loop to use
|
||||
* @param pingOptions the options to apply to this ping
|
||||
* @return the server list ping response
|
||||
*/
|
||||
@@ -141,7 +141,7 @@ public class VelocityRegisteredServer implements RegisteredServer, ForwardingAud
|
||||
for (ConnectedPlayer player : players.values()) {
|
||||
VelocityServerConnection serverConnection = player.getConnectedServer();
|
||||
if (serverConnection != null && serverConnection.getConnection() != null
|
||||
&& serverConnection.server() == this) {
|
||||
&& serverConnection.server() == this) {
|
||||
return serverConnection.sendPluginMessage(identifier, data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
package com.velocitypowered.proxy.tablist;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import com.velocitypowered.api.proxy.crypto.IdentifiedKey;
|
||||
import com.velocitypowered.api.proxy.player.ChatSession;
|
||||
import com.velocitypowered.api.proxy.player.Player;
|
||||
import com.velocitypowered.api.proxy.player.TabListEntry;
|
||||
import com.velocitypowered.api.util.GameProfile;
|
||||
import com.velocitypowered.proxy.connection.MinecraftConnection;
|
||||
|
||||
@@ -36,19 +36,19 @@ public enum TranslatableMapper implements BiConsumer<TranslatableComponent, Cons
|
||||
INSTANCE;
|
||||
|
||||
public static final ComponentFlattener FLATTENER = ComponentFlattener.basic().toBuilder()
|
||||
.complexMapper(TranslatableComponent.class, TranslatableMapper.INSTANCE)
|
||||
.build();
|
||||
.complexMapper(TranslatableComponent.class, TranslatableMapper.INSTANCE)
|
||||
.build();
|
||||
|
||||
@Override
|
||||
public void accept(
|
||||
final TranslatableComponent translatableComponent,
|
||||
final Consumer<Component> componentConsumer
|
||||
final TranslatableComponent translatableComponent,
|
||||
final Consumer<Component> componentConsumer
|
||||
) {
|
||||
for (final Translator source : GlobalTranslator.translator().sources()) {
|
||||
if (source instanceof TranslationRegistry
|
||||
&& ((TranslationRegistry) source).contains(translatableComponent.key())) {
|
||||
&& ((TranslationRegistry) source).contains(translatableComponent.key())) {
|
||||
componentConsumer.accept(GlobalTranslator.render(translatableComponent,
|
||||
ClosestLocaleMatcher.INSTANCE.lookupClosest(Locale.getDefault())));
|
||||
ClosestLocaleMatcher.INSTANCE.lookupClosest(Locale.getDefault())));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -58,10 +58,10 @@ public enum TranslatableMapper implements BiConsumer<TranslatableComponent, Cons
|
||||
}
|
||||
for (final Translator source : GlobalTranslator.translator().sources()) {
|
||||
if (source instanceof TranslationRegistry
|
||||
&& ((TranslationRegistry) source).contains(fallback)) {
|
||||
&& ((TranslationRegistry) source).contains(fallback)) {
|
||||
componentConsumer.accept(
|
||||
GlobalTranslator.render(Component.translatable(fallback),
|
||||
ClosestLocaleMatcher.INSTANCE.lookupClosest(Locale.getDefault())));
|
||||
GlobalTranslator.render(Component.translatable(fallback),
|
||||
ClosestLocaleMatcher.INSTANCE.lookupClosest(Locale.getDefault())));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,12 +17,9 @@
|
||||
|
||||
package com.velocitypowered.proxy.util;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.velocitypowered.api.network.ProtocolVersion;
|
||||
import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
|
||||
import com.velocitypowered.api.proxy.messages.ChannelRegistrar;
|
||||
import com.velocitypowered.api.proxy.messages.LegacyChannelIdentifier;
|
||||
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
|
||||
import com.velocitypowered.proxy.network.protocol.util.PluginMessageUtil;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
@@ -37,15 +34,14 @@ public class VelocityChannelRegistrar implements ChannelRegistrar {
|
||||
|
||||
private final Map<String, ChannelIdentifier> identifierMap = new ConcurrentHashMap<>();
|
||||
|
||||
private static boolean isModernIdentifier(ChannelIdentifier identifier) {
|
||||
return identifier.id().indexOf(':') != -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(ChannelIdentifier... identifiers) {
|
||||
for (ChannelIdentifier identifier : identifiers) {
|
||||
Preconditions.checkArgument(identifier instanceof LegacyChannelIdentifier
|
||||
|| identifier instanceof MinecraftChannelIdentifier, "identifier is unknown");
|
||||
}
|
||||
|
||||
for (ChannelIdentifier identifier : identifiers) {
|
||||
if (identifier instanceof MinecraftChannelIdentifier) {
|
||||
if (isModernIdentifier(identifier)) {
|
||||
identifierMap.put(identifier.id(), identifier);
|
||||
} else {
|
||||
String rewritten = PluginMessageUtil.transformLegacyToModernChannel(identifier.id());
|
||||
@@ -58,13 +54,7 @@ public class VelocityChannelRegistrar implements ChannelRegistrar {
|
||||
@Override
|
||||
public void unregister(ChannelIdentifier... identifiers) {
|
||||
for (ChannelIdentifier identifier : identifiers) {
|
||||
Preconditions.checkArgument(identifier instanceof LegacyChannelIdentifier
|
||||
|| identifier instanceof MinecraftChannelIdentifier,
|
||||
"identifier is unknown");
|
||||
}
|
||||
|
||||
for (ChannelIdentifier identifier : identifiers) {
|
||||
if (identifier instanceof MinecraftChannelIdentifier) {
|
||||
if (isModernIdentifier(identifier)) {
|
||||
identifierMap.remove(identifier.id());
|
||||
} else {
|
||||
String rewritten = PluginMessageUtil.transformLegacyToModernChannel(identifier.id());
|
||||
@@ -95,7 +85,7 @@ public class VelocityChannelRegistrar implements ChannelRegistrar {
|
||||
public Collection<String> getModernChannelIds() {
|
||||
Collection<String> ids = new HashSet<>();
|
||||
for (ChannelIdentifier value : identifierMap.values()) {
|
||||
if (value instanceof MinecraftChannelIdentifier) {
|
||||
if (isModernIdentifier(value)) {
|
||||
ids.add(value.id());
|
||||
} else {
|
||||
ids.add(PluginMessageUtil.transformLegacyToModernChannel(value.id()));
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
velocity.error.already-connected=You are already connected to this server!
|
||||
velocity.error.already-connected-proxy=You are already connected to this proxy!
|
||||
velocity.error.already-connecting=You are already trying to connect to a server!
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
velocity.error.already-connected=أنت بالفعل متصل بهذا السيرفر\!
|
||||
velocity.error.already-connected-proxy=أنت بالفعل متصل بهذا الوكيل\!
|
||||
velocity.error.already-connecting=أنت بالفعل تحاول الاتصال بأحد السيرفرات\!
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
velocity.error.already-connected=You are already connected to this server\!
|
||||
velocity.error.already-connected-proxy=You are already connected to this proxy\!
|
||||
velocity.error.already-connecting=You are already trying to connect to a server\!
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
velocity.error.already-connected=K tomuto serveru jsi již připojen\!
|
||||
velocity.error.already-connected-proxy=K tomuto proxy serveru jsi již připojen\!
|
||||
velocity.error.already-connecting=Již se pokoušíš o připojení k serveru\!
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
velocity.error.already-connected=Du er allerede tilsluttet til den server\!
|
||||
velocity.error.already-connected-proxy=Du er allerede tilsluttet til proxyen\!
|
||||
velocity.error.already-connecting=Du forsøger allerede at oprette forbindelse til en server\!
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
velocity.error.already-connected=Du bist bereits mit diesem Server verbunden\!
|
||||
velocity.error.already-connected-proxy=Du bist bereits mit diesem Proxy verbunden\!
|
||||
velocity.error.already-connecting=Du versuchst bereits eine Verbindung mit dem Server herzustellen\!
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
velocity.error.already-connected=¡Ya estás conectado a este servidor\!
|
||||
velocity.error.already-connected-proxy=¡Ya estás conectado a este proxy\!
|
||||
velocity.error.already-connecting=¡Ya estás intentando conectarte a un servidor\!
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
velocity.error.already-connected=Sa oled juba antud serveriga ühendatud\!
|
||||
velocity.error.already-connected-proxy=Sa oled juba antud proksiga ühendatud\!
|
||||
velocity.error.already-connecting=Sa juba ühendad severiga\!
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
velocity.error.already-connected=Olet jo yhteydessä tälle palvelimelle\!
|
||||
velocity.error.already-connected-proxy=Olet jo yhteydessä tälle välityspalvelimelle\!
|
||||
velocity.error.already-connecting=Yrität jo yhdistää palvelimeen\!
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
velocity.error.already-connected=Vous êtes déjà connecté(e) à ce serveur \!
|
||||
velocity.error.already-connected-proxy=Vous êtes déjà connecté(e) à ce proxy \!
|
||||
velocity.error.already-connecting=Vous êtes déjà en train d'essayer de vous connecter à un serveur \!
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
velocity.error.already-connected=אתה כבר מחובר לשרת זה\!
|
||||
velocity.error.already-connected-proxy=אתה כבר מחובר ל- proxy זה\!
|
||||
velocity.error.already-connecting=אתה כבר מנסה להתחבר לשרת\!
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
velocity.error.already-connected=Már csatlakozva vagy ehhez a szerverhez\!
|
||||
velocity.error.already-connected-proxy=Már csatlakozva vagy ehhez a proxyhoz\!
|
||||
velocity.error.already-connecting=Jelenleg is csatlakozol egy szerverre\!
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
velocity.error.already-connected=Sei già connesso a questo server\!
|
||||
velocity.error.already-connected-proxy=Sei già connesso a questo proxy\!
|
||||
velocity.error.already-connecting=Stai già cercando di connetterti a un server\!
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
velocity.error.already-connected=すでにこのサーバーに接続されています。
|
||||
velocity.error.already-connected-proxy=すでにこのプロキシに接続されています。
|
||||
velocity.error.already-connecting=すでにサーバーに接続しようとしています!
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
velocity.error.already-connected=이미 이 서버에 연결되어 있습니다\!
|
||||
velocity.error.already-connected-proxy=이미 이 프록시에 연결되어 있습니다\!
|
||||
velocity.error.already-connecting=이미 이 서버에 연결하는 중입니다\!
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
velocity.error.already-connected=Du er allerede tilkoblet denne serveren\!
|
||||
velocity.error.already-connected-proxy=Du er allerede tilkoblet denne proxyen\!
|
||||
velocity.error.already-connecting=Du tilkobles allerede en server\!
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
velocity.error.already-connected=Je bent al met deze server verbonden\!
|
||||
velocity.error.already-connected-proxy=Je bent al met deze proxy verbonden\!
|
||||
velocity.error.already-connecting=Je probeert al verbinding te maken met een server\!
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
velocity.error.already-connected=Du er allereie tilkopla denne sørvaren\!
|
||||
velocity.error.already-connected-proxy=Du er allereie tilkopla denne proxyen\!
|
||||
velocity.error.already-connecting=Du tilkoplas allereie ein sørvar\!
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
velocity.error.already-connected=Już jesteś połączony z tym serwerem\!
|
||||
velocity.error.already-connected-proxy=Już jesteś połączony z tym serwerem proxy\!
|
||||
velocity.error.already-connecting=Już próbujesz połączyć się z serwerem\!
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
velocity.error.already-connected=Você já está conectado a esse servidor\!
|
||||
velocity.error.already-connected-proxy=Você já está conectado a esse proxy\!
|
||||
velocity.error.already-connecting=Você já está tentando se conectar a um servidor\!
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
velocity.error.already-connected=Вы уже подключены к этому серверу\!
|
||||
velocity.error.already-connected-proxy=Игрок с таким ником уже играет на сервере\!
|
||||
velocity.error.already-connecting=Вы уже подключаетесь к серверу\!
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
velocity.error.already-connected=Na tento server si už pripojený\!
|
||||
velocity.error.already-connected-proxy=Na tento proxy server si už pripojený\!
|
||||
velocity.error.already-connecting=Už sa pokúšaš o pripojenie na server\!
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
velocity.error.already-connected=Ju tashmë jeni lidhur me këtë server\!
|
||||
velocity.error.already-connected-proxy=Ju jeni lidhur tashmë me këtë përfaqësues\!
|
||||
velocity.error.already-connecting=Ju tashmë po përpiqeni të lidheni me një server\!
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
velocity.error.already-connected=Već ste povezani na ovaj server\!
|
||||
velocity.error.already-connected-proxy=Već ste povezani na ovaj proxy\!
|
||||
velocity.error.already-connecting=Već pokušavate da se povežete na server\!
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
velocity.error.already-connected=You are already connected to this server\!
|
||||
velocity.error.already-connected-proxy=You are already connected to this proxy\!
|
||||
velocity.error.already-connecting=You are already trying to connect to a server\!
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
velocity.error.already-connected=Nakakonekta ka na sa serbidor na ito\!
|
||||
velocity.error.already-connected-proxy=Nakakonekta ka na sa proxy na ito\!
|
||||
velocity.error.already-connecting=Sinusubukan mo na makakonekta sa isang serbidor\!
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
velocity.error.already-connected=Bu sunucuya zaten bağlısın\!
|
||||
velocity.error.already-connected-proxy=Bu sunucuya zaten bağlısın\!
|
||||
velocity.error.already-connecting=Bu sunucuya zaten bağlanmaya çalışıyorsun\!
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
velocity.error.already-connected=您已经连接到此服务器了!
|
||||
velocity.error.already-connected-proxy=您已经连接到此代理服务器了!
|
||||
velocity.error.already-connecting=您已经在尝试连接服务器了!
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
velocity.error.already-connected=You are already connected to this server\!
|
||||
velocity.error.already-connected-proxy=You are already connected to this proxy\!
|
||||
velocity.error.already-connecting=You are already trying to connect to a server\!
|
||||
|
||||
@@ -14,6 +14,5 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
log4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
|
||||
log4j.skipJansi=true
|
||||
|
||||
@@ -25,7 +25,7 @@ import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import com.velocitypowered.api.command.CommandSource;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.player.Player;
|
||||
import com.velocitypowered.proxy.event.MockEventManager;
|
||||
import com.velocitypowered.proxy.event.VelocityEventManager;
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -399,7 +399,8 @@ public class EventTest {
|
||||
+ "the second is the fancy continuation");
|
||||
}
|
||||
},
|
||||
new TypeToken<TriConsumer<Object, Object, FancyContinuation>>() {},
|
||||
new TypeToken<TriConsumer<Object, Object, FancyContinuation>>() {
|
||||
},
|
||||
invokeFunction -> (instance, event) ->
|
||||
EventTask.withContinuation(continuation ->
|
||||
invokeFunction.accept(instance, event, new FancyContinuationImpl(continuation))
|
||||
|
||||
@@ -20,21 +20,21 @@ package com.velocitypowered.proxy.util;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.velocitypowered.api.proxy.messages.LegacyChannelIdentifier;
|
||||
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
|
||||
import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class VelocityChannelRegistrarTest {
|
||||
|
||||
private static final MinecraftChannelIdentifier MODERN = MinecraftChannelIdentifier
|
||||
.create("velocity", "test");
|
||||
private static final LegacyChannelIdentifier SIMPLE_LEGACY =
|
||||
new LegacyChannelIdentifier("VelocityTest");
|
||||
private static final ChannelIdentifier MODERN = ChannelIdentifier.ofKey(
|
||||
Key.key("velocity", "test"));
|
||||
private static final ChannelIdentifier SIMPLE_LEGACY =
|
||||
ChannelIdentifier.legacy("VelocityTest");
|
||||
|
||||
private static final MinecraftChannelIdentifier MODERN_SPECIAL_REMAP = MinecraftChannelIdentifier
|
||||
.create("bungeecord", "main");
|
||||
private static final LegacyChannelIdentifier SPECIAL_REMAP_LEGACY =
|
||||
new LegacyChannelIdentifier("BungeeCord");
|
||||
private static final ChannelIdentifier MODERN_SPECIAL_REMAP = ChannelIdentifier.ofKey(
|
||||
Key.key("bungeecord", "main"));
|
||||
private static final ChannelIdentifier SPECIAL_REMAP_LEGACY =
|
||||
ChannelIdentifier.legacy("BungeeCord");
|
||||
|
||||
private static final String SIMPLE_LEGACY_REMAPPED = "legacy:velocitytest";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user