3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-06 00:00:47 +01:00

A full reorganization of the networking logic

While we're at it, make the packet files mostly Checkstyle clean, except for Javadocs (not very useful)
Dieser Commit ist enthalten in:
Andrew Steinborn 2023-10-27 18:38:26 -04:00
Ursprung 67a6d27123
Commit 115ac92d5c
169 geänderte Dateien mit 991 neuen und 944 gelöschten Zeilen

Datei anzeigen

@ -7,4 +7,6 @@ extensions.configure<CheckstyleExtension> {
maxErrors = 0 maxErrors = 0
maxWarnings = 0 maxWarnings = 0
toolVersion = libs.checkstyle.get().version.toString() toolVersion = libs.checkstyle.get().version.toString()
configProperties["org.checkstyle.google.suppressionfilter.config"] =
rootProject.file("config/checkstyle/checkstyle-suppressions.xml")
} }

Datei anzeigen

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
<suppressions>
<suppress checks="MissingJavadocType"
files="src/main/java/com/velocitypowered/proxy/network/protocol/packet/*" />
<suppress checks="MissingJavadocMethod"
files="src/main/java/com/velocitypowered/proxy/network/protocol/packet/*" />
</suppressions>

Datei anzeigen

@ -33,7 +33,7 @@
<module name="SuppressionFilter"> <module name="SuppressionFilter">
<property name="file" value="${org.checkstyle.google.suppressionfilter.config}" <property name="file" value="${org.checkstyle.google.suppressionfilter.config}"
default="checkstyle-suppressions.xml" /> default="checkstyle-suppressions.xml" />
<property name="optional" value="true"/> <!--<property name="optional" value="true"/>-->
</module> </module>
<!-- Checks for whitespace --> <!-- Checks for whitespace -->

Datei anzeigen

@ -49,10 +49,10 @@ import com.velocitypowered.proxy.console.VelocityConsole;
import com.velocitypowered.proxy.crypto.EncryptionUtils; import com.velocitypowered.proxy.crypto.EncryptionUtils;
import com.velocitypowered.proxy.event.VelocityEventManager; import com.velocitypowered.proxy.event.VelocityEventManager;
import com.velocitypowered.proxy.network.ConnectionManager; import com.velocitypowered.proxy.network.ConnectionManager;
import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.network.protocol.util.FaviconSerializer;
import com.velocitypowered.proxy.network.protocol.util.GameProfileSerializer;
import com.velocitypowered.proxy.plugin.VelocityPluginManager; import com.velocitypowered.proxy.plugin.VelocityPluginManager;
import com.velocitypowered.proxy.protocol.ProtocolUtils;
import com.velocitypowered.proxy.protocol.util.FaviconSerializer;
import com.velocitypowered.proxy.protocol.util.GameProfileSerializer;
import com.velocitypowered.proxy.scheduler.VelocityScheduler; import com.velocitypowered.proxy.scheduler.VelocityScheduler;
import com.velocitypowered.proxy.server.ServerMap; import com.velocitypowered.proxy.server.ServerMap;
import com.velocitypowered.proxy.util.AddressUtil; import com.velocitypowered.proxy.util.AddressUtil;

Datei anzeigen

@ -37,17 +37,18 @@ import com.velocitypowered.proxy.connection.client.HandshakeSessionHandler;
import com.velocitypowered.proxy.connection.client.InitialLoginSessionHandler; import com.velocitypowered.proxy.connection.client.InitialLoginSessionHandler;
import com.velocitypowered.proxy.connection.client.StatusSessionHandler; import com.velocitypowered.proxy.connection.client.StatusSessionHandler;
import com.velocitypowered.proxy.network.Connections; import com.velocitypowered.proxy.network.Connections;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.pipeline.compression.MinecraftCompressDecoder;
import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.network.pipeline.compression.MinecraftCompressorAndLengthEncoder;
import com.velocitypowered.proxy.protocol.VelocityConnectionEvent; import com.velocitypowered.proxy.network.pipeline.deser.MinecraftDecoder;
import com.velocitypowered.proxy.protocol.netty.MinecraftCipherDecoder; import com.velocitypowered.proxy.network.pipeline.deser.MinecraftEncoder;
import com.velocitypowered.proxy.protocol.netty.MinecraftCipherEncoder; import com.velocitypowered.proxy.network.pipeline.encryption.MinecraftCipherDecoder;
import com.velocitypowered.proxy.protocol.netty.MinecraftCompressDecoder; import com.velocitypowered.proxy.network.pipeline.encryption.MinecraftCipherEncoder;
import com.velocitypowered.proxy.protocol.netty.MinecraftCompressorAndLengthEncoder; import com.velocitypowered.proxy.network.pipeline.framing.MinecraftVarintLengthEncoder;
import com.velocitypowered.proxy.protocol.netty.MinecraftDecoder; import com.velocitypowered.proxy.network.pipeline.util.PlayPacketQueueHandler;
import com.velocitypowered.proxy.protocol.netty.MinecraftEncoder; import com.velocitypowered.proxy.network.pipeline.util.VelocityConnectionEvent;
import com.velocitypowered.proxy.protocol.netty.MinecraftVarintLengthEncoder; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.netty.PlayPacketQueueHandler; import com.velocitypowered.proxy.network.protocol.StateRegistry;
import com.velocitypowered.proxy.network.protocol.packet.SetCompression;
import com.velocitypowered.proxy.util.except.QuietDecoderException; import com.velocitypowered.proxy.util.except.QuietDecoderException;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel; import io.netty.channel.Channel;
@ -487,7 +488,7 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter {
/** /**
* Sets the compression threshold on the connection. You are responsible for sending {@link * Sets the compression threshold on the connection. You are responsible for sending {@link
* com.velocitypowered.proxy.protocol.packet.SetCompression} beforehand. * SetCompression} beforehand.
* *
* @param threshold the compression threshold to use * @param threshold the compression threshold to use
*/ */

Datei anzeigen

@ -17,58 +17,58 @@
package com.velocitypowered.proxy.connection; package com.velocitypowered.proxy.connection;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.packet.AvailableCommands; import com.velocitypowered.proxy.network.protocol.packet.AvailableCommands;
import com.velocitypowered.proxy.protocol.packet.BossBar; import com.velocitypowered.proxy.network.protocol.packet.BossBarPacket;
import com.velocitypowered.proxy.protocol.packet.ClientSettings; import com.velocitypowered.proxy.network.protocol.packet.ClientSettings;
import com.velocitypowered.proxy.protocol.packet.Disconnect; import com.velocitypowered.proxy.network.protocol.packet.Disconnect;
import com.velocitypowered.proxy.protocol.packet.EncryptionRequest; import com.velocitypowered.proxy.network.protocol.packet.EncryptionRequest;
import com.velocitypowered.proxy.protocol.packet.EncryptionResponse; import com.velocitypowered.proxy.network.protocol.packet.EncryptionResponse;
import com.velocitypowered.proxy.protocol.packet.Handshake; import com.velocitypowered.proxy.network.protocol.packet.Handshake;
import com.velocitypowered.proxy.protocol.packet.HeaderAndFooter; import com.velocitypowered.proxy.network.protocol.packet.HeaderAndFooter;
import com.velocitypowered.proxy.protocol.packet.JoinGame; import com.velocitypowered.proxy.network.protocol.packet.JoinGame;
import com.velocitypowered.proxy.protocol.packet.KeepAlive; import com.velocitypowered.proxy.network.protocol.packet.KeepAlive;
import com.velocitypowered.proxy.protocol.packet.LegacyHandshake; import com.velocitypowered.proxy.network.protocol.packet.LegacyHandshake;
import com.velocitypowered.proxy.protocol.packet.LegacyPing; import com.velocitypowered.proxy.network.protocol.packet.LegacyPing;
import com.velocitypowered.proxy.protocol.packet.LegacyPlayerListItem; import com.velocitypowered.proxy.network.protocol.packet.LegacyPlayerListItem;
import com.velocitypowered.proxy.protocol.packet.LoginAcknowledged; import com.velocitypowered.proxy.network.protocol.packet.LoginAcknowledged;
import com.velocitypowered.proxy.protocol.packet.LoginPluginMessage; import com.velocitypowered.proxy.network.protocol.packet.LoginPluginMessage;
import com.velocitypowered.proxy.protocol.packet.LoginPluginResponse; import com.velocitypowered.proxy.network.protocol.packet.LoginPluginResponse;
import com.velocitypowered.proxy.protocol.packet.PingIdentify; import com.velocitypowered.proxy.network.protocol.packet.PingIdentify;
import com.velocitypowered.proxy.protocol.packet.PluginMessage; import com.velocitypowered.proxy.network.protocol.packet.PluginMessage;
import com.velocitypowered.proxy.protocol.packet.RemovePlayerInfo; import com.velocitypowered.proxy.network.protocol.packet.RemovePlayerInfo;
import com.velocitypowered.proxy.protocol.packet.ResourcePackRequest; import com.velocitypowered.proxy.network.protocol.packet.ResourcePackRequest;
import com.velocitypowered.proxy.protocol.packet.ResourcePackResponse; import com.velocitypowered.proxy.network.protocol.packet.ResourcePackResponse;
import com.velocitypowered.proxy.protocol.packet.Respawn; import com.velocitypowered.proxy.network.protocol.packet.Respawn;
import com.velocitypowered.proxy.protocol.packet.ServerData; import com.velocitypowered.proxy.network.protocol.packet.ServerData;
import com.velocitypowered.proxy.protocol.packet.ServerLogin; import com.velocitypowered.proxy.network.protocol.packet.ServerLogin;
import com.velocitypowered.proxy.protocol.packet.ServerLoginSuccess; import com.velocitypowered.proxy.network.protocol.packet.ServerLoginSuccess;
import com.velocitypowered.proxy.protocol.packet.SetCompression; import com.velocitypowered.proxy.network.protocol.packet.SetCompression;
import com.velocitypowered.proxy.protocol.packet.StatusPing; import com.velocitypowered.proxy.network.protocol.packet.StatusPing;
import com.velocitypowered.proxy.protocol.packet.StatusRequest; import com.velocitypowered.proxy.network.protocol.packet.StatusRequest;
import com.velocitypowered.proxy.protocol.packet.StatusResponse; import com.velocitypowered.proxy.network.protocol.packet.StatusResponse;
import com.velocitypowered.proxy.protocol.packet.TabCompleteRequest; import com.velocitypowered.proxy.network.protocol.packet.TabCompleteRequest;
import com.velocitypowered.proxy.protocol.packet.TabCompleteResponse; import com.velocitypowered.proxy.network.protocol.packet.TabCompleteResponse;
import com.velocitypowered.proxy.protocol.packet.UpsertPlayerInfo; import com.velocitypowered.proxy.network.protocol.packet.UpsertPlayerInfo;
import com.velocitypowered.proxy.protocol.packet.chat.ChatAcknowledgement; import com.velocitypowered.proxy.network.protocol.packet.chat.ChatAcknowledgement;
import com.velocitypowered.proxy.protocol.packet.chat.PlayerChatCompletion; import com.velocitypowered.proxy.network.protocol.packet.chat.PlayerChatCompletion;
import com.velocitypowered.proxy.protocol.packet.chat.SystemChat; import com.velocitypowered.proxy.network.protocol.packet.chat.SystemChat;
import com.velocitypowered.proxy.protocol.packet.chat.keyed.KeyedPlayerChat; import com.velocitypowered.proxy.network.protocol.packet.chat.keyed.KeyedPlayerChat;
import com.velocitypowered.proxy.protocol.packet.chat.keyed.KeyedPlayerCommand; import com.velocitypowered.proxy.network.protocol.packet.chat.keyed.KeyedPlayerCommand;
import com.velocitypowered.proxy.protocol.packet.chat.legacy.LegacyChat; import com.velocitypowered.proxy.network.protocol.packet.chat.legacy.LegacyChat;
import com.velocitypowered.proxy.protocol.packet.chat.session.SessionPlayerChat; import com.velocitypowered.proxy.network.protocol.packet.chat.session.SessionPlayerChat;
import com.velocitypowered.proxy.protocol.packet.chat.session.SessionPlayerCommand; import com.velocitypowered.proxy.network.protocol.packet.chat.session.SessionPlayerCommand;
import com.velocitypowered.proxy.protocol.packet.config.ActiveFeatures; import com.velocitypowered.proxy.network.protocol.packet.config.ActiveFeatures;
import com.velocitypowered.proxy.protocol.packet.config.FinishedUpdate; import com.velocitypowered.proxy.network.protocol.packet.config.FinishedUpdate;
import com.velocitypowered.proxy.protocol.packet.config.RegistrySync; import com.velocitypowered.proxy.network.protocol.packet.config.RegistrySync;
import com.velocitypowered.proxy.protocol.packet.config.StartUpdate; import com.velocitypowered.proxy.network.protocol.packet.config.StartUpdate;
import com.velocitypowered.proxy.protocol.packet.config.TagsUpdate; import com.velocitypowered.proxy.network.protocol.packet.config.TagsUpdate;
import com.velocitypowered.proxy.protocol.packet.title.LegacyTitlePacket; import com.velocitypowered.proxy.network.protocol.packet.title.LegacyTitlePacket;
import com.velocitypowered.proxy.protocol.packet.title.TitleActionbarPacket; import com.velocitypowered.proxy.network.protocol.packet.title.TitleActionbarPacket;
import com.velocitypowered.proxy.protocol.packet.title.TitleClearPacket; import com.velocitypowered.proxy.network.protocol.packet.title.TitleClearPacket;
import com.velocitypowered.proxy.protocol.packet.title.TitleSubtitlePacket; import com.velocitypowered.proxy.network.protocol.packet.title.TitleSubtitlePacket;
import com.velocitypowered.proxy.protocol.packet.title.TitleTextPacket; import com.velocitypowered.proxy.network.protocol.packet.title.TitleTextPacket;
import com.velocitypowered.proxy.protocol.packet.title.TitleTimesPacket; import com.velocitypowered.proxy.network.protocol.packet.title.TitleTimesPacket;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
/** /**
@ -120,7 +120,7 @@ public interface MinecraftSessionHandler {
return false; return false;
} }
default boolean handle(BossBar packet) { default boolean handle(BossBarPacket packet) {
return false; return false;
} }

Datei anzeigen

@ -19,7 +19,7 @@ package com.velocitypowered.proxy.connection.backend;
import com.velocitypowered.proxy.connection.client.ConnectedPlayer; import com.velocitypowered.proxy.connection.client.ConnectedPlayer;
import com.velocitypowered.proxy.connection.forge.legacy.LegacyForgeHandshakeBackendPhase; import com.velocitypowered.proxy.connection.forge.legacy.LegacyForgeHandshakeBackendPhase;
import com.velocitypowered.proxy.protocol.packet.PluginMessage; import com.velocitypowered.proxy.network.protocol.packet.PluginMessage;
/** /**
* Provides connection phase specific actions. * Provides connection phase specific actions.

Datei anzeigen

@ -19,7 +19,7 @@ package com.velocitypowered.proxy.connection.backend;
import com.velocitypowered.proxy.connection.client.ConnectedPlayer; import com.velocitypowered.proxy.connection.client.ConnectedPlayer;
import com.velocitypowered.proxy.connection.forge.legacy.LegacyForgeHandshakeBackendPhase; import com.velocitypowered.proxy.connection.forge.legacy.LegacyForgeHandshakeBackendPhase;
import com.velocitypowered.proxy.protocol.packet.PluginMessage; import com.velocitypowered.proxy.network.protocol.packet.PluginMessage;
/** /**
* Contains Vanilla {@link BackendConnectionPhase}s. * Contains Vanilla {@link BackendConnectionPhase}s.

Datei anzeigen

@ -38,24 +38,24 @@ import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.connection.client.ClientPlaySessionHandler; import com.velocitypowered.proxy.connection.client.ClientPlaySessionHandler;
import com.velocitypowered.proxy.connection.player.VelocityResourcePackInfo; import com.velocitypowered.proxy.connection.player.VelocityResourcePackInfo;
import com.velocitypowered.proxy.connection.util.ConnectionMessages; import com.velocitypowered.proxy.connection.util.ConnectionMessages;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.pipeline.deser.MinecraftDecoder;
import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.netty.MinecraftDecoder; import com.velocitypowered.proxy.network.protocol.StateRegistry;
import com.velocitypowered.proxy.protocol.packet.AvailableCommands; import com.velocitypowered.proxy.network.protocol.packet.AvailableCommands;
import com.velocitypowered.proxy.protocol.packet.BossBar; import com.velocitypowered.proxy.network.protocol.packet.BossBarPacket;
import com.velocitypowered.proxy.protocol.packet.ClientSettings; import com.velocitypowered.proxy.network.protocol.packet.ClientSettings;
import com.velocitypowered.proxy.protocol.packet.Disconnect; import com.velocitypowered.proxy.network.protocol.packet.Disconnect;
import com.velocitypowered.proxy.protocol.packet.KeepAlive; import com.velocitypowered.proxy.network.protocol.packet.KeepAlive;
import com.velocitypowered.proxy.protocol.packet.LegacyPlayerListItem; import com.velocitypowered.proxy.network.protocol.packet.LegacyPlayerListItem;
import com.velocitypowered.proxy.protocol.packet.PluginMessage; import com.velocitypowered.proxy.network.protocol.packet.PluginMessage;
import com.velocitypowered.proxy.protocol.packet.RemovePlayerInfo; import com.velocitypowered.proxy.network.protocol.packet.RemovePlayerInfo;
import com.velocitypowered.proxy.protocol.packet.ResourcePackRequest; import com.velocitypowered.proxy.network.protocol.packet.ResourcePackRequest;
import com.velocitypowered.proxy.protocol.packet.ResourcePackResponse; import com.velocitypowered.proxy.network.protocol.packet.ResourcePackResponse;
import com.velocitypowered.proxy.protocol.packet.ServerData; import com.velocitypowered.proxy.network.protocol.packet.ServerData;
import com.velocitypowered.proxy.protocol.packet.TabCompleteResponse; import com.velocitypowered.proxy.network.protocol.packet.TabCompleteResponse;
import com.velocitypowered.proxy.protocol.packet.UpsertPlayerInfo; import com.velocitypowered.proxy.network.protocol.packet.UpsertPlayerInfo;
import com.velocitypowered.proxy.protocol.packet.config.StartUpdate; import com.velocitypowered.proxy.network.protocol.packet.config.StartUpdate;
import com.velocitypowered.proxy.protocol.util.PluginMessageUtil; import com.velocitypowered.proxy.network.protocol.util.PluginMessageUtil;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil; import io.netty.buffer.ByteBufUtil;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
@ -154,10 +154,10 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
} }
@Override @Override
public boolean handle(BossBar packet) { public boolean handle(BossBarPacket packet) {
if (packet.getAction() == BossBar.ADD) { if (packet.getAction() == BossBarPacket.ADD) {
playerSessionHandler.getServerBossBars().add(packet.getUuid()); playerSessionHandler.getServerBossBars().add(packet.getUuid());
} else if (packet.getAction() == BossBar.REMOVE) { } else if (packet.getAction() == BossBarPacket.REMOVE) {
playerSessionHandler.getServerBossBars().remove(packet.getUuid()); playerSessionHandler.getServerBossBars().remove(packet.getUuid());
} }
return false; // forward return false; // forward

Datei anzeigen

@ -28,9 +28,9 @@ import com.velocitypowered.api.util.UuidUtils;
import com.velocitypowered.proxy.VelocityServer; import com.velocitypowered.proxy.VelocityServer;
import com.velocitypowered.proxy.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.MinecraftConnection;
import com.velocitypowered.proxy.connection.client.ConnectedPlayer; import com.velocitypowered.proxy.connection.client.ConnectedPlayer;
import com.velocitypowered.proxy.protocol.packet.PluginMessage; import com.velocitypowered.proxy.network.protocol.packet.PluginMessage;
import com.velocitypowered.proxy.protocol.util.ByteBufDataInput; import com.velocitypowered.proxy.network.protocol.util.ByteBufDataInput;
import com.velocitypowered.proxy.protocol.util.ByteBufDataOutput; import com.velocitypowered.proxy.network.protocol.util.ByteBufDataOutput;
import com.velocitypowered.proxy.server.VelocityRegisteredServer; import com.velocitypowered.proxy.server.VelocityRegisteredServer;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;

Datei anzeigen

@ -29,19 +29,19 @@ import com.velocitypowered.proxy.connection.player.VelocityResourcePackInfo;
import com.velocitypowered.proxy.connection.util.ConnectionMessages; import com.velocitypowered.proxy.connection.util.ConnectionMessages;
import com.velocitypowered.proxy.connection.util.ConnectionRequestResults; import com.velocitypowered.proxy.connection.util.ConnectionRequestResults;
import com.velocitypowered.proxy.connection.util.ConnectionRequestResults.Impl; import com.velocitypowered.proxy.connection.util.ConnectionRequestResults.Impl;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.pipeline.deser.MinecraftDecoder;
import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.netty.MinecraftDecoder; import com.velocitypowered.proxy.network.protocol.StateRegistry;
import com.velocitypowered.proxy.protocol.packet.Disconnect; import com.velocitypowered.proxy.network.protocol.packet.Disconnect;
import com.velocitypowered.proxy.protocol.packet.KeepAlive; import com.velocitypowered.proxy.network.protocol.packet.KeepAlive;
import com.velocitypowered.proxy.protocol.packet.PluginMessage; import com.velocitypowered.proxy.network.protocol.packet.PluginMessage;
import com.velocitypowered.proxy.protocol.packet.ResourcePackRequest; import com.velocitypowered.proxy.network.protocol.packet.ResourcePackRequest;
import com.velocitypowered.proxy.protocol.packet.ResourcePackResponse; import com.velocitypowered.proxy.network.protocol.packet.ResourcePackResponse;
import com.velocitypowered.proxy.protocol.packet.config.FinishedUpdate; import com.velocitypowered.proxy.network.protocol.packet.config.FinishedUpdate;
import com.velocitypowered.proxy.protocol.packet.config.RegistrySync; import com.velocitypowered.proxy.network.protocol.packet.config.RegistrySync;
import com.velocitypowered.proxy.protocol.packet.config.StartUpdate; import com.velocitypowered.proxy.network.protocol.packet.config.StartUpdate;
import com.velocitypowered.proxy.protocol.packet.config.TagsUpdate; import com.velocitypowered.proxy.network.protocol.packet.config.TagsUpdate;
import com.velocitypowered.proxy.protocol.util.PluginMessageUtil; import com.velocitypowered.proxy.network.protocol.util.PluginMessageUtil;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.regex.Pattern; import java.util.regex.Pattern;

Datei anzeigen

@ -31,15 +31,15 @@ import com.velocitypowered.proxy.connection.client.ClientPlaySessionHandler;
import com.velocitypowered.proxy.connection.client.ConnectedPlayer; import com.velocitypowered.proxy.connection.client.ConnectedPlayer;
import com.velocitypowered.proxy.connection.util.ConnectionRequestResults; import com.velocitypowered.proxy.connection.util.ConnectionRequestResults;
import com.velocitypowered.proxy.connection.util.ConnectionRequestResults.Impl; import com.velocitypowered.proxy.connection.util.ConnectionRequestResults.Impl;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.network.protocol.StateRegistry;
import com.velocitypowered.proxy.protocol.packet.Disconnect; import com.velocitypowered.proxy.network.protocol.packet.Disconnect;
import com.velocitypowered.proxy.protocol.packet.EncryptionRequest; import com.velocitypowered.proxy.network.protocol.packet.EncryptionRequest;
import com.velocitypowered.proxy.protocol.packet.LoginAcknowledged; import com.velocitypowered.proxy.network.protocol.packet.LoginAcknowledged;
import com.velocitypowered.proxy.protocol.packet.LoginPluginMessage; import com.velocitypowered.proxy.network.protocol.packet.LoginPluginMessage;
import com.velocitypowered.proxy.protocol.packet.LoginPluginResponse; import com.velocitypowered.proxy.network.protocol.packet.LoginPluginResponse;
import com.velocitypowered.proxy.protocol.packet.ServerLoginSuccess; import com.velocitypowered.proxy.network.protocol.packet.ServerLoginSuccess;
import com.velocitypowered.proxy.protocol.packet.SetCompression; import com.velocitypowered.proxy.network.protocol.packet.SetCompression;
import com.velocitypowered.proxy.util.except.QuietRuntimeException; import com.velocitypowered.proxy.util.except.QuietRuntimeException;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil; import io.netty.buffer.ByteBufUtil;

Datei anzeigen

@ -33,11 +33,11 @@ import com.velocitypowered.proxy.connection.client.ConnectedPlayer;
import com.velocitypowered.proxy.connection.util.ConnectionMessages; import com.velocitypowered.proxy.connection.util.ConnectionMessages;
import com.velocitypowered.proxy.connection.util.ConnectionRequestResults; import com.velocitypowered.proxy.connection.util.ConnectionRequestResults;
import com.velocitypowered.proxy.connection.util.ConnectionRequestResults.Impl; import com.velocitypowered.proxy.connection.util.ConnectionRequestResults.Impl;
import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.network.protocol.StateRegistry;
import com.velocitypowered.proxy.protocol.packet.Disconnect; import com.velocitypowered.proxy.network.protocol.packet.Disconnect;
import com.velocitypowered.proxy.protocol.packet.JoinGame; import com.velocitypowered.proxy.network.protocol.packet.JoinGame;
import com.velocitypowered.proxy.protocol.packet.KeepAlive; import com.velocitypowered.proxy.network.protocol.packet.KeepAlive;
import com.velocitypowered.proxy.protocol.packet.PluginMessage; import com.velocitypowered.proxy.network.protocol.packet.PluginMessage;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;

Datei anzeigen

@ -37,10 +37,11 @@ import com.velocitypowered.proxy.connection.MinecraftConnectionAssociation;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.connection.client.ConnectedPlayer; import com.velocitypowered.proxy.connection.client.ConnectedPlayer;
import com.velocitypowered.proxy.connection.util.ConnectionRequestResults.Impl; import com.velocitypowered.proxy.connection.util.ConnectionRequestResults.Impl;
import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.network.protocol.StateRegistry;
import com.velocitypowered.proxy.protocol.packet.Handshake; import com.velocitypowered.proxy.network.protocol.packet.Handshake;
import com.velocitypowered.proxy.protocol.packet.PluginMessage; import com.velocitypowered.proxy.network.protocol.packet.JoinGame;
import com.velocitypowered.proxy.protocol.packet.ServerLogin; import com.velocitypowered.proxy.network.protocol.packet.PluginMessage;
import com.velocitypowered.proxy.network.protocol.packet.ServerLogin;
import com.velocitypowered.proxy.server.VelocityRegisteredServer; import com.velocitypowered.proxy.server.VelocityRegisteredServer;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
@ -356,7 +357,7 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation,
} }
/** /**
* Gets whether the {@link com.velocitypowered.proxy.protocol.packet.JoinGame} packet has been * Gets whether the {@link JoinGame} packet has been
* sent by this server. * sent by this server.
* *
* @return Whether the join has been completed. * @return Whether the join has been completed.

Datei anzeigen

@ -37,10 +37,10 @@ import com.velocitypowered.proxy.config.VelocityConfiguration;
import com.velocitypowered.proxy.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.MinecraftConnection;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.crypto.IdentifiedKeyImpl; import com.velocitypowered.proxy.crypto.IdentifiedKeyImpl;
import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.network.protocol.StateRegistry;
import com.velocitypowered.proxy.protocol.packet.LoginAcknowledged; import com.velocitypowered.proxy.network.protocol.packet.LoginAcknowledged;
import com.velocitypowered.proxy.protocol.packet.ServerLoginSuccess; import com.velocitypowered.proxy.network.protocol.packet.ServerLoginSuccess;
import com.velocitypowered.proxy.protocol.packet.SetCompression; import com.velocitypowered.proxy.network.protocol.packet.SetCompression;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;

Datei anzeigen

@ -22,15 +22,15 @@ import com.velocitypowered.proxy.VelocityServer;
import com.velocitypowered.proxy.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.MinecraftConnection;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.connection.backend.VelocityServerConnection; import com.velocitypowered.proxy.connection.backend.VelocityServerConnection;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.network.protocol.StateRegistry;
import com.velocitypowered.proxy.protocol.packet.ClientSettings; import com.velocitypowered.proxy.network.protocol.packet.ClientSettings;
import com.velocitypowered.proxy.protocol.packet.KeepAlive; import com.velocitypowered.proxy.network.protocol.packet.KeepAlive;
import com.velocitypowered.proxy.protocol.packet.PingIdentify; import com.velocitypowered.proxy.network.protocol.packet.PingIdentify;
import com.velocitypowered.proxy.protocol.packet.PluginMessage; import com.velocitypowered.proxy.network.protocol.packet.PluginMessage;
import com.velocitypowered.proxy.protocol.packet.ResourcePackResponse; import com.velocitypowered.proxy.network.protocol.packet.ResourcePackResponse;
import com.velocitypowered.proxy.protocol.packet.config.FinishedUpdate; import com.velocitypowered.proxy.network.protocol.packet.config.FinishedUpdate;
import com.velocitypowered.proxy.protocol.util.PluginMessageUtil; import com.velocitypowered.proxy.network.protocol.util.PluginMessageUtil;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;

Datei anzeigen

@ -19,7 +19,7 @@ package com.velocitypowered.proxy.connection.client;
import com.velocitypowered.proxy.connection.backend.VelocityServerConnection; import com.velocitypowered.proxy.connection.backend.VelocityServerConnection;
import com.velocitypowered.proxy.connection.forge.legacy.LegacyForgeHandshakeClientPhase; import com.velocitypowered.proxy.connection.forge.legacy.LegacyForgeHandshakeClientPhase;
import com.velocitypowered.proxy.protocol.packet.PluginMessage; import com.velocitypowered.proxy.network.protocol.packet.PluginMessage;
/** /**
* Provides connection phase specific actions. * Provides connection phase specific actions.

Datei anzeigen

@ -17,7 +17,7 @@
package com.velocitypowered.proxy.connection.client; package com.velocitypowered.proxy.connection.client;
import static com.velocitypowered.proxy.protocol.util.PluginMessageUtil.constructChannelsPacket; import static com.velocitypowered.proxy.network.protocol.util.PluginMessageUtil.constructChannelsPacket;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.mojang.brigadier.suggestion.Suggestion; import com.mojang.brigadier.suggestion.Suggestion;
@ -38,35 +38,35 @@ import com.velocitypowered.proxy.connection.backend.BackendConnectionPhases;
import com.velocitypowered.proxy.connection.backend.BungeeCordMessageResponder; import com.velocitypowered.proxy.connection.backend.BungeeCordMessageResponder;
import com.velocitypowered.proxy.connection.backend.VelocityServerConnection; import com.velocitypowered.proxy.connection.backend.VelocityServerConnection;
import com.velocitypowered.proxy.connection.forge.legacy.LegacyForgeConstants; import com.velocitypowered.proxy.connection.forge.legacy.LegacyForgeConstants;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.network.protocol.StateRegistry;
import com.velocitypowered.proxy.protocol.packet.BossBar; import com.velocitypowered.proxy.network.protocol.packet.BossBarPacket;
import com.velocitypowered.proxy.protocol.packet.ClientSettings; import com.velocitypowered.proxy.network.protocol.packet.ClientSettings;
import com.velocitypowered.proxy.protocol.packet.JoinGame; import com.velocitypowered.proxy.network.protocol.packet.JoinGame;
import com.velocitypowered.proxy.protocol.packet.KeepAlive; import com.velocitypowered.proxy.network.protocol.packet.KeepAlive;
import com.velocitypowered.proxy.protocol.packet.PluginMessage; import com.velocitypowered.proxy.network.protocol.packet.PluginMessage;
import com.velocitypowered.proxy.protocol.packet.ResourcePackResponse; import com.velocitypowered.proxy.network.protocol.packet.ResourcePackResponse;
import com.velocitypowered.proxy.protocol.packet.Respawn; import com.velocitypowered.proxy.network.protocol.packet.Respawn;
import com.velocitypowered.proxy.protocol.packet.TabCompleteRequest; import com.velocitypowered.proxy.network.protocol.packet.TabCompleteRequest;
import com.velocitypowered.proxy.protocol.packet.TabCompleteResponse; import com.velocitypowered.proxy.network.protocol.packet.TabCompleteResponse;
import com.velocitypowered.proxy.protocol.packet.TabCompleteResponse.Offer; import com.velocitypowered.proxy.network.protocol.packet.TabCompleteResponse.Offer;
import com.velocitypowered.proxy.protocol.packet.chat.ChatHandler; import com.velocitypowered.proxy.network.protocol.packet.chat.ChatHandler;
import com.velocitypowered.proxy.protocol.packet.chat.ChatTimeKeeper; import com.velocitypowered.proxy.network.protocol.packet.chat.ChatTimeKeeper;
import com.velocitypowered.proxy.protocol.packet.chat.CommandHandler; import com.velocitypowered.proxy.network.protocol.packet.chat.CommandHandler;
import com.velocitypowered.proxy.protocol.packet.chat.keyed.KeyedChatHandler; import com.velocitypowered.proxy.network.protocol.packet.chat.keyed.KeyedChatHandler;
import com.velocitypowered.proxy.protocol.packet.chat.keyed.KeyedCommandHandler; import com.velocitypowered.proxy.network.protocol.packet.chat.keyed.KeyedCommandHandler;
import com.velocitypowered.proxy.protocol.packet.chat.keyed.KeyedPlayerChat; import com.velocitypowered.proxy.network.protocol.packet.chat.keyed.KeyedPlayerChat;
import com.velocitypowered.proxy.protocol.packet.chat.keyed.KeyedPlayerCommand; import com.velocitypowered.proxy.network.protocol.packet.chat.keyed.KeyedPlayerCommand;
import com.velocitypowered.proxy.protocol.packet.chat.legacy.LegacyChat; import com.velocitypowered.proxy.network.protocol.packet.chat.legacy.LegacyChat;
import com.velocitypowered.proxy.protocol.packet.chat.legacy.LegacyChatHandler; import com.velocitypowered.proxy.network.protocol.packet.chat.legacy.LegacyChatHandler;
import com.velocitypowered.proxy.protocol.packet.chat.legacy.LegacyCommandHandler; import com.velocitypowered.proxy.network.protocol.packet.chat.legacy.LegacyCommandHandler;
import com.velocitypowered.proxy.protocol.packet.chat.session.SessionChatHandler; import com.velocitypowered.proxy.network.protocol.packet.chat.session.SessionChatHandler;
import com.velocitypowered.proxy.protocol.packet.chat.session.SessionCommandHandler; import com.velocitypowered.proxy.network.protocol.packet.chat.session.SessionCommandHandler;
import com.velocitypowered.proxy.protocol.packet.chat.session.SessionPlayerChat; import com.velocitypowered.proxy.network.protocol.packet.chat.session.SessionPlayerChat;
import com.velocitypowered.proxy.protocol.packet.chat.session.SessionPlayerCommand; import com.velocitypowered.proxy.network.protocol.packet.chat.session.SessionPlayerCommand;
import com.velocitypowered.proxy.protocol.packet.config.FinishedUpdate; import com.velocitypowered.proxy.network.protocol.packet.config.FinishedUpdate;
import com.velocitypowered.proxy.protocol.packet.title.GenericTitlePacket; import com.velocitypowered.proxy.network.protocol.packet.title.GenericTitlePacket;
import com.velocitypowered.proxy.protocol.util.PluginMessageUtil; import com.velocitypowered.proxy.network.protocol.util.PluginMessageUtil;
import com.velocitypowered.proxy.util.CharacterUtil; import com.velocitypowered.proxy.util.CharacterUtil;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil; import io.netty.buffer.ByteBufUtil;
@ -529,9 +529,9 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
// Remove previous boss bars. These don't get cleared when sending JoinGame, thus the need to // Remove previous boss bars. These don't get cleared when sending JoinGame, thus the need to
// track them. // track them.
for (UUID serverBossBar : serverBossBars) { for (UUID serverBossBar : serverBossBars) {
BossBar deletePacket = new BossBar(); BossBarPacket deletePacket = new BossBarPacket();
deletePacket.setUuid(serverBossBar); deletePacket.setUuid(serverBossBar);
deletePacket.setAction(BossBar.REMOVE); deletePacket.setAction(BossBarPacket.REMOVE);
player.getConnection().delayedWrite(deletePacket); player.getConnection().delayedWrite(deletePacket);
} }
serverBossBars.clear(); serverBossBars.clear();

Datei anzeigen

@ -19,7 +19,7 @@ package com.velocitypowered.proxy.connection.client;
import com.velocitypowered.api.proxy.player.PlayerSettings; import com.velocitypowered.api.proxy.player.PlayerSettings;
import com.velocitypowered.api.proxy.player.SkinParts; import com.velocitypowered.api.proxy.player.SkinParts;
import com.velocitypowered.proxy.protocol.packet.ClientSettings; import com.velocitypowered.proxy.network.protocol.packet.ClientSettings;
import java.util.Locale; import java.util.Locale;
import java.util.Objects; import java.util.Objects;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;

Datei anzeigen

@ -55,21 +55,21 @@ import com.velocitypowered.proxy.connection.player.VelocityResourcePackInfo;
import com.velocitypowered.proxy.connection.util.ConnectionMessages; import com.velocitypowered.proxy.connection.util.ConnectionMessages;
import com.velocitypowered.proxy.connection.util.ConnectionRequestResults.Impl; import com.velocitypowered.proxy.connection.util.ConnectionRequestResults.Impl;
import com.velocitypowered.proxy.connection.util.VelocityInboundConnection; import com.velocitypowered.proxy.connection.util.VelocityInboundConnection;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.pipeline.deser.MinecraftEncoder;
import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.protocol.netty.MinecraftEncoder; import com.velocitypowered.proxy.network.protocol.StateRegistry;
import com.velocitypowered.proxy.protocol.packet.ClientSettings; import com.velocitypowered.proxy.network.protocol.packet.ClientSettings;
import com.velocitypowered.proxy.protocol.packet.Disconnect; import com.velocitypowered.proxy.network.protocol.packet.Disconnect;
import com.velocitypowered.proxy.protocol.packet.HeaderAndFooter; import com.velocitypowered.proxy.network.protocol.packet.HeaderAndFooter;
import com.velocitypowered.proxy.protocol.packet.KeepAlive; import com.velocitypowered.proxy.network.protocol.packet.KeepAlive;
import com.velocitypowered.proxy.protocol.packet.PluginMessage; import com.velocitypowered.proxy.network.protocol.packet.PluginMessage;
import com.velocitypowered.proxy.protocol.packet.ResourcePackRequest; import com.velocitypowered.proxy.network.protocol.packet.ResourcePackRequest;
import com.velocitypowered.proxy.protocol.packet.chat.ChatQueue; import com.velocitypowered.proxy.network.protocol.packet.chat.ChatQueue;
import com.velocitypowered.proxy.protocol.packet.chat.ChatType; import com.velocitypowered.proxy.network.protocol.packet.chat.ChatType;
import com.velocitypowered.proxy.protocol.packet.chat.builder.ChatBuilderFactory; import com.velocitypowered.proxy.network.protocol.packet.chat.builder.ChatBuilderFactory;
import com.velocitypowered.proxy.protocol.packet.chat.legacy.LegacyChat; import com.velocitypowered.proxy.network.protocol.packet.chat.legacy.LegacyChat;
import com.velocitypowered.proxy.protocol.packet.config.StartUpdate; import com.velocitypowered.proxy.network.protocol.packet.config.StartUpdate;
import com.velocitypowered.proxy.protocol.packet.title.GenericTitlePacket; import com.velocitypowered.proxy.network.protocol.packet.title.GenericTitlePacket;
import com.velocitypowered.proxy.server.VelocityRegisteredServer; import com.velocitypowered.proxy.server.VelocityRegisteredServer;
import com.velocitypowered.proxy.tablist.InternalTabList; import com.velocitypowered.proxy.tablist.InternalTabList;
import com.velocitypowered.proxy.tablist.KeyedVelocityTabList; import com.velocitypowered.proxy.tablist.KeyedVelocityTabList;

Datei anzeigen

@ -29,12 +29,12 @@ import com.velocitypowered.proxy.connection.MinecraftConnection;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.connection.forge.legacy.LegacyForgeConstants; import com.velocitypowered.proxy.connection.forge.legacy.LegacyForgeConstants;
import com.velocitypowered.proxy.connection.util.VelocityInboundConnection; import com.velocitypowered.proxy.connection.util.VelocityInboundConnection;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.network.protocol.StateRegistry;
import com.velocitypowered.proxy.protocol.packet.Handshake; import com.velocitypowered.proxy.network.protocol.packet.Handshake;
import com.velocitypowered.proxy.protocol.packet.LegacyDisconnect; import com.velocitypowered.proxy.network.protocol.packet.LegacyDisconnect;
import com.velocitypowered.proxy.protocol.packet.LegacyHandshake; import com.velocitypowered.proxy.network.protocol.packet.LegacyHandshake;
import com.velocitypowered.proxy.protocol.packet.LegacyPing; import com.velocitypowered.proxy.network.protocol.packet.LegacyPing;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;

Datei anzeigen

@ -23,7 +23,7 @@ import com.velocitypowered.proxy.VelocityServer;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.connection.backend.BungeeCordMessageResponder; import com.velocitypowered.proxy.connection.backend.BungeeCordMessageResponder;
import com.velocitypowered.proxy.connection.backend.VelocityServerConnection; import com.velocitypowered.proxy.connection.backend.VelocityServerConnection;
import com.velocitypowered.proxy.protocol.packet.PluginMessage; import com.velocitypowered.proxy.network.protocol.packet.PluginMessage;
import io.netty.buffer.ByteBufUtil; import io.netty.buffer.ByteBufUtil;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;

Datei anzeigen

@ -22,8 +22,8 @@ import com.velocitypowered.api.proxy.InboundConnection;
import com.velocitypowered.proxy.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.MinecraftConnection;
import com.velocitypowered.proxy.connection.MinecraftConnectionAssociation; import com.velocitypowered.proxy.connection.MinecraftConnectionAssociation;
import com.velocitypowered.proxy.connection.util.VelocityInboundConnection; import com.velocitypowered.proxy.connection.util.VelocityInboundConnection;
import com.velocitypowered.proxy.protocol.packet.Disconnect; import com.velocitypowered.proxy.network.protocol.packet.Disconnect;
import com.velocitypowered.proxy.protocol.packet.Handshake; import com.velocitypowered.proxy.network.protocol.packet.Handshake;
import com.velocitypowered.proxy.util.ClosestLocaleMatcher; import com.velocitypowered.proxy.util.ClosestLocaleMatcher;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.util.Locale; import java.util.Locale;

Datei anzeigen

@ -34,12 +34,12 @@ import com.velocitypowered.proxy.VelocityServer;
import com.velocitypowered.proxy.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.MinecraftConnection;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.crypto.IdentifiedKeyImpl; import com.velocitypowered.proxy.crypto.IdentifiedKeyImpl;
import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.network.pipeline.deser.MinecraftDecoder;
import com.velocitypowered.proxy.protocol.netty.MinecraftDecoder; import com.velocitypowered.proxy.network.protocol.StateRegistry;
import com.velocitypowered.proxy.protocol.packet.EncryptionRequest; import com.velocitypowered.proxy.network.protocol.packet.EncryptionRequest;
import com.velocitypowered.proxy.protocol.packet.EncryptionResponse; import com.velocitypowered.proxy.network.protocol.packet.EncryptionResponse;
import com.velocitypowered.proxy.protocol.packet.LoginPluginResponse; import com.velocitypowered.proxy.network.protocol.packet.LoginPluginResponse;
import com.velocitypowered.proxy.protocol.packet.ServerLogin; import com.velocitypowered.proxy.network.protocol.packet.ServerLogin;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.security.GeneralSecurityException; import java.security.GeneralSecurityException;

Datei anzeigen

@ -23,8 +23,8 @@ import com.velocitypowered.api.proxy.crypto.IdentifiedKey;
import com.velocitypowered.api.proxy.crypto.KeyIdentifiable; import com.velocitypowered.api.proxy.crypto.KeyIdentifiable;
import com.velocitypowered.api.proxy.messages.ChannelIdentifier; import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
import com.velocitypowered.proxy.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.MinecraftConnection;
import com.velocitypowered.proxy.protocol.packet.LoginPluginMessage; import com.velocitypowered.proxy.network.protocol.packet.LoginPluginMessage;
import com.velocitypowered.proxy.protocol.packet.LoginPluginResponse; import com.velocitypowered.proxy.network.protocol.packet.LoginPluginResponse;
import io.netty.buffer.ByteBufUtil; import io.netty.buffer.ByteBufUtil;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMap;

Datei anzeigen

@ -21,10 +21,10 @@ import com.velocitypowered.proxy.VelocityServer;
import com.velocitypowered.proxy.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.MinecraftConnection;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.connection.util.VelocityInboundConnection; import com.velocitypowered.proxy.connection.util.VelocityInboundConnection;
import com.velocitypowered.proxy.protocol.packet.LegacyDisconnect; import com.velocitypowered.proxy.network.protocol.packet.LegacyDisconnect;
import com.velocitypowered.proxy.protocol.packet.LegacyPing; import com.velocitypowered.proxy.network.protocol.packet.LegacyPing;
import com.velocitypowered.proxy.protocol.packet.StatusPing; import com.velocitypowered.proxy.network.protocol.packet.StatusPing;
import com.velocitypowered.proxy.protocol.packet.StatusRequest; import com.velocitypowered.proxy.network.protocol.packet.StatusRequest;
import com.velocitypowered.proxy.util.except.QuietRuntimeException; import com.velocitypowered.proxy.util.except.QuietRuntimeException;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;

Datei anzeigen

@ -23,7 +23,7 @@ import com.velocitypowered.proxy.connection.backend.BackendConnectionPhase;
import com.velocitypowered.proxy.connection.backend.BackendConnectionPhases; import com.velocitypowered.proxy.connection.backend.BackendConnectionPhases;
import com.velocitypowered.proxy.connection.backend.VelocityServerConnection; import com.velocitypowered.proxy.connection.backend.VelocityServerConnection;
import com.velocitypowered.proxy.connection.client.ConnectedPlayer; import com.velocitypowered.proxy.connection.client.ConnectedPlayer;
import com.velocitypowered.proxy.protocol.packet.PluginMessage; import com.velocitypowered.proxy.network.protocol.packet.PluginMessage;
import javax.annotation.Nullable; import javax.annotation.Nullable;
/** /**

Datei anzeigen

@ -24,7 +24,7 @@ import com.velocitypowered.proxy.connection.backend.VelocityServerConnection;
import com.velocitypowered.proxy.connection.client.ClientConnectionPhase; import com.velocitypowered.proxy.connection.client.ClientConnectionPhase;
import com.velocitypowered.proxy.connection.client.ClientPlaySessionHandler; import com.velocitypowered.proxy.connection.client.ClientPlaySessionHandler;
import com.velocitypowered.proxy.connection.client.ConnectedPlayer; import com.velocitypowered.proxy.connection.client.ConnectedPlayer;
import com.velocitypowered.proxy.protocol.packet.PluginMessage; import com.velocitypowered.proxy.network.protocol.packet.PluginMessage;
import java.util.List; import java.util.List;
import javax.annotation.Nullable; import javax.annotation.Nullable;

Datei anzeigen

@ -24,8 +24,8 @@ import static com.velocitypowered.proxy.connection.forge.legacy.LegacyForgeConst
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.velocitypowered.api.util.ModInfo; import com.velocitypowered.api.util.ModInfo;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.protocol.packet.PluginMessage; import com.velocitypowered.proxy.network.protocol.packet.PluginMessage;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import java.util.List; import java.util.List;

Datei anzeigen

@ -18,7 +18,7 @@
package com.velocitypowered.proxy.connection.registry; package com.velocitypowered.proxy.connection.registry;
import com.velocitypowered.proxy.connection.player.VelocityResourcePackInfo; import com.velocitypowered.proxy.connection.player.VelocityResourcePackInfo;
import com.velocitypowered.proxy.protocol.packet.config.RegistrySync; import com.velocitypowered.proxy.network.protocol.packet.config.RegistrySync;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;

Datei anzeigen

@ -20,7 +20,7 @@ package com.velocitypowered.proxy.connection.util;
import com.velocitypowered.api.proxy.ConnectionRequestBuilder; import com.velocitypowered.api.proxy.ConnectionRequestBuilder;
import com.velocitypowered.api.proxy.ConnectionRequestBuilder.Status; import com.velocitypowered.api.proxy.ConnectionRequestBuilder.Status;
import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.api.proxy.server.RegisteredServer;
import com.velocitypowered.proxy.protocol.packet.Disconnect; import com.velocitypowered.proxy.network.protocol.packet.Disconnect;
import java.util.Optional; import java.util.Optional;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;

Datei anzeigen

@ -28,7 +28,7 @@ import com.velocitypowered.api.util.ModInfo;
import com.velocitypowered.proxy.VelocityServer; import com.velocitypowered.proxy.VelocityServer;
import com.velocitypowered.proxy.config.PingPassthroughMode; import com.velocitypowered.proxy.config.PingPassthroughMode;
import com.velocitypowered.proxy.config.VelocityConfiguration; import com.velocitypowered.proxy.config.VelocityConfiguration;
import com.velocitypowered.proxy.protocol.packet.StatusResponse; import com.velocitypowered.proxy.network.protocol.packet.StatusResponse;
import com.velocitypowered.proxy.server.VelocityRegisteredServer; import com.velocitypowered.proxy.server.VelocityRegisteredServer;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.util.ArrayList; import java.util.ArrayList;

Datei anzeigen

@ -26,8 +26,13 @@ import com.velocitypowered.api.event.proxy.ListenerCloseEvent;
import com.velocitypowered.api.network.ListenerType; import com.velocitypowered.api.network.ListenerType;
import com.velocitypowered.natives.util.Natives; import com.velocitypowered.natives.util.Natives;
import com.velocitypowered.proxy.VelocityServer; import com.velocitypowered.proxy.VelocityServer;
import com.velocitypowered.proxy.network.netty.SeparatePoolInetNameResolver; import com.velocitypowered.proxy.network.pipeline.initializers.BackendChannelInitializer;
import com.velocitypowered.proxy.protocol.netty.GameSpyQueryHandler; import com.velocitypowered.proxy.network.pipeline.initializers.BackendChannelInitializerHolder;
import com.velocitypowered.proxy.network.pipeline.initializers.ServerChannelInitializer;
import com.velocitypowered.proxy.network.pipeline.initializers.ServerChannelInitializerHolder;
import com.velocitypowered.proxy.network.pipeline.query.GameSpyQueryHandler;
import com.velocitypowered.proxy.network.util.SeparatePoolInetNameResolver;
import com.velocitypowered.proxy.network.util.TransportType;
import io.netty.bootstrap.Bootstrap; import io.netty.bootstrap.Bootstrap;
import io.netty.bootstrap.ServerBootstrap; import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.Channel; import io.netty.channel.Channel;
@ -154,7 +159,7 @@ public final class ConnectionManager {
public void queryBind(final String hostname, final int port) { public void queryBind(final String hostname, final int port) {
InetSocketAddress address = new InetSocketAddress(hostname, port); InetSocketAddress address = new InetSocketAddress(hostname, port);
final Bootstrap bootstrap = new Bootstrap() final Bootstrap bootstrap = new Bootstrap()
.channelFactory(this.transportType.datagramChannelFactory) .channelFactory(this.transportType.getDatagramChannelFactory())
.group(this.workerGroup) .group(this.workerGroup)
.handler(new GameSpyQueryHandler(this.server)) .handler(new GameSpyQueryHandler(this.server))
.localAddress(address); .localAddress(address);

Datei anzeigen

@ -15,14 +15,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.netty; package com.velocitypowered.proxy.network.pipeline.compression;
import static com.velocitypowered.natives.util.MoreByteBufUtils.ensureCompatible; import static com.velocitypowered.natives.util.MoreByteBufUtils.ensureCompatible;
import static com.velocitypowered.natives.util.MoreByteBufUtils.preferredBuffer; import static com.velocitypowered.natives.util.MoreByteBufUtils.preferredBuffer;
import static com.velocitypowered.proxy.protocol.util.NettyPreconditions.checkFrame; import static com.velocitypowered.proxy.network.protocol.util.NettyPreconditions.checkFrame;
import com.velocitypowered.natives.compression.VelocityCompressor; import com.velocitypowered.natives.compression.VelocityCompressor;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageDecoder; import io.netty.handler.codec.MessageToMessageDecoder;

Datei anzeigen

@ -15,13 +15,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.netty; package com.velocitypowered.proxy.network.pipeline.compression;
import static com.velocitypowered.proxy.protocol.netty.MinecraftVarintLengthEncoder.IS_JAVA_CIPHER; import static com.velocitypowered.proxy.network.pipeline.framing.MinecraftVarintLengthEncoder.IS_JAVA_CIPHER;
import com.velocitypowered.natives.compression.VelocityCompressor; import com.velocitypowered.natives.compression.VelocityCompressor;
import com.velocitypowered.natives.util.MoreByteBufUtils; import com.velocitypowered.natives.util.MoreByteBufUtils;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder; import io.netty.handler.codec.MessageToByteEncoder;

Datei anzeigen

@ -15,13 +15,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.netty; package com.velocitypowered.proxy.network.pipeline.deser;
import static com.velocitypowered.proxy.protocol.util.NettyPreconditions.checkFrame; import static com.velocitypowered.proxy.network.protocol.util.NettyPreconditions.checkFrame;
import com.velocitypowered.proxy.protocol.packet.LegacyHandshake; import com.velocitypowered.proxy.network.protocol.packet.LegacyHandshake;
import com.velocitypowered.proxy.protocol.packet.LegacyPing; import com.velocitypowered.proxy.network.protocol.packet.LegacyPing;
import com.velocitypowered.proxy.protocol.packet.legacyping.LegacyMinecraftPingVersion; import com.velocitypowered.proxy.network.protocol.packet.legacyping.LegacyMinecraftPingVersion;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder; import io.netty.handler.codec.ByteToMessageDecoder;

Datei anzeigen

@ -15,9 +15,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.netty; package com.velocitypowered.proxy.network.pipeline.deser;
import com.velocitypowered.proxy.protocol.packet.LegacyDisconnect; import com.velocitypowered.proxy.network.protocol.packet.LegacyDisconnect;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;

Datei anzeigen

@ -15,13 +15,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.netty; package com.velocitypowered.proxy.network.pipeline.deser;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.network.protocol.StateRegistry;
import com.velocitypowered.proxy.util.except.QuietRuntimeException; import com.velocitypowered.proxy.util.except.QuietRuntimeException;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;

Datei anzeigen

@ -15,13 +15,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.netty; package com.velocitypowered.proxy.network.pipeline.deser;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.network.protocol.StateRegistry;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder; import io.netty.handler.codec.MessageToByteEncoder;

Datei anzeigen

@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.netty; package com.velocitypowered.proxy.network.pipeline.encryption;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.velocitypowered.natives.encryption.VelocityCipher; import com.velocitypowered.natives.encryption.VelocityCipher;

Datei anzeigen

@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.netty; package com.velocitypowered.proxy.network.pipeline.encryption;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.velocitypowered.natives.encryption.VelocityCipher; import com.velocitypowered.natives.encryption.VelocityCipher;

Datei anzeigen

@ -15,9 +15,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.netty; package com.velocitypowered.proxy.network.pipeline.framing;
import com.velocitypowered.proxy.protocol.netty.VarintByteDecoder.DecodeResult; import com.velocitypowered.proxy.network.pipeline.framing.VarintByteDecoder.DecodeResult;
import com.velocitypowered.proxy.util.except.QuietDecoderException; import com.velocitypowered.proxy.util.except.QuietDecoderException;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;

Datei anzeigen

@ -15,11 +15,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.netty; package com.velocitypowered.proxy.network.pipeline.framing;
import com.velocitypowered.natives.encryption.JavaVelocityCipher; import com.velocitypowered.natives.encryption.JavaVelocityCipher;
import com.velocitypowered.natives.util.Natives; import com.velocitypowered.natives.util.Natives;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;

Datei anzeigen

@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.netty; package com.velocitypowered.proxy.network.pipeline.framing;
import io.netty.util.ByteProcessor; import io.netty.util.ByteProcessor;

Datei anzeigen

@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.network; package com.velocitypowered.proxy.network.pipeline.initializers;
import static com.velocitypowered.proxy.network.Connections.FLOW_HANDLER; import static com.velocitypowered.proxy.network.Connections.FLOW_HANDLER;
import static com.velocitypowered.proxy.network.Connections.FRAME_DECODER; import static com.velocitypowered.proxy.network.Connections.FRAME_DECODER;
@ -25,12 +25,12 @@ import static com.velocitypowered.proxy.network.Connections.MINECRAFT_ENCODER;
import static com.velocitypowered.proxy.network.Connections.READ_TIMEOUT; import static com.velocitypowered.proxy.network.Connections.READ_TIMEOUT;
import com.velocitypowered.proxy.VelocityServer; import com.velocitypowered.proxy.VelocityServer;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.pipeline.deser.MinecraftDecoder;
import com.velocitypowered.proxy.protocol.netty.AutoReadHolderHandler; import com.velocitypowered.proxy.network.pipeline.deser.MinecraftEncoder;
import com.velocitypowered.proxy.protocol.netty.MinecraftDecoder; import com.velocitypowered.proxy.network.pipeline.framing.MinecraftVarintFrameDecoder;
import com.velocitypowered.proxy.protocol.netty.MinecraftEncoder; import com.velocitypowered.proxy.network.pipeline.framing.MinecraftVarintLengthEncoder;
import com.velocitypowered.proxy.protocol.netty.MinecraftVarintFrameDecoder; import com.velocitypowered.proxy.network.pipeline.util.AutoReadHolderHandler;
import com.velocitypowered.proxy.protocol.netty.MinecraftVarintLengthEncoder; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelInitializer;
import io.netty.handler.timeout.ReadTimeoutHandler; import io.netty.handler.timeout.ReadTimeoutHandler;
@ -42,20 +42,25 @@ import java.util.concurrent.TimeUnit;
@SuppressWarnings("WeakerAccess") @SuppressWarnings("WeakerAccess")
public class BackendChannelInitializer extends ChannelInitializer<Channel> { public class BackendChannelInitializer extends ChannelInitializer<Channel> {
private final VelocityServer server; private final long readTimeoutMs;
public BackendChannelInitializer(VelocityServer server) { public BackendChannelInitializer(VelocityServer server) {
this.server = server; this(server.getConfiguration().getReadTimeout());
}
public BackendChannelInitializer(long readTimeoutMs) {
this.readTimeoutMs = readTimeoutMs;
} }
@Override @Override
protected void initChannel(Channel ch) throws Exception { protected void initChannel(Channel ch) throws Exception {
ch.pipeline() ch.pipeline().addLast(FRAME_DECODER, new MinecraftVarintFrameDecoder());
.addLast(FRAME_DECODER, new MinecraftVarintFrameDecoder()) if (this.readTimeoutMs > 0) {
.addLast(READ_TIMEOUT, ch.pipeline().addLast(READ_TIMEOUT, new ReadTimeoutHandler(
new ReadTimeoutHandler(server.getConfiguration().getReadTimeout(), this.readTimeoutMs, TimeUnit.MILLISECONDS));
TimeUnit.MILLISECONDS)) }
.addLast(FRAME_ENCODER, MinecraftVarintLengthEncoder.INSTANCE)
ch.pipeline().addLast(FRAME_ENCODER, MinecraftVarintLengthEncoder.INSTANCE)
.addLast(MINECRAFT_DECODER, .addLast(MINECRAFT_DECODER,
new MinecraftDecoder(ProtocolUtils.Direction.CLIENTBOUND)) new MinecraftDecoder(ProtocolUtils.Direction.CLIENTBOUND))
.addLast(FLOW_HANDLER, new AutoReadHolderHandler()) .addLast(FLOW_HANDLER, new AutoReadHolderHandler())

Datei anzeigen

@ -15,8 +15,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.network; package com.velocitypowered.proxy.network.pipeline.initializers;
import com.velocitypowered.proxy.network.ConnectionManager;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelInitializer;
import java.util.function.Supplier; import java.util.function.Supplier;
@ -31,7 +32,7 @@ public class BackendChannelInitializerHolder implements Supplier<ChannelInitiali
private static final Logger LOGGER = LogManager.getLogger(ConnectionManager.class); private static final Logger LOGGER = LogManager.getLogger(ConnectionManager.class);
private ChannelInitializer<Channel> initializer; private ChannelInitializer<Channel> initializer;
BackendChannelInitializerHolder(final ChannelInitializer<Channel> initializer) { public BackendChannelInitializerHolder(final ChannelInitializer<Channel> initializer) {
this.initializer = initializer; this.initializer = initializer;
} }

Datei anzeigen

@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.network; package com.velocitypowered.proxy.network.pipeline.initializers;
import static com.velocitypowered.proxy.network.Connections.FRAME_DECODER; import static com.velocitypowered.proxy.network.Connections.FRAME_DECODER;
import static com.velocitypowered.proxy.network.Connections.FRAME_ENCODER; import static com.velocitypowered.proxy.network.Connections.FRAME_ENCODER;
@ -28,14 +28,15 @@ import static com.velocitypowered.proxy.network.Connections.READ_TIMEOUT;
import com.velocitypowered.proxy.VelocityServer; import com.velocitypowered.proxy.VelocityServer;
import com.velocitypowered.proxy.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.MinecraftConnection;
import com.velocitypowered.proxy.connection.client.HandshakeSessionHandler; import com.velocitypowered.proxy.connection.client.HandshakeSessionHandler;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.Connections;
import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.network.pipeline.deser.LegacyPingDecoder;
import com.velocitypowered.proxy.protocol.netty.LegacyPingDecoder; import com.velocitypowered.proxy.network.pipeline.deser.LegacyPingEncoder;
import com.velocitypowered.proxy.protocol.netty.LegacyPingEncoder; import com.velocitypowered.proxy.network.pipeline.deser.MinecraftDecoder;
import com.velocitypowered.proxy.protocol.netty.MinecraftDecoder; import com.velocitypowered.proxy.network.pipeline.deser.MinecraftEncoder;
import com.velocitypowered.proxy.protocol.netty.MinecraftEncoder; import com.velocitypowered.proxy.network.pipeline.framing.MinecraftVarintFrameDecoder;
import com.velocitypowered.proxy.protocol.netty.MinecraftVarintFrameDecoder; import com.velocitypowered.proxy.network.pipeline.framing.MinecraftVarintLengthEncoder;
import com.velocitypowered.proxy.protocol.netty.MinecraftVarintLengthEncoder; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.network.protocol.StateRegistry;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelInitializer;
import io.netty.handler.codec.haproxy.HAProxyMessageDecoder; import io.netty.handler.codec.haproxy.HAProxyMessageDecoder;

Datei anzeigen

@ -15,8 +15,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.network; package com.velocitypowered.proxy.network.pipeline.initializers;
import com.velocitypowered.proxy.network.ConnectionManager;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelInitializer;
import java.util.function.Supplier; import java.util.function.Supplier;
@ -31,7 +32,7 @@ public class ServerChannelInitializerHolder implements Supplier<ChannelInitializ
private static final Logger LOGGER = LogManager.getLogger(ConnectionManager.class); private static final Logger LOGGER = LogManager.getLogger(ConnectionManager.class);
private ChannelInitializer<Channel> initializer; private ChannelInitializer<Channel> initializer;
ServerChannelInitializerHolder(final ChannelInitializer<Channel> initializer) { public ServerChannelInitializerHolder(final ChannelInitializer<Channel> initializer) {
this.initializer = initializer; this.initializer = initializer;
} }

Datei anzeigen

@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.netty; package com.velocitypowered.proxy.network.pipeline.query;
import static com.velocitypowered.api.event.query.ProxyQueryEvent.QueryType.BASIC; import static com.velocitypowered.api.event.query.ProxyQueryEvent.QueryType.BASIC;
import static com.velocitypowered.api.event.query.ProxyQueryEvent.QueryType.FULL; import static com.velocitypowered.api.event.query.ProxyQueryEvent.QueryType.FULL;

Datei anzeigen

@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.netty; package com.velocitypowered.proxy.network.pipeline.util;
import io.netty.channel.ChannelDuplexHandler; import io.netty.channel.ChannelDuplexHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;

Datei anzeigen

@ -15,12 +15,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.netty; package com.velocitypowered.proxy.network.pipeline.util;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.network.protocol.StateRegistry;
import io.netty.channel.ChannelDuplexHandler; import io.netty.channel.ChannelDuplexHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPromise; import io.netty.channel.ChannelPromise;

Datei anzeigen

@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol; package com.velocitypowered.proxy.network.pipeline.util;
/** /**
* Describes various events fired during the course of a connection. * Describes various events fired during the course of a connection.

Datei anzeigen

@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol; package com.velocitypowered.proxy.network.protocol;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;

Datei anzeigen

@ -15,17 +15,17 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol; package com.velocitypowered.proxy.network.protocol;
import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkArgument;
import static com.velocitypowered.proxy.protocol.util.NettyPreconditions.checkFrame; import static com.velocitypowered.proxy.network.protocol.util.NettyPreconditions.checkFrame;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.api.proxy.crypto.IdentifiedKey; import com.velocitypowered.api.proxy.crypto.IdentifiedKey;
import com.velocitypowered.api.util.GameProfile; import com.velocitypowered.api.util.GameProfile;
import com.velocitypowered.proxy.crypto.IdentifiedKeyImpl; import com.velocitypowered.proxy.crypto.IdentifiedKeyImpl;
import com.velocitypowered.proxy.protocol.netty.MinecraftDecoder; import com.velocitypowered.proxy.network.pipeline.deser.MinecraftDecoder;
import com.velocitypowered.proxy.protocol.util.VelocityLegacyHoverEventSerializer; import com.velocitypowered.proxy.network.protocol.util.VelocityLegacyHoverEventSerializer;
import com.velocitypowered.proxy.util.except.QuietDecoderException; import com.velocitypowered.proxy.util.except.QuietDecoderException;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufInputStream; import io.netty.buffer.ByteBufInputStream;

Datei anzeigen

@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol; package com.velocitypowered.proxy.network.protocol;
import static com.google.common.collect.Iterables.getLast; import static com.google.common.collect.Iterables.getLast;
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_12; import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_12;
@ -40,60 +40,58 @@ import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_9;
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_9_4; import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_9_4;
import static com.velocitypowered.api.network.ProtocolVersion.MINIMUM_VERSION; import static com.velocitypowered.api.network.ProtocolVersion.MINIMUM_VERSION;
import static com.velocitypowered.api.network.ProtocolVersion.SUPPORTED_VERSIONS; import static com.velocitypowered.api.network.ProtocolVersion.SUPPORTED_VERSIONS;
import static com.velocitypowered.proxy.protocol.ProtocolUtils.Direction;
import static com.velocitypowered.proxy.protocol.ProtocolUtils.Direction.CLIENTBOUND;
import static com.velocitypowered.proxy.protocol.ProtocolUtils.Direction.SERVERBOUND;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.protocol.packet.AvailableCommands; import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import com.velocitypowered.proxy.protocol.packet.BossBar; import com.velocitypowered.proxy.network.protocol.packet.AvailableCommands;
import com.velocitypowered.proxy.protocol.packet.ClientSettings; import com.velocitypowered.proxy.network.protocol.packet.BossBarPacket;
import com.velocitypowered.proxy.protocol.packet.Disconnect; import com.velocitypowered.proxy.network.protocol.packet.ClientSettings;
import com.velocitypowered.proxy.protocol.packet.EncryptionRequest; import com.velocitypowered.proxy.network.protocol.packet.Disconnect;
import com.velocitypowered.proxy.protocol.packet.EncryptionResponse; import com.velocitypowered.proxy.network.protocol.packet.EncryptionRequest;
import com.velocitypowered.proxy.protocol.packet.Handshake; import com.velocitypowered.proxy.network.protocol.packet.EncryptionResponse;
import com.velocitypowered.proxy.protocol.packet.HeaderAndFooter; import com.velocitypowered.proxy.network.protocol.packet.Handshake;
import com.velocitypowered.proxy.protocol.packet.JoinGame; import com.velocitypowered.proxy.network.protocol.packet.HeaderAndFooter;
import com.velocitypowered.proxy.protocol.packet.KeepAlive; import com.velocitypowered.proxy.network.protocol.packet.JoinGame;
import com.velocitypowered.proxy.protocol.packet.LegacyPlayerListItem; import com.velocitypowered.proxy.network.protocol.packet.KeepAlive;
import com.velocitypowered.proxy.protocol.packet.LoginAcknowledged; import com.velocitypowered.proxy.network.protocol.packet.LegacyPlayerListItem;
import com.velocitypowered.proxy.protocol.packet.LoginPluginMessage; import com.velocitypowered.proxy.network.protocol.packet.LoginAcknowledged;
import com.velocitypowered.proxy.protocol.packet.LoginPluginResponse; import com.velocitypowered.proxy.network.protocol.packet.LoginPluginMessage;
import com.velocitypowered.proxy.protocol.packet.PingIdentify; import com.velocitypowered.proxy.network.protocol.packet.LoginPluginResponse;
import com.velocitypowered.proxy.protocol.packet.PluginMessage; import com.velocitypowered.proxy.network.protocol.packet.PingIdentify;
import com.velocitypowered.proxy.protocol.packet.RemovePlayerInfo; import com.velocitypowered.proxy.network.protocol.packet.PluginMessage;
import com.velocitypowered.proxy.protocol.packet.ResourcePackRequest; import com.velocitypowered.proxy.network.protocol.packet.RemovePlayerInfo;
import com.velocitypowered.proxy.protocol.packet.ResourcePackResponse; import com.velocitypowered.proxy.network.protocol.packet.ResourcePackRequest;
import com.velocitypowered.proxy.protocol.packet.Respawn; import com.velocitypowered.proxy.network.protocol.packet.ResourcePackResponse;
import com.velocitypowered.proxy.protocol.packet.ServerData; import com.velocitypowered.proxy.network.protocol.packet.Respawn;
import com.velocitypowered.proxy.protocol.packet.ServerLogin; import com.velocitypowered.proxy.network.protocol.packet.ServerData;
import com.velocitypowered.proxy.protocol.packet.ServerLoginSuccess; import com.velocitypowered.proxy.network.protocol.packet.ServerLogin;
import com.velocitypowered.proxy.protocol.packet.SetCompression; import com.velocitypowered.proxy.network.protocol.packet.ServerLoginSuccess;
import com.velocitypowered.proxy.protocol.packet.StatusPing; import com.velocitypowered.proxy.network.protocol.packet.SetCompression;
import com.velocitypowered.proxy.protocol.packet.StatusRequest; import com.velocitypowered.proxy.network.protocol.packet.StatusPing;
import com.velocitypowered.proxy.protocol.packet.StatusResponse; import com.velocitypowered.proxy.network.protocol.packet.StatusRequest;
import com.velocitypowered.proxy.protocol.packet.TabCompleteRequest; import com.velocitypowered.proxy.network.protocol.packet.StatusResponse;
import com.velocitypowered.proxy.protocol.packet.TabCompleteResponse; import com.velocitypowered.proxy.network.protocol.packet.TabCompleteRequest;
import com.velocitypowered.proxy.protocol.packet.UpsertPlayerInfo; import com.velocitypowered.proxy.network.protocol.packet.TabCompleteResponse;
import com.velocitypowered.proxy.protocol.packet.chat.ChatAcknowledgement; import com.velocitypowered.proxy.network.protocol.packet.UpsertPlayerInfo;
import com.velocitypowered.proxy.protocol.packet.chat.PlayerChatCompletion; import com.velocitypowered.proxy.network.protocol.packet.chat.ChatAcknowledgement;
import com.velocitypowered.proxy.protocol.packet.chat.SystemChat; import com.velocitypowered.proxy.network.protocol.packet.chat.PlayerChatCompletion;
import com.velocitypowered.proxy.protocol.packet.chat.keyed.KeyedPlayerChat; import com.velocitypowered.proxy.network.protocol.packet.chat.SystemChat;
import com.velocitypowered.proxy.protocol.packet.chat.keyed.KeyedPlayerCommand; import com.velocitypowered.proxy.network.protocol.packet.chat.keyed.KeyedPlayerChat;
import com.velocitypowered.proxy.protocol.packet.chat.legacy.LegacyChat; import com.velocitypowered.proxy.network.protocol.packet.chat.keyed.KeyedPlayerCommand;
import com.velocitypowered.proxy.protocol.packet.chat.session.SessionPlayerChat; import com.velocitypowered.proxy.network.protocol.packet.chat.legacy.LegacyChat;
import com.velocitypowered.proxy.protocol.packet.chat.session.SessionPlayerCommand; import com.velocitypowered.proxy.network.protocol.packet.chat.session.SessionPlayerChat;
import com.velocitypowered.proxy.protocol.packet.config.ActiveFeatures; import com.velocitypowered.proxy.network.protocol.packet.chat.session.SessionPlayerCommand;
import com.velocitypowered.proxy.protocol.packet.config.FinishedUpdate; import com.velocitypowered.proxy.network.protocol.packet.config.ActiveFeatures;
import com.velocitypowered.proxy.protocol.packet.config.RegistrySync; import com.velocitypowered.proxy.network.protocol.packet.config.FinishedUpdate;
import com.velocitypowered.proxy.protocol.packet.config.StartUpdate; import com.velocitypowered.proxy.network.protocol.packet.config.RegistrySync;
import com.velocitypowered.proxy.protocol.packet.config.TagsUpdate; import com.velocitypowered.proxy.network.protocol.packet.config.StartUpdate;
import com.velocitypowered.proxy.protocol.packet.title.LegacyTitlePacket; import com.velocitypowered.proxy.network.protocol.packet.config.TagsUpdate;
import com.velocitypowered.proxy.protocol.packet.title.TitleActionbarPacket; import com.velocitypowered.proxy.network.protocol.packet.title.LegacyTitlePacket;
import com.velocitypowered.proxy.protocol.packet.title.TitleClearPacket; import com.velocitypowered.proxy.network.protocol.packet.title.TitleActionbarPacket;
import com.velocitypowered.proxy.protocol.packet.title.TitleSubtitlePacket; import com.velocitypowered.proxy.network.protocol.packet.title.TitleClearPacket;
import com.velocitypowered.proxy.protocol.packet.title.TitleTextPacket; import com.velocitypowered.proxy.network.protocol.packet.title.TitleSubtitlePacket;
import com.velocitypowered.proxy.protocol.packet.title.TitleTimesPacket; import com.velocitypowered.proxy.network.protocol.packet.title.TitleTextPacket;
import com.velocitypowered.proxy.network.protocol.packet.title.TitleTimesPacket;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import io.netty.util.collection.IntObjectHashMap; import io.netty.util.collection.IntObjectHashMap;
import io.netty.util.collection.IntObjectMap; import io.netty.util.collection.IntObjectMap;
@ -107,7 +105,9 @@ import java.util.Objects;
import java.util.function.Supplier; import java.util.function.Supplier;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
/** Registry of all Minecraft protocol states and the packets for each state. */ /**
* Registry of all Minecraft protocol states and the packets for each state.
*/
public enum StateRegistry { public enum StateRegistry {
HANDSHAKE { HANDSHAKE {
@ -262,8 +262,8 @@ public enum StateRegistry {
FinishedUpdate.class, FinishedUpdate::new, map(0x0B, MINECRAFT_1_20_2, false)); FinishedUpdate.class, FinishedUpdate::new, map(0x0B, MINECRAFT_1_20_2, false));
clientbound.register( clientbound.register(
BossBar.class, BossBarPacket.class,
BossBar::new, BossBarPacket::new,
map(0x0C, MINECRAFT_1_9, false), map(0x0C, MINECRAFT_1_9, false),
map(0x0D, MINECRAFT_1_15, false), map(0x0D, MINECRAFT_1_15, false),
map(0x0C, MINECRAFT_1_16, false), map(0x0C, MINECRAFT_1_16, false),
@ -550,15 +550,18 @@ public enum StateRegistry {
public static final int STATUS_ID = 1; public static final int STATUS_ID = 1;
public static final int LOGIN_ID = 2; public static final int LOGIN_ID = 2;
protected final PacketRegistry clientbound = new PacketRegistry(CLIENTBOUND, this); protected final PacketRegistry clientbound = new PacketRegistry(Direction.CLIENTBOUND, this);
protected final PacketRegistry serverbound = new PacketRegistry(SERVERBOUND, this); protected final PacketRegistry serverbound = new PacketRegistry(Direction.SERVERBOUND, this);
public StateRegistry.PacketRegistry.ProtocolRegistry getProtocolRegistry(Direction direction, public StateRegistry.PacketRegistry.ProtocolRegistry getProtocolRegistry(Direction direction,
ProtocolVersion version) { ProtocolVersion version) {
return (direction == SERVERBOUND ? serverbound : clientbound).getProtocolRegistry(version); return (direction == Direction.SERVERBOUND ? serverbound : clientbound).getProtocolRegistry(
version);
} }
/** Packet registry. */ /**
* Packet registry.
*/
public static class PacketRegistry { public static class PacketRegistry {
private final Direction direction; private final Direction direction;
@ -656,7 +659,9 @@ public enum StateRegistry {
} }
} }
/** Protocol registry. */ /**
* Protocol registry.
*/
public class ProtocolRegistry { public class ProtocolRegistry {
public final ProtocolVersion version; public final ProtocolVersion version;
@ -715,7 +720,9 @@ public enum StateRegistry {
} }
} }
/** Packet mapping. */ /**
* Packet mapping.
*/
public static final class PacketMapping { public static final class PacketMapping {
private final int id; private final int id;

Datei anzeigen

@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import com.google.common.base.MoreObjects; import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
@ -36,10 +36,10 @@ import com.mojang.brigadier.tree.RootCommandNode;
import com.velocitypowered.api.command.CommandSource; import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.protocol.ProtocolUtils.Direction; import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import com.velocitypowered.proxy.protocol.packet.brigadier.ArgumentPropertyRegistry; import com.velocitypowered.proxy.network.protocol.packet.brigadier.ArgumentPropertyRegistry;
import com.velocitypowered.proxy.util.collect.IdentityHashStrategy; import com.velocitypowered.proxy.util.collect.IdentityHashStrategy;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenCustomHashMap; import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenCustomHashMap;

Datei anzeigen

@ -15,17 +15,18 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import java.util.UUID; import java.util.UUID;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
public class BossBar implements MinecraftPacket { public class BossBarPacket implements MinecraftPacket {
public static final int ADD = 0; public static final int ADD = 0;
public static final int REMOVE = 1; public static final int REMOVE = 1;
@ -114,7 +115,7 @@ public class BossBar implements MinecraftPacket {
} }
@Override @Override
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { public void decode(ByteBuf buf, Direction direction, ProtocolVersion version) {
this.uuid = ProtocolUtils.readUuid(buf); this.uuid = ProtocolUtils.readUuid(buf);
this.action = ProtocolUtils.readVarInt(buf); this.action = ProtocolUtils.readVarInt(buf);
switch (action) { switch (action) {
@ -191,8 +192,8 @@ public class BossBar implements MinecraftPacket {
return handler.handle(this); return handler.handle(this);
} }
public static BossBar createRemovePacket(UUID id) { public static BossBarPacket createRemovePacket(UUID id) {
BossBar packet = new BossBar(); BossBarPacket packet = new BossBarPacket();
packet.setUuid(id); packet.setUuid(id);
packet.setAction(REMOVE); packet.setAction(REMOVE);
return packet; return packet;

Datei anzeigen

@ -15,18 +15,19 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import java.util.Objects; import java.util.Objects;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
public class ClientSettings implements MinecraftPacket { public class ClientSettings implements MinecraftPacket {
private @Nullable String locale; private @Nullable String locale;
private byte viewDistance; private byte viewDistance;
private int chatVisibility; private int chatVisibility;
@ -120,14 +121,14 @@ public class ClientSettings implements MinecraftPacket {
@Override @Override
public String toString() { public String toString() {
return "ClientSettings{" + "locale='" + locale + '\'' + ", viewDistance=" + viewDistance + return "ClientSettings{" + "locale='" + locale + '\'' + ", viewDistance=" + viewDistance
", chatVisibility=" + chatVisibility + ", chatColors=" + chatColors + ", skinParts=" + + ", chatVisibility=" + chatVisibility + ", chatColors=" + chatColors + ", skinParts="
skinParts + ", mainHand=" + mainHand + ", chatFilteringEnabled=" + chatFilteringEnabled + + skinParts + ", mainHand=" + mainHand + ", chatFilteringEnabled=" + chatFilteringEnabled
", clientListingAllowed=" + clientListingAllowed + '}'; + ", clientListingAllowed=" + clientListingAllowed + '}';
} }
@Override @Override
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { public void decode(ByteBuf buf, Direction direction, ProtocolVersion version) {
this.locale = ProtocolUtils.readString(buf, 16); this.locale = ProtocolUtils.readString(buf, 16);
this.viewDistance = buf.readByte(); this.viewDistance = buf.readByte();
this.chatVisibility = ProtocolUtils.readVarInt(buf); this.chatVisibility = ProtocolUtils.readVarInt(buf);

Datei anzeigen

@ -15,13 +15,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
@ -55,7 +56,7 @@ public class Disconnect implements MinecraftPacket {
} }
@Override @Override
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { public void decode(ByteBuf buf, Direction direction, ProtocolVersion version) {
reason = ProtocolUtils.readString(buf); reason = ProtocolUtils.readString(buf);
} }

Datei anzeigen

@ -15,14 +15,15 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import static com.velocitypowered.proxy.connection.VelocityConstants.EMPTY_BYTE_ARRAY; import static com.velocitypowered.proxy.connection.VelocityConstants.EMPTY_BYTE_ARRAY;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import java.util.Arrays; import java.util.Arrays;
@ -57,7 +58,7 @@ public class EncryptionRequest implements MinecraftPacket {
} }
@Override @Override
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { public void decode(ByteBuf buf, Direction direction, ProtocolVersion version) {
this.serverId = ProtocolUtils.readString(buf, 20); this.serverId = ProtocolUtils.readString(buf, 20);
if (version.compareTo(ProtocolVersion.MINECRAFT_1_8) >= 0) { if (version.compareTo(ProtocolVersion.MINECRAFT_1_8) >= 0) {

Datei anzeigen

@ -15,24 +15,23 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import static com.velocitypowered.proxy.connection.VelocityConstants.EMPTY_BYTE_ARRAY; import static com.velocitypowered.proxy.connection.VelocityConstants.EMPTY_BYTE_ARRAY;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.protocol.ProtocolUtils.Direction; import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import com.velocitypowered.proxy.util.except.QuietDecoderException; import com.velocitypowered.proxy.util.except.QuietDecoderException;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.Arrays; import java.util.Arrays;
import org.checkerframework.checker.nullness.qual.Nullable;
public class EncryptionResponse implements MinecraftPacket { public class EncryptionResponse implements MinecraftPacket {
private final static QuietDecoderException NO_SALT = new QuietDecoderException( private static final QuietDecoderException NO_SALT = new QuietDecoderException(
"Encryption response didn't contain salt"); "Encryption response didn't contain salt");
private byte[] sharedSecret = EMPTY_BYTE_ARRAY; private byte[] sharedSecret = EMPTY_BYTE_ARRAY;
@ -63,7 +62,7 @@ public class EncryptionResponse implements MinecraftPacket {
} }
@Override @Override
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { public void decode(ByteBuf buf, Direction direction, ProtocolVersion version) {
if (version.compareTo(ProtocolVersion.MINECRAFT_1_8) >= 0) { if (version.compareTo(ProtocolVersion.MINECRAFT_1_8) >= 0) {
this.sharedSecret = ProtocolUtils.readByteArray(buf, 128); this.sharedSecret = ProtocolUtils.readByteArray(buf, 128);

Datei anzeigen

@ -15,14 +15,15 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import static com.velocitypowered.proxy.connection.forge.legacy.LegacyForgeConstants.HANDSHAKE_HOSTNAME_TOKEN; import static com.velocitypowered.proxy.connection.forge.legacy.LegacyForgeConstants.HANDSHAKE_HOSTNAME_TOKEN;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
public class Handshake implements MinecraftPacket { public class Handshake implements MinecraftPacket {
@ -78,7 +79,7 @@ public class Handshake implements MinecraftPacket {
} }
@Override @Override
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion ignored) { public void decode(ByteBuf buf, Direction direction, ProtocolVersion ignored) {
int realProtocolVersion = ProtocolUtils.readVarInt(buf); int realProtocolVersion = ProtocolUtils.readVarInt(buf);
this.protocolVersion = ProtocolVersion.getProtocolVersion(realProtocolVersion); this.protocolVersion = ProtocolVersion.getProtocolVersion(realProtocolVersion);
this.serverAddress = ProtocolUtils.readString(buf, MAXIMUM_HOSTNAME_LENGTH); this.serverAddress = ProtocolUtils.readString(buf, MAXIMUM_HOSTNAME_LENGTH);

Datei anzeigen

@ -15,15 +15,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import static com.velocitypowered.proxy.protocol.ProtocolUtils.writeString;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
@ -54,14 +53,14 @@ public class HeaderAndFooter implements MinecraftPacket {
} }
@Override @Override
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { public void decode(ByteBuf buf, Direction direction, ProtocolVersion version) {
throw new UnsupportedOperationException("Decode is not implemented"); throw new UnsupportedOperationException("Decode is not implemented");
} }
@Override @Override
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { public void encode(ByteBuf buf, Direction direction, ProtocolVersion version) {
writeString(buf, header); ProtocolUtils.writeString(buf, header);
writeString(buf, footer); ProtocolUtils.writeString(buf, footer);
} }
@Override @Override

Datei anzeigen

@ -15,13 +15,15 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.connection.registry.DimensionInfo; import com.velocitypowered.proxy.connection.registry.DimensionInfo;
import com.velocitypowered.proxy.protocol.*; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import it.unimi.dsi.fastutil.Pair; import it.unimi.dsi.fastutil.Pair;
import net.kyori.adventure.nbt.BinaryTagIO; import net.kyori.adventure.nbt.BinaryTagIO;
@ -186,20 +188,20 @@ public class JoinGame implements MinecraftPacket {
@Override @Override
public String toString() { public String toString() {
return "JoinGame{" + "entityId=" + entityId + ", gamemode=" + gamemode + ", dimension=" + return "JoinGame{" + "entityId=" + entityId + ", gamemode=" + gamemode + ", dimension="
dimension + ", partialHashedSeed=" + partialHashedSeed + ", difficulty=" + difficulty + + dimension + ", partialHashedSeed=" + partialHashedSeed + ", difficulty=" + difficulty
", isHardcore=" + isHardcore + ", maxPlayers=" + maxPlayers + ", levelType='" + levelType + + ", isHardcore=" + isHardcore + ", maxPlayers=" + maxPlayers + ", levelType='" + levelType
'\'' + ", viewDistance=" + viewDistance + ", reducedDebugInfo=" + reducedDebugInfo + + '\'' + ", viewDistance=" + viewDistance + ", reducedDebugInfo=" + reducedDebugInfo
", showRespawnScreen=" + showRespawnScreen + ", doLimitedCrafting=" + doLimitedCrafting + + ", showRespawnScreen=" + showRespawnScreen + ", doLimitedCrafting=" + doLimitedCrafting
", levelNames=" + levelNames + ", registry='" + registry + '\'' + ", dimensionInfo='" + + ", levelNames=" + levelNames + ", registry='" + registry + '\'' + ", dimensionInfo='"
dimensionInfo + '\'' + ", currentDimensionData='" + currentDimensionData + '\'' + + dimensionInfo + '\'' + ", currentDimensionData='" + currentDimensionData + '\''
", previousGamemode=" + previousGamemode + ", simulationDistance=" + simulationDistance + + ", previousGamemode=" + previousGamemode + ", simulationDistance=" + simulationDistance
", lastDeathPosition='" + lastDeathPosition + '\'' + ", portalCooldown=" + portalCooldown + + ", lastDeathPosition='" + lastDeathPosition + '\'' + ", portalCooldown=" + portalCooldown
'}'; + '}';
} }
@Override @Override
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { public void decode(ByteBuf buf, Direction direction, ProtocolVersion version) {
if (version.compareTo(ProtocolVersion.MINECRAFT_1_20_2) >= 0) { if (version.compareTo(ProtocolVersion.MINECRAFT_1_20_2) >= 0) {
// haha funny, they made 1.20.2 more complicated // haha funny, they made 1.20.2 more complicated
this.decode1202Up(buf, version); this.decode1202Up(buf, version);
@ -311,8 +313,10 @@ public class JoinGame implements MinecraftPacket {
this.showRespawnScreen = buf.readBoolean(); this.showRespawnScreen = buf.readBoolean();
this.doLimitedCrafting = buf.readBoolean(); this.doLimitedCrafting = buf.readBoolean();
// CHECKSTYLE.OFF: VariableDeclarationUsageDistance - we can't pull this down, side effects
String dimensionIdentifier = ProtocolUtils.readString(buf); String dimensionIdentifier = ProtocolUtils.readString(buf);
String levelName = ProtocolUtils.readString(buf); String levelName = ProtocolUtils.readString(buf);
// CHECKSTYLE.ON: VariableDeclarationUsageDistance - we can't pull this down, side effects
this.partialHashedSeed = buf.readLong(); this.partialHashedSeed = buf.readLong();
this.gamemode = buf.readByte(); this.gamemode = buf.readByte();

Datei anzeigen

@ -15,12 +15,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
public class KeepAlive implements MinecraftPacket { public class KeepAlive implements MinecraftPacket {
@ -43,7 +44,7 @@ public class KeepAlive implements MinecraftPacket {
} }
@Override @Override
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { public void decode(ByteBuf buf, Direction direction, ProtocolVersion version) {
if (version.compareTo(ProtocolVersion.MINECRAFT_1_12_2) >= 0) { if (version.compareTo(ProtocolVersion.MINECRAFT_1_12_2) >= 0) {
randomId = buf.readLong(); randomId = buf.readLong();
} else if (version.compareTo(ProtocolVersion.MINECRAFT_1_8) >= 0) { } else if (version.compareTo(ProtocolVersion.MINECRAFT_1_8) >= 0) {

Datei anzeigen

@ -15,12 +15,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.velocitypowered.api.proxy.server.ServerPing; import com.velocitypowered.api.proxy.server.ServerPing;
import com.velocitypowered.api.proxy.server.ServerPing.Players; import com.velocitypowered.api.proxy.server.ServerPing.Players;
import com.velocitypowered.proxy.protocol.packet.legacyping.LegacyMinecraftPingVersion; import com.velocitypowered.proxy.network.protocol.packet.legacyping.LegacyMinecraftPingVersion;
import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;

Datei anzeigen

@ -15,23 +15,23 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
public class LegacyHandshake implements MinecraftPacket { public class LegacyHandshake implements MinecraftPacket {
@Override @Override
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { public void decode(ByteBuf buf, Direction direction, ProtocolVersion version) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override @Override
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { public void encode(ByteBuf buf, Direction direction, ProtocolVersion version) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }

Datei anzeigen

@ -15,13 +15,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import com.velocitypowered.proxy.protocol.packet.legacyping.LegacyMinecraftPingVersion; import com.velocitypowered.proxy.network.protocol.packet.legacyping.LegacyMinecraftPingVersion;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
@ -50,12 +50,12 @@ public class LegacyPing implements MinecraftPacket {
} }
@Override @Override
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { public void decode(ByteBuf buf, Direction direction, ProtocolVersion version) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override @Override
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { public void encode(ByteBuf buf, Direction direction, ProtocolVersion version) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }

Datei anzeigen

@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
@ -23,8 +23,9 @@ import com.velocitypowered.api.proxy.crypto.IdentifiedKey;
import com.velocitypowered.api.proxy.player.TabListEntry; import com.velocitypowered.api.proxy.player.TabListEntry;
import com.velocitypowered.api.util.GameProfile; import com.velocitypowered.api.util.GameProfile;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -60,7 +61,7 @@ public class LegacyPlayerListItem implements MinecraftPacket {
} }
@Override @Override
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { public void decode(ByteBuf buf, Direction direction, ProtocolVersion version) {
if (version.compareTo(ProtocolVersion.MINECRAFT_1_8) >= 0) { if (version.compareTo(ProtocolVersion.MINECRAFT_1_8) >= 0) {
action = ProtocolUtils.readVarInt(buf); action = ProtocolUtils.readVarInt(buf);
int length = ProtocolUtils.readVarInt(buf); int length = ProtocolUtils.readVarInt(buf);

Datei anzeigen

@ -15,28 +15,28 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
public class LoginAcknowledged implements MinecraftPacket { public class LoginAcknowledged implements MinecraftPacket {
@Override @Override
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, public void decode(ByteBuf buf, Direction direction,
ProtocolVersion protocolVersion) { ProtocolVersion protocolVersion) {
} }
@Override @Override
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, public void encode(ByteBuf buf, Direction direction,
ProtocolVersion protocolVersion) { ProtocolVersion protocolVersion) {
} }
@Override @Override
public int expectedMaxLength(ByteBuf buf, ProtocolUtils.Direction direction, public int expectedMaxLength(ByteBuf buf, Direction direction,
ProtocolVersion version) { ProtocolVersion version) {
return 0; return 0;
} }

Datei anzeigen

@ -15,13 +15,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.protocol.util.DeferredByteBufHolder; import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import com.velocitypowered.proxy.network.protocol.util.DeferredByteBufHolder;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
@ -62,7 +63,7 @@ public class LoginPluginMessage extends DeferredByteBufHolder implements Minecra
} }
@Override @Override
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { public void decode(ByteBuf buf, Direction direction, ProtocolVersion version) {
this.id = ProtocolUtils.readVarInt(buf); this.id = ProtocolUtils.readVarInt(buf);
this.channel = ProtocolUtils.readString(buf); this.channel = ProtocolUtils.readString(buf);
if (buf.isReadable()) { if (buf.isReadable()) {

Datei anzeigen

@ -15,13 +15,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.protocol.util.DeferredByteBufHolder; import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import com.velocitypowered.proxy.network.protocol.util.DeferredByteBufHolder;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
@ -67,7 +68,7 @@ public class LoginPluginResponse extends DeferredByteBufHolder implements Minecr
} }
@Override @Override
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { public void decode(ByteBuf buf, Direction direction, ProtocolVersion version) {
this.id = ProtocolUtils.readVarInt(buf); this.id = ProtocolUtils.readVarInt(buf);
this.success = buf.readBoolean(); this.success = buf.readBoolean();
if (buf.isReadable()) { if (buf.isReadable()) {

Datei anzeigen

@ -15,12 +15,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
public class PingIdentify implements MinecraftPacket { public class PingIdentify implements MinecraftPacket {
@ -33,12 +33,12 @@ public class PingIdentify implements MinecraftPacket {
} }
@Override @Override
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { public void decode(ByteBuf buf, Direction direction, ProtocolVersion version) {
id = buf.readInt(); id = buf.readInt();
} }
@Override @Override
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { public void encode(ByteBuf buf, Direction direction, ProtocolVersion version) {
buf.writeInt(id); buf.writeInt(id);
} }

Datei anzeigen

@ -15,15 +15,16 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import static com.velocitypowered.proxy.protocol.util.PluginMessageUtil.transformLegacyToModernChannel; import static com.velocitypowered.proxy.network.protocol.util.PluginMessageUtil.transformLegacyToModernChannel;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.protocol.util.DeferredByteBufHolder; import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import com.velocitypowered.proxy.network.protocol.util.DeferredByteBufHolder;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
@ -62,7 +63,7 @@ public class PluginMessage extends DeferredByteBufHolder implements MinecraftPac
} }
@Override @Override
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { public void decode(ByteBuf buf, Direction direction, ProtocolVersion version) {
this.channel = ProtocolUtils.readString(buf); this.channel = ProtocolUtils.readString(buf);
if (version.compareTo(ProtocolVersion.MINECRAFT_1_13) >= 0) { if (version.compareTo(ProtocolVersion.MINECRAFT_1_13) >= 0) {
this.channel = transformLegacyToModernChannel(this.channel); this.channel = transformLegacyToModernChannel(this.channel);

Datei anzeigen

@ -15,13 +15,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -48,7 +49,7 @@ public class RemovePlayerInfo implements MinecraftPacket {
} }
@Override @Override
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, public void decode(ByteBuf buf, Direction direction,
ProtocolVersion protocolVersion) { ProtocolVersion protocolVersion) {
int length = ProtocolUtils.readVarInt(buf); int length = ProtocolUtils.readVarInt(buf);
Collection<UUID> profilesToRemove = Lists.newArrayListWithCapacity(length); Collection<UUID> profilesToRemove = Lists.newArrayListWithCapacity(length);

Datei anzeigen

@ -15,25 +15,24 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.api.proxy.player.ResourcePackInfo; import com.velocitypowered.api.proxy.player.ResourcePackInfo;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.connection.player.VelocityResourcePackInfo; import com.velocitypowered.proxy.connection.player.VelocityResourcePackInfo;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.protocol.ProtocolUtils.Direction; import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil; import io.netty.buffer.ByteBufUtil;
import java.util.regex.Pattern;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.regex.Pattern;
public class ResourcePackRequest implements MinecraftPacket { public class ResourcePackRequest implements MinecraftPacket {
private @MonotonicNonNull String url; private @MonotonicNonNull String url;
@ -127,7 +126,7 @@ public class ResourcePackRequest implements MinecraftPacket {
@Override @Override
public String toString() { public String toString() {
return "ResourcePackRequest{" + "url='" + url + '\'' + ", hash='" + hash + '\'' + return "ResourcePackRequest{" + "url='" + url + '\'' + ", hash='" + hash + '\''
", isRequired=" + isRequired + ", prompt='" + prompt + '\'' + '}'; + ", isRequired=" + isRequired + ", prompt='" + prompt + '\'' + '}';
} }
} }

Datei anzeigen

@ -15,14 +15,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import com.velocitypowered.api.event.player.PlayerResourcePackStatusEvent.Status; import com.velocitypowered.api.event.player.PlayerResourcePackStatusEvent.Status;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.protocol.ProtocolUtils.Direction; import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;

Datei anzeigen

@ -15,13 +15,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.connection.registry.DimensionInfo; import com.velocitypowered.proxy.connection.registry.DimensionInfo;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import it.unimi.dsi.fastutil.Pair; import it.unimi.dsi.fastutil.Pair;
import net.kyori.adventure.nbt.BinaryTagIO; import net.kyori.adventure.nbt.BinaryTagIO;
@ -66,7 +67,8 @@ public class Respawn implements MinecraftPacket {
return new Respawn(joinGame.getDimension(), joinGame.getPartialHashedSeed(), return new Respawn(joinGame.getDimension(), joinGame.getPartialHashedSeed(),
joinGame.getDifficulty(), joinGame.getGamemode(), joinGame.getLevelType(), joinGame.getDifficulty(), joinGame.getGamemode(), joinGame.getLevelType(),
(byte) 0, joinGame.getDimensionInfo(), joinGame.getPreviousGamemode(), (byte) 0, joinGame.getDimensionInfo(), joinGame.getPreviousGamemode(),
joinGame.getCurrentDimensionData(), joinGame.getLastDeathPosition(), joinGame.getPortalCooldown()); joinGame.getCurrentDimensionData(), joinGame.getLastDeathPosition(),
joinGame.getPortalCooldown());
} }
public int getDimension() { public int getDimension() {
@ -159,7 +161,7 @@ public class Respawn implements MinecraftPacket {
} }
@Override @Override
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { public void decode(ByteBuf buf, Direction direction, ProtocolVersion version) {
String dimensionIdentifier = null; String dimensionIdentifier = null;
String levelName = null; String levelName = null;
if (version.compareTo(ProtocolVersion.MINECRAFT_1_16) >= 0) { if (version.compareTo(ProtocolVersion.MINECRAFT_1_16) >= 0) {

Datei anzeigen

@ -15,18 +15,19 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.api.util.Favicon; import com.velocitypowered.api.util.Favicon;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import net.kyori.adventure.text.Component;
import org.jetbrains.annotations.Nullable;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Base64; import java.util.Base64;
import net.kyori.adventure.text.Component;
import org.jetbrains.annotations.Nullable;
public class ServerData implements MinecraftPacket { public class ServerData implements MinecraftPacket {
@ -45,7 +46,7 @@ public class ServerData implements MinecraftPacket {
} }
@Override @Override
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, public void decode(ByteBuf buf, Direction direction,
ProtocolVersion protocolVersion) { ProtocolVersion protocolVersion) {
if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_19_4) >= 0 || buf.readBoolean()) { if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_19_4) >= 0 || buf.readBoolean()) {
this.description = ProtocolUtils.getJsonChatSerializer(protocolVersion) this.description = ProtocolUtils.getJsonChatSerializer(protocolVersion)
@ -55,7 +56,8 @@ public class ServerData implements MinecraftPacket {
String iconBase64; String iconBase64;
if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_19_4) >= 0) { if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_19_4) >= 0) {
byte[] iconBytes = ProtocolUtils.readByteArray(buf); byte[] iconBytes = ProtocolUtils.readByteArray(buf);
iconBase64 = "data:image/png;base64," + new String(Base64.getEncoder().encode(iconBytes), StandardCharsets.UTF_8); iconBase64 = "data:image/png;base64," + new String(Base64.getEncoder().encode(iconBytes),
StandardCharsets.UTF_8);
} else { } else {
iconBase64 = ProtocolUtils.readString(buf); iconBase64 = ProtocolUtils.readString(buf);
} }
@ -88,7 +90,8 @@ public class ServerData implements MinecraftPacket {
if (hasFavicon) { if (hasFavicon) {
if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_19_4) >= 0) { if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_19_4) >= 0) {
String cutIconBase64 = favicon.getBase64Url().substring("data:image/png;base64,".length()); String cutIconBase64 = favicon.getBase64Url().substring("data:image/png;base64,".length());
byte[] iconBytes = Base64.getDecoder().decode(cutIconBase64.getBytes(StandardCharsets.UTF_8)); byte[] iconBytes = Base64.getDecoder()
.decode(cutIconBase64.getBytes(StandardCharsets.UTF_8));
ProtocolUtils.writeByteArray(buf, iconBytes); ProtocolUtils.writeByteArray(buf, iconBytes);
} else { } else {
ProtocolUtils.writeString(buf, favicon.getBase64Url()); ProtocolUtils.writeString(buf, favicon.getBase64Url());

Datei anzeigen

@ -15,20 +15,19 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.api.proxy.crypto.IdentifiedKey; import com.velocitypowered.api.proxy.crypto.IdentifiedKey;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.protocol.ProtocolUtils.Direction; import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import com.velocitypowered.proxy.util.except.QuietDecoderException; import com.velocitypowered.proxy.util.except.QuietDecoderException;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.UUID; import java.util.UUID;
import org.checkerframework.checker.nullness.qual.Nullable;
public class ServerLogin implements MinecraftPacket { public class ServerLogin implements MinecraftPacket {

Datei anzeigen

@ -15,16 +15,16 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.api.util.GameProfile; import com.velocitypowered.api.util.GameProfile;
import com.velocitypowered.api.util.UuidUtils; import com.velocitypowered.api.util.UuidUtils;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
@ -75,7 +75,7 @@ public class ServerLoginSuccess implements MinecraftPacket {
} }
@Override @Override
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { public void decode(ByteBuf buf, Direction direction, ProtocolVersion version) {
if (version.compareTo(ProtocolVersion.MINECRAFT_1_19) >= 0) { if (version.compareTo(ProtocolVersion.MINECRAFT_1_19) >= 0) {
uuid = ProtocolUtils.readUuid(buf); uuid = ProtocolUtils.readUuid(buf);
} else if (version.compareTo(ProtocolVersion.MINECRAFT_1_16) >= 0) { } else if (version.compareTo(ProtocolVersion.MINECRAFT_1_16) >= 0) {

Datei anzeigen

@ -15,12 +15,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
public class SetCompression implements MinecraftPacket { public class SetCompression implements MinecraftPacket {
@ -50,7 +51,7 @@ public class SetCompression implements MinecraftPacket {
} }
@Override @Override
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { public void decode(ByteBuf buf, Direction direction, ProtocolVersion version) {
this.threshold = ProtocolUtils.readVarInt(buf); this.threshold = ProtocolUtils.readVarInt(buf);
} }

Datei anzeigen

@ -15,13 +15,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import com.velocitypowered.proxy.protocol.ProtocolUtils.Direction;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
public class StatusPing implements MinecraftPacket { public class StatusPing implements MinecraftPacket {
@ -29,12 +28,12 @@ public class StatusPing implements MinecraftPacket {
private long randomId; private long randomId;
@Override @Override
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { public void decode(ByteBuf buf, Direction direction, ProtocolVersion version) {
randomId = buf.readLong(); randomId = buf.readLong();
} }
@Override @Override
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { public void encode(ByteBuf buf, Direction direction, ProtocolVersion version) {
buf.writeLong(randomId); buf.writeLong(randomId);
} }

Datei anzeigen

@ -15,13 +15,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import com.velocitypowered.proxy.protocol.ProtocolUtils.Direction;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
public class StatusRequest implements MinecraftPacket { public class StatusRequest implements MinecraftPacket {
@ -33,12 +32,12 @@ public class StatusRequest implements MinecraftPacket {
} }
@Override @Override
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { public void decode(ByteBuf buf, Direction direction, ProtocolVersion version) {
// There is no additional data to decode. // There is no additional data to decode.
} }
@Override @Override
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { public void encode(ByteBuf buf, Direction direction, ProtocolVersion version) {
// There is no data to decode. // There is no data to decode.
} }

Datei anzeigen

@ -15,12 +15,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
@ -50,7 +51,7 @@ public class StatusResponse implements MinecraftPacket {
} }
@Override @Override
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { public void decode(ByteBuf buf, Direction direction, ProtocolVersion version) {
status = ProtocolUtils.readString(buf, Short.MAX_VALUE); status = ProtocolUtils.readString(buf, Short.MAX_VALUE);
} }

Datei anzeigen

@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_13; import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_13;
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_8; import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_8;
@ -24,8 +24,9 @@ import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_9;
import com.google.common.base.MoreObjects; import com.google.common.base.MoreObjects;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
@ -94,7 +95,7 @@ public class TabCompleteRequest implements MinecraftPacket {
} }
@Override @Override
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { public void decode(ByteBuf buf, Direction direction, ProtocolVersion version) {
if (version.compareTo(MINECRAFT_1_13) >= 0) { if (version.compareTo(MINECRAFT_1_13) >= 0) {
this.transactionId = ProtocolUtils.readVarInt(buf); this.transactionId = ProtocolUtils.readVarInt(buf);
this.command = ProtocolUtils.readString(buf, VANILLA_MAX_TAB_COMPLETE_LEN); this.command = ProtocolUtils.readString(buf, VANILLA_MAX_TAB_COMPLETE_LEN);

Datei anzeigen

@ -15,15 +15,16 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_13; import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_13;
import com.google.common.base.MoreObjects; import com.google.common.base.MoreObjects;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -76,7 +77,7 @@ public class TabCompleteResponse implements MinecraftPacket {
} }
@Override @Override
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { public void decode(ByteBuf buf, Direction direction, ProtocolVersion version) {
if (version.compareTo(MINECRAFT_1_13) >= 0) { if (version.compareTo(MINECRAFT_1_13) >= 0) {
this.transactionId = ProtocolUtils.readVarInt(buf); this.transactionId = ProtocolUtils.readVarInt(buf);
this.start = ProtocolUtils.readVarInt(buf); this.start = ProtocolUtils.readVarInt(buf);

Datei anzeigen

@ -15,14 +15,15 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.network.protocol.packet;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.api.util.GameProfile; import com.velocitypowered.api.util.GameProfile;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.network.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import com.velocitypowered.proxy.protocol.packet.chat.RemoteChatSession; import com.velocitypowered.proxy.network.protocol.ProtocolUtils.Direction;
import com.velocitypowered.proxy.network.protocol.packet.chat.RemoteChatSession;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -83,7 +84,7 @@ public class UpsertPlayerInfo implements MinecraftPacket {
} }
@Override @Override
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, public void decode(ByteBuf buf, Direction direction,
ProtocolVersion protocolVersion) { ProtocolVersion protocolVersion) {
Action[] actions = Action.class.getEnumConstants(); Action[] actions = Action.class.getEnumConstants();
byte[] bytes = new byte[-Math.floorDiv(-actions.length, 8)]; byte[] bytes = new byte[-Math.floorDiv(-actions.length, 8)];
@ -283,15 +284,15 @@ public class UpsertPlayerInfo implements MinecraftPacket {
@Override @Override
public String toString() { public String toString() {
return "Entry{" + return "Entry{"
"profileId=" + profileId + + "profileId=" + profileId
", profile=" + profile + + ", profile=" + profile
", listed=" + listed + + ", listed=" + listed
", latency=" + latency + + ", latency=" + latency
", gameMode=" + gameMode + + ", gameMode=" + gameMode
", displayName=" + displayName + + ", displayName=" + displayName
", chatSession=" + chatSession + + ", chatSession=" + chatSession
'}'; + '}';
} }
} }
} }

Datei anzeigen

@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet.brigadier; package com.velocitypowered.proxy.network.protocol.packet.brigadier;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;

Datei anzeigen

@ -15,20 +15,18 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet.brigadier; package com.velocitypowered.proxy.network.protocol.packet.brigadier;
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_19; import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_19;
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_19_3; import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_19_3;
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_19_4; import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_19_4;
import static com.velocitypowered.proxy.protocol.packet.brigadier.ArgumentIdentifier.id; import static com.velocitypowered.proxy.network.protocol.packet.brigadier.ArgumentIdentifier.id;
import static com.velocitypowered.proxy.protocol.packet.brigadier.ArgumentIdentifier.mapSet; import static com.velocitypowered.proxy.network.protocol.packet.brigadier.ArgumentIdentifier.mapSet;
import static com.velocitypowered.proxy.protocol.packet.brigadier.DoubleArgumentPropertySerializer.DOUBLE; import static com.velocitypowered.proxy.network.protocol.packet.brigadier.DoubleArgumentPropertySerializer.DOUBLE;
import static com.velocitypowered.proxy.protocol.packet.brigadier.EmptyArgumentPropertySerializer.EMPTY; import static com.velocitypowered.proxy.network.protocol.packet.brigadier.EmptyArgumentPropertySerializer.EMPTY;
import static com.velocitypowered.proxy.protocol.packet.brigadier.FloatArgumentPropertySerializer.FLOAT; import static com.velocitypowered.proxy.network.protocol.packet.brigadier.FloatArgumentPropertySerializer.FLOAT;
import static com.velocitypowered.proxy.protocol.packet.brigadier.IntegerArgumentPropertySerializer.INTEGER; import static com.velocitypowered.proxy.network.protocol.packet.brigadier.IntegerArgumentPropertySerializer.INTEGER;
import static com.velocitypowered.proxy.protocol.packet.brigadier.LongArgumentPropertySerializer.LONG; import static com.velocitypowered.proxy.network.protocol.packet.brigadier.ModArgumentPropertySerializer.MOD;
import static com.velocitypowered.proxy.protocol.packet.brigadier.ModArgumentPropertySerializer.MOD;
import static com.velocitypowered.proxy.protocol.packet.brigadier.StringArgumentPropertySerializer.STRING;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.mojang.brigadier.arguments.ArgumentType; import com.mojang.brigadier.arguments.ArgumentType;
@ -39,7 +37,7 @@ import com.mojang.brigadier.arguments.IntegerArgumentType;
import com.mojang.brigadier.arguments.LongArgumentType; import com.mojang.brigadier.arguments.LongArgumentType;
import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.arguments.StringArgumentType;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -191,8 +189,10 @@ public class ArgumentPropertyRegistry {
register(id("brigadier:double", mapSet(MINECRAFT_1_19, 2)), DoubleArgumentType.class, DOUBLE); register(id("brigadier:double", mapSet(MINECRAFT_1_19, 2)), DoubleArgumentType.class, DOUBLE);
register(id("brigadier:integer", mapSet(MINECRAFT_1_19, 3)), IntegerArgumentType.class, register(id("brigadier:integer", mapSet(MINECRAFT_1_19, 3)), IntegerArgumentType.class,
INTEGER); INTEGER);
register(id("brigadier:long", mapSet(MINECRAFT_1_19, 4)), LongArgumentType.class, LONG); register(id("brigadier:long", mapSet(MINECRAFT_1_19, 4)), LongArgumentType.class,
register(id("brigadier:string", mapSet(MINECRAFT_1_19, 5)), StringArgumentType.class, STRING); LongArgumentPropertySerializer.LONG);
register(id("brigadier:string", mapSet(MINECRAFT_1_19, 5)), StringArgumentType.class,
StringArgumentPropertySerializer.STRING);
empty(id("minecraft:entity", mapSet(MINECRAFT_1_19, 6)), ByteArgumentPropertySerializer.BYTE); empty(id("minecraft:entity", mapSet(MINECRAFT_1_19, 6)), ByteArgumentPropertySerializer.BYTE);
empty(id("minecraft:game_profile", mapSet(MINECRAFT_1_19, 7))); empty(id("minecraft:game_profile", mapSet(MINECRAFT_1_19, 7)));
@ -253,7 +253,8 @@ public class ArgumentPropertyRegistry {
empty(id("minecraft:template_rotation", mapSet(MINECRAFT_1_19, 46))); // 1.19 empty(id("minecraft:template_rotation", mapSet(MINECRAFT_1_19, 46))); // 1.19
empty(id("minecraft:heightmap", mapSet(MINECRAFT_1_19_4, 47))); // 1.19.4 empty(id("minecraft:heightmap", mapSet(MINECRAFT_1_19_4, 47))); // 1.19.4
empty(id("minecraft:uuid", mapSet(MINECRAFT_1_19_4, 48), mapSet(MINECRAFT_1_19, 47))); // added in 1.16 empty(id("minecraft:uuid", mapSet(MINECRAFT_1_19_4, 48),
mapSet(MINECRAFT_1_19, 47))); // added in 1.16
// Crossstitch support // Crossstitch support
register(id("crossstitch:mod_argument", mapSet(MINECRAFT_1_19, -256)), register(id("crossstitch:mod_argument", mapSet(MINECRAFT_1_19, -256)),

Datei anzeigen

@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet.brigadier; package com.velocitypowered.proxy.network.protocol.packet.brigadier;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;

Datei anzeigen

@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet.brigadier; package com.velocitypowered.proxy.network.protocol.packet.brigadier;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;

Datei anzeigen

@ -15,11 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet.brigadier; package com.velocitypowered.proxy.network.protocol.packet.brigadier;
import static com.velocitypowered.proxy.protocol.packet.brigadier.IntegerArgumentPropertySerializer.HAS_MAXIMUM;
import static com.velocitypowered.proxy.protocol.packet.brigadier.IntegerArgumentPropertySerializer.HAS_MINIMUM;
import static com.velocitypowered.proxy.protocol.packet.brigadier.IntegerArgumentPropertySerializer.getFlags;
import com.mojang.brigadier.arguments.DoubleArgumentType; import com.mojang.brigadier.arguments.DoubleArgumentType;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
@ -35,8 +31,10 @@ class DoubleArgumentPropertySerializer implements ArgumentPropertySerializer<Dou
@Override @Override
public DoubleArgumentType deserialize(ByteBuf buf, ProtocolVersion protocolVersion) { public DoubleArgumentType deserialize(ByteBuf buf, ProtocolVersion protocolVersion) {
byte flags = buf.readByte(); byte flags = buf.readByte();
double minimum = (flags & HAS_MINIMUM) != 0 ? buf.readDouble() : Double.MIN_VALUE; double minimum = (flags & IntegerArgumentPropertySerializer.HAS_MINIMUM) != 0 ? buf.readDouble()
double maximum = (flags & HAS_MAXIMUM) != 0 ? buf.readDouble() : Double.MAX_VALUE; : Double.MIN_VALUE;
double maximum = (flags & IntegerArgumentPropertySerializer.HAS_MAXIMUM) != 0 ? buf.readDouble()
: Double.MAX_VALUE;
return DoubleArgumentType.doubleArg(minimum, maximum); return DoubleArgumentType.doubleArg(minimum, maximum);
} }
@ -44,7 +42,7 @@ class DoubleArgumentPropertySerializer implements ArgumentPropertySerializer<Dou
public void serialize(DoubleArgumentType object, ByteBuf buf, ProtocolVersion protocolVersion) { public void serialize(DoubleArgumentType object, ByteBuf buf, ProtocolVersion protocolVersion) {
boolean hasMinimum = Double.compare(object.getMinimum(), Double.MIN_VALUE) != 0; boolean hasMinimum = Double.compare(object.getMinimum(), Double.MIN_VALUE) != 0;
boolean hasMaximum = Double.compare(object.getMaximum(), Double.MAX_VALUE) != 0; boolean hasMaximum = Double.compare(object.getMaximum(), Double.MAX_VALUE) != 0;
byte flag = getFlags(hasMinimum, hasMaximum); byte flag = IntegerArgumentPropertySerializer.getFlags(hasMinimum, hasMaximum);
buf.writeByte(flag); buf.writeByte(flag);
if (hasMinimum) { if (hasMinimum) {

Datei anzeigen

@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet.brigadier; package com.velocitypowered.proxy.network.protocol.packet.brigadier;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;

Datei anzeigen

@ -15,11 +15,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet.brigadier; package com.velocitypowered.proxy.network.protocol.packet.brigadier;
import static com.velocitypowered.proxy.protocol.packet.brigadier.IntegerArgumentPropertySerializer.HAS_MAXIMUM; import static com.velocitypowered.proxy.network.protocol.packet.brigadier.IntegerArgumentPropertySerializer.HAS_MAXIMUM;
import static com.velocitypowered.proxy.protocol.packet.brigadier.IntegerArgumentPropertySerializer.HAS_MINIMUM; import static com.velocitypowered.proxy.network.protocol.packet.brigadier.IntegerArgumentPropertySerializer.HAS_MINIMUM;
import static com.velocitypowered.proxy.protocol.packet.brigadier.IntegerArgumentPropertySerializer.getFlags; import static com.velocitypowered.proxy.network.protocol.packet.brigadier.IntegerArgumentPropertySerializer.getFlags;
import com.mojang.brigadier.arguments.FloatArgumentType; import com.mojang.brigadier.arguments.FloatArgumentType;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;

Datei anzeigen

@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet.brigadier; package com.velocitypowered.proxy.network.protocol.packet.brigadier;
import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.arguments.IntegerArgumentType;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;

Datei anzeigen

@ -15,11 +15,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet.brigadier; package com.velocitypowered.proxy.network.protocol.packet.brigadier;
import static com.velocitypowered.proxy.protocol.packet.brigadier.IntegerArgumentPropertySerializer.HAS_MAXIMUM; import static com.velocitypowered.proxy.network.protocol.packet.brigadier.IntegerArgumentPropertySerializer.HAS_MAXIMUM;
import static com.velocitypowered.proxy.protocol.packet.brigadier.IntegerArgumentPropertySerializer.HAS_MINIMUM; import static com.velocitypowered.proxy.network.protocol.packet.brigadier.IntegerArgumentPropertySerializer.HAS_MINIMUM;
import static com.velocitypowered.proxy.protocol.packet.brigadier.IntegerArgumentPropertySerializer.getFlags; import static com.velocitypowered.proxy.network.protocol.packet.brigadier.IntegerArgumentPropertySerializer.getFlags;
import com.mojang.brigadier.arguments.LongArgumentType; import com.mojang.brigadier.arguments.LongArgumentType;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;

Datei anzeigen

@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet.brigadier; package com.velocitypowered.proxy.network.protocol.packet.brigadier;
import com.mojang.brigadier.StringReader; import com.mojang.brigadier.StringReader;
import com.mojang.brigadier.arguments.ArgumentType; import com.mojang.brigadier.arguments.ArgumentType;

Datei anzeigen

@ -15,10 +15,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet.brigadier; package com.velocitypowered.proxy.network.protocol.packet.brigadier;
import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.network.protocol.ProtocolUtils;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;

Datei anzeigen

@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.velocitypowered.proxy.protocol.packet.brigadier; package com.velocitypowered.proxy.network.protocol.packet.brigadier;
import com.mojang.brigadier.StringReader; import com.mojang.brigadier.StringReader;
import com.mojang.brigadier.arguments.ArgumentType; import com.mojang.brigadier.arguments.ArgumentType;

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen