Compare commits

..
3 Commits
Author SHA1 Message Date
Jones 6ef7866893 Release 2.1.48 (#596) 2026-06-20 15:38:29 +02:00
Jones 90e7808d65 Add missing 26.2 server version 2026-06-20 15:35:14 +02:00
Jones 6c6c28f906 26.2 Support (#594)
* Implement 26.2 protocol version

* Implement 26.2 codec and tags

* Add `onlineMode` field to JoinGamePacket

* Add `sessionId` field to LoginSuccessPacket
2026-06-19 17:29:28 +02:00
11 changed files with 29 additions and 11 deletions

No files matched your search

-1
View File
@@ -22,4 +22,3 @@
# Common build-tool wrapper scripts ('.cmd' versions are handled by 'Common.gitattributes')
gradlew text eol=lf
.gitea/CODEOWNERS linguist-detectable=false
-3
View File
@@ -1,3 +0,0 @@
# Pull requests request review from the eligible staff team(s).
# One approval from either an Admin or Developer satisfies branch protection.
* @trueog/Admins @trueog/Developers
@@ -76,7 +76,8 @@ public enum ProtocolVersion {
MINECRAFT_1_21_7(772, "1.21.7"),
MINECRAFT_1_21_9(773, "1.21.9"),
MINECRAFT_1_21_11(774, "1.21.11"),
MINECRAFT_26_1(775, "26.1");
MINECRAFT_26_1(775, "26.1"),
MINECRAFT_26_2(776, "26.2");
private final int protocol;
private final String name;
@@ -82,7 +82,8 @@ public enum BukkitServerVersion {
MINECRAFT_1_21_9,
MINECRAFT_1_21_10,
MINECRAFT_1_21_11,
MINECRAFT_26_1;
MINECRAFT_26_1,
MINECRAFT_26_2;
static final BukkitServerVersion[] REVERSED_VALUES;
@@ -105,7 +105,9 @@ public class SonarPacketPreparer {
public final SonarPacket[] REGISTRY_SYNC_1_21_5 = RegistryDataPacket.of(DimensionRegistry.CODEC_1_21_5);
public final SonarPacket[] REGISTRY_SYNC_1_21_11 = RegistryDataPacket.of(DimensionRegistry.CODEC_1_21_11);
public final SonarPacket[] REGISTRY_SYNC_26_1 = RegistryDataPacket.of(DimensionRegistry.CODEC_26_1);
public final SonarPacket[] REGISTRY_SYNC_26_2 = RegistryDataPacket.of(DimensionRegistry.CODEC_26_2);
public final SonarPacket TAGS_UPDATE_26_1 = UpdateTagsPacket.of(DimensionRegistry.TAGS_26_1);
public final SonarPacket TAGS_UPDATE_26_2 = UpdateTagsPacket.of(DimensionRegistry.TAGS_26_2);
public final SonarPacket START_WRITING_CHUNKS = new GameEventPacket(13, 0);
public final static SonarPacket INVALID_HELD_ITEM_SLOT = new SetHeldItemPacket(-1);
public final SonarPacket RANDOM_KEEP_ALIVE = new SonarPacketSnapshot(new KeepAlivePacket(RANDOM.nextInt()));
@@ -152,7 +154,7 @@ public class SonarPacketPreparer {
if (username.length() > 16) {
username = username.substring(0, 16);
}
loginSuccess = new SonarPacketSnapshot(new LoginSuccessPacket(uuid, username, true));
loginSuccess = new SonarPacketSnapshot(new LoginSuccessPacket(uuid, username, true, UUID.randomUUID()));
// Prepare JoinGame packet
joinGame = new SonarPacketSnapshot(new JoinGamePacket(PLAYER_ENTITY_ID,
@@ -162,7 +164,7 @@ public class SonarPacketPreparer {
new String[]{"minecraft:overworld"}, "minecraft:overworld", "flat",
DimensionType.OVERWORLD, RANDOM.nextLong() & 1337,
false, true, false,
false, false, false, true));
false, false, false, true, false));
// Prepare the gravity check
maxMovementTick = Sonar.get0().getConfig().getVerification().getGravity().getMaxMovementTicks();
@@ -294,14 +296,18 @@ public class SonarPacketPreparer {
}
public static @Nullable SonarPacket getTagsPacket(final @NotNull ProtocolVersion protocolVersion) {
if (protocolVersion.greaterThanOrEquals(ProtocolVersion.MINECRAFT_26_1)) {
if (protocolVersion.greaterThanOrEquals(ProtocolVersion.MINECRAFT_26_2)) {
return TAGS_UPDATE_26_2;
} else if (protocolVersion.greaterThanOrEquals(ProtocolVersion.MINECRAFT_26_1)) {
return TAGS_UPDATE_26_1;
}
return null; // apparently doesn't crash the client; we're safe... for now.
}
public static SonarPacket[] getRegistryPackets(final @NotNull ProtocolVersion protocolVersion) {
if (protocolVersion.greaterThanOrEquals(ProtocolVersion.MINECRAFT_26_1)) {
if (protocolVersion.greaterThanOrEquals(ProtocolVersion.MINECRAFT_26_2)) {
return REGISTRY_SYNC_26_2;
} else if (protocolVersion.greaterThanOrEquals(ProtocolVersion.MINECRAFT_26_1)) {
return REGISTRY_SYNC_26_1;
} else if (protocolVersion.greaterThanOrEquals(ProtocolVersion.MINECRAFT_1_21_11)) {
return REGISTRY_SYNC_1_21_11;
@@ -42,7 +42,9 @@ public final class DimensionRegistry {
public final CompoundBinaryTag CODEC_1_21_5;
public final CompoundBinaryTag CODEC_1_21_11;
public final CompoundBinaryTag CODEC_26_1;
public final CompoundBinaryTag CODEC_26_2;
public final CompoundBinaryTag TAGS_26_1;
public final CompoundBinaryTag TAGS_26_2;
static {
CODEC_1_16 = getCodec("codec_1_16.nbt");
@@ -59,7 +61,9 @@ public final class DimensionRegistry {
CODEC_1_21_5 = getCodec("codec_1_21_5.nbt");
CODEC_1_21_11 = getCodec("codec_1_21_11.nbt");
CODEC_26_1 = getCodec("codec_26_1.nbt");
CODEC_26_2 = getCodec("codec_26_2.nbt");
TAGS_26_1 = getCodec("tags_26_1.nbt");
TAGS_26_2 = getCodec("tags_26_2.nbt");
}
private @NotNull CompoundBinaryTag getCodec(final @NotNull String fileName) {
@@ -38,6 +38,7 @@ public final class LoginSuccessPacket implements SonarPacket {
private UUID uuid;
private String username;
private boolean strictErrorHandling;
private UUID sessionId;
@Override
public void encode(final ByteBuf byteBuf, final @NotNull ProtocolVersion protocolVersion) throws Exception {
@@ -61,6 +62,10 @@ public final class LoginSuccessPacket implements SonarPacket {
// Whether the client should disconnect on its own if it receives invalid data from the server
byteBuf.writeBoolean(strictErrorHandling);
}
if (protocolVersion.greaterThanOrEquals(ProtocolVersion.MINECRAFT_26_2)) {
ProtocolUtil.writeUUID(byteBuf, sessionId);
}
}
@Override
@@ -58,6 +58,7 @@ public final class JoinGamePacket implements SonarPacket {
private boolean flat;
private boolean limitedCrafting;
private boolean secureProfile;
private boolean onlineMode;
@Override
public void encode(final @NotNull ByteBuf byteBuf, final @NotNull ProtocolVersion protocolVersion) throws Exception {
@@ -171,6 +172,10 @@ public final class JoinGamePacket implements SonarPacket {
if (protocolVersion.greaterThanOrEquals(ProtocolVersion.MINECRAFT_1_20_5)) {
byteBuf.writeBoolean(secureProfile);
}
if (protocolVersion.greaterThanOrEquals(ProtocolVersion.MINECRAFT_26_2)) {
byteBuf.writeBoolean(onlineMode);
}
}
private static CompoundBinaryTag getCodec(final @NotNull ProtocolVersion protocolVersion) {
+1 -1
View File
@@ -1,3 +1,3 @@
group=xyz.jonesdev
version=2.1.47
version=2.1.48
description=A lightweight, effective, and easy-to-use anti-bot plugin for Velocity, BungeeCord, and Bukkit.