From ffa4c95435d1348d094d8a740ecae581c166f95b Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Sun, 1 Jan 2023 13:07:31 -0500 Subject: [PATCH] Fix GS4 query reloading logic Closes #915. This isn't a fatal error, but it's a clear papercut. --- .../java/com/velocitypowered/proxy/VelocityServer.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java b/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java index 9f0fe9a9..ac99d7cd 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java @@ -448,13 +448,14 @@ public class VelocityServer implements ProxyServer, ForwardingAudience { this.cm.close(configuration.getBind()); } - if (configuration.isQueryEnabled() && (!newConfiguration.isQueryEnabled() - || newConfiguration.getQueryPort() != configuration.getQueryPort())) { + boolean queryPortChanged = newConfiguration.getQueryPort() != configuration.getQueryPort(); + boolean queryAlreadyEnabled = configuration.isQueryEnabled(); + boolean queryEnabled = newConfiguration.isQueryEnabled(); + if ((!queryEnabled && queryAlreadyEnabled) || queryPortChanged) { this.cm.close(new InetSocketAddress( configuration.getBind().getHostString(), configuration.getQueryPort())); } - - if (newConfiguration.isQueryEnabled()) { + if (queryEnabled && queryPortChanged) { this.cm.queryBind(newConfiguration.getBind().getHostString(), newConfiguration.getQueryPort()); }