From 3293f7a9eb7388fb9885739cdb667e5bd4359176 Mon Sep 17 00:00:00 2001 From: kyngs <38181667+kyngs@users.noreply.github.com> Date: Tue, 9 Aug 2022 21:03:03 +0200 Subject: [PATCH] Fix #828 (#829) Co-authored-by: kyngs --- .../com/velocitypowered/proxy/protocol/StateRegistry.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java index 173fa7610..7ccc0fe11 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java @@ -420,7 +420,9 @@ public enum StateRegistry { ProtocolVersion to = current == next ? lastValid != null ? lastValid : getLast(SUPPORTED_VERSIONS) : next.protocolVersion; - if (from.compareTo(to) >= 0 && from != getLast(SUPPORTED_VERSIONS)) { + ProtocolVersion lastInList = lastValid != null ? lastValid : getLast(SUPPORTED_VERSIONS); + + if (from.compareTo(to) >= 0 && from != lastInList) { throw new IllegalArgumentException(String.format( "Next mapping version (%s) should be lower then current (%s)", to, from)); }