Skip to content

Commit

Permalink
Support 1.20.5 spigot, update languages module, update Bungee depende…
Browse files Browse the repository at this point in the history
…ncy so the project builds (GeyserMC#498)
  • Loading branch information
onebeastchris authored Apr 27, 2024
1 parent 7f38765 commit 851ed5a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
4 changes: 2 additions & 2 deletions bungee/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var bungeeCommit = "master-SNAPSHOT"
var bungeeVersion = "1.20-R0.3-SNAPSHOT"
var gsonVersion = "2.8.0"
var guavaVersion = "21.0"

Expand All @@ -16,6 +16,6 @@ relocate("io.leangen.geantyref")
relocate("org.yaml")

// these dependencies are already present on the platform
provided("com.github.SpigotMC.BungeeCord", "bungeecord-proxy", bungeeCommit)
provided("net.md-5", "bungeecord-proxy", bungeeVersion)
provided("com.google.code.gson", "gson", gsonVersion)
provided("com.google.guava", "guava", guavaVersion)
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ protected Object setHostname(Object handshakePacket, String hostname) throws Ill
// 1.20.2 and above
try {
Object[] components = new Object[]{
ClassNames.HANDSHAKE_PORT.get(handshakePacket),
hostname,
ClassNames.HANDSHAKE_PROTOCOL.get(handshakePacket),
hostname,
ClassNames.HANDSHAKE_PORT.get(handshakePacket),
ClassNames.HANDSHAKE_INTENTION.get(handshakePacket)
};

Expand Down
17 changes: 13 additions & 4 deletions spigot/src/main/java/org/geysermc/floodgate/util/ClassNames.java
Original file line number Diff line number Diff line change
Expand Up @@ -293,14 +293,23 @@ public class ClassNames {
String.class, int.class, CLIENT_INTENT);
checkNotNull(HANDSHAKE_PACKET_CONSTRUCTOR, "Handshake packet constructor");

HANDSHAKE_PORT = getField(HANDSHAKE_PACKET, "a");
checkNotNull(HANDSHAKE_PORT, "Handshake port");
makeAccessible(HANDSHAKE_PORT);
Field a = getField(HANDSHAKE_PACKET, "a");
checkNotNull(a, "Handshake \"a\" field (protocol version, or stream codec)");

if (a.getType().isPrimitive()) { // 1.20.2 - 1.20.4: a is the protocol version (int)
HANDSHAKE_PROTOCOL = a;
HANDSHAKE_PORT = getField(HANDSHAKE_PACKET, "c");
} else { // 1.20.5: a is the stream_codec thing, so everything is shifted
HANDSHAKE_PROTOCOL = getField(HANDSHAKE_PACKET, "b");
HANDSHAKE_PORT = getField(HANDSHAKE_PACKET, "d");
}

HANDSHAKE_PROTOCOL = getField(HANDSHAKE_PACKET, "c");
checkNotNull(HANDSHAKE_PROTOCOL, "Handshake protocol");
makeAccessible(HANDSHAKE_PROTOCOL);

checkNotNull(HANDSHAKE_PORT, "Handshake port");
makeAccessible(HANDSHAKE_PORT);

HANDSHAKE_INTENTION = getFieldOfType(HANDSHAKE_PACKET, CLIENT_INTENT);
checkNotNull(HANDSHAKE_INTENTION, "Handshake intention");
makeAccessible(HANDSHAKE_INTENTION);
Expand Down

0 comments on commit 851ed5a

Please sign in to comment.