From e8179d7647cd5b89932e8148200e87069a7fa5be 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 945d9b9..8a9c254 100644 --- a/src/main/java/com/moulberry/axiom/packet/HelloPacketListener.java +++ b/src/main/java/com/moulberry/axiom/packet/HelloPacketListener.java @@ -49,6 +49,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; @@ -60,7 +67,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";