From 64ea90d25445e21d4f47aedb3d65949b1d323614 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Mon, 15 May 2023 01:20:45 -0400 Subject: [PATCH] Also make sure to use the latest ping serializer as well --- .../com/velocitypowered/proxy/VelocityServer.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java b/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java index 6d05258d7..c59c225fd 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java @@ -743,9 +743,18 @@ public class VelocityServer implements ProxyServer, ForwardingAudience { return bossBarManager; } + /** + * Returns a Gson instance for use in serializing server ping instances. + * + * @param version the protocol version in use + * @return the Gson instance + */ public static Gson getPingGsonInstance(ProtocolVersion version) { - return version.compareTo(ProtocolVersion.MINECRAFT_1_16) >= 0 ? POST_1_16_PING_SERIALIZER - : PRE_1_16_PING_SERIALIZER; + if (version == ProtocolVersion.UNKNOWN + || version.compareTo(ProtocolVersion.MINECRAFT_1_16) >= 0) { + return POST_1_16_PING_SERIALIZER; + } + return PRE_1_16_PING_SERIALIZER; } @Override