From adfea4bbc8bcc47f7b17c693421d9a426350dd5c 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 6b015db..e9439fe 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";