From 257f30b8681e49976949cdfaa6b7be796b7b0fe9 Mon Sep 17 00:00:00 2001 From: Moulberry Date: Fri, 16 Aug 2024 03:38:46 +0800 Subject: [PATCH] Normalize compatible data versions --- .../com/moulberry/axiom/packet/HelloPacketListener.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/moulberry/axiom/packet/HelloPacketListener.java b/src/main/java/com/moulberry/axiom/packet/HelloPacketListener.java index 9d52748..35c9320 100644 --- a/src/main/java/com/moulberry/axiom/packet/HelloPacketListener.java +++ b/src/main/java/com/moulberry/axiom/packet/HelloPacketListener.java @@ -51,6 +51,13 @@ public class HelloPacketListener implements PluginMessageListener { } } + private static int normalizeDataVersion(int dataVersion) { + if (dataVersion == 3955) { // 1.21.1 + return 3953; // 1.21 + } + return dataVersion; + } + private void process(Player player, byte[] message) { if (!this.plugin.hasAxiomPermission(player)) { return; @@ -62,7 +69,7 @@ public class HelloPacketListener implements PluginMessageListener { // note - skipping NBT here. friendlyByteBuf.readNBT(); int serverDataVersion = SharedConstants.getCurrentVersion().getDataVersion().getVersion(); - if (dataVersion != serverDataVersion) { + if (normalizeDataVersion(dataVersion) != normalizeDataVersion(serverDataVersion)) { String incompatibleDataVersion = plugin.configuration.getString("incompatible-data-version"); if (incompatibleDataVersion == null) incompatibleDataVersion = "warn";