Skip to content

Commit

Permalink
Add support for latest Velocity changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim203 committed Jan 18, 2024
1 parent 2876c57 commit 94eabd7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import static com.google.common.base.Preconditions.checkNotNull;
import static org.geysermc.floodgate.util.ReflectionUtils.getCastedValue;
import static org.geysermc.floodgate.util.ReflectionUtils.getClassOrFallbackPrefixed;
import static org.geysermc.floodgate.util.ReflectionUtils.getField;
import static org.geysermc.floodgate.util.ReflectionUtils.getMethodByName;
import static org.geysermc.floodgate.util.ReflectionUtils.getPrefixedClass;
Expand Down Expand Up @@ -63,7 +64,10 @@ public final class VelocityProxyDataHandler extends CommonDataHandler {
HANDSHAKE = getField(iic, "handshake");
checkNotNull(HANDSHAKE, "Handshake field cannot be null");

HANDSHAKE_PACKET = getPrefixedClass("protocol.packet.Handshake");
HANDSHAKE_PACKET = getClassOrFallbackPrefixed(
"protocol.packet.HandshakePacket",
"protocol.packet.Handshake"
);
checkNotNull(HANDSHAKE_PACKET, "Handshake packet class cannot be null");

HANDSHAKE_SERVER_ADDRESS = getField(HANDSHAKE_PACKET, "serverAddress");
Expand All @@ -73,7 +77,10 @@ public final class VelocityProxyDataHandler extends CommonDataHandler {
REMOTE_ADDRESS = getField(minecraftConnection, "remoteAddress");
checkNotNull(REMOTE_ADDRESS, "remoteAddress cannot be null");

SERVER_LOGIN_PACKET = getPrefixedClass("protocol.packet.ServerLogin");
SERVER_LOGIN_PACKET = getClassOrFallbackPrefixed(
"protocol.packet.ServerLoginPacket",
"protocol.packet.ServerLogin"
);
checkNotNull(SERVER_LOGIN_PACKET, "ServerLogin packet class cannot be null");


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import static com.google.common.base.Preconditions.checkNotNull;
import static org.geysermc.floodgate.util.ReflectionUtils.castedInvoke;
import static org.geysermc.floodgate.util.ReflectionUtils.getCastedValue;
import static org.geysermc.floodgate.util.ReflectionUtils.getClassOrFallbackPrefixed;
import static org.geysermc.floodgate.util.ReflectionUtils.getField;
import static org.geysermc.floodgate.util.ReflectionUtils.getMethod;
import static org.geysermc.floodgate.util.ReflectionUtils.getPrefixedClass;
Expand Down Expand Up @@ -55,7 +56,10 @@ public final class VelocityServerDataHandler extends ChannelOutboundHandlerAdapt
private static final Method GET_PLAYER;

static {
HANDSHAKE_PACKET = getPrefixedClass("protocol.packet.Handshake");
HANDSHAKE_PACKET = getClassOrFallbackPrefixed(
"protocol.packet.HandshakePacket",
"protocol.packet.Handshake"
);
checkNotNull(HANDSHAKE_PACKET, "Handshake packet class cannot be null");

HANDSHAKE_ADDRESS = getField(HANDSHAKE_PACKET, "serverAddress");
Expand Down

0 comments on commit 94eabd7

Please sign in to comment.