From 7507789eb2882679fc871cd7d0e90947b98a270a Mon Sep 17 00:00:00 2001 From: Adrian Date: Sun, 28 Jul 2024 12:30:06 -0500 Subject: [PATCH] Fixed missing forced-hosts not allowing Velocity to start --- .../proxy/config/VelocityConfiguration.java | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java b/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java index 11c65d527..2beabeef1 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java @@ -186,18 +186,20 @@ public class VelocityConfiguration implements ProxyConfig { valid = false; } } - - for (Map.Entry> entry : forcedHosts.getForcedHosts().entrySet()) { - if (entry.getValue().isEmpty()) { - logger.error("Forced host '{}' does not contain any servers", entry.getKey()); - valid = false; - continue; - } - - for (String server : entry.getValue()) { - if (!servers.getServers().containsKey(server)) { - logger.error("Server '{}' for forced host '{}' does not exist", server, entry.getKey()); + final Map> configuredForcedHosts = forcedHosts.getForcedHosts(); + if (!configuredForcedHosts.isEmpty()) { + for (Map.Entry> entry : configuredForcedHosts.entrySet()) { + if (entry.getValue().isEmpty()) { + logger.error("Forced host '{}' does not contain any servers", entry.getKey()); valid = false; + continue; + } + + for (String server : entry.getValue()) { + if (!servers.getServers().containsKey(server)) { + logger.error("Server '{}' for forced host '{}' does not exist", server, entry.getKey()); + valid = false; + } } } } @@ -638,11 +640,7 @@ public class VelocityConfiguration implements ProxyConfig { private static class ForcedHosts { - private Map> forcedHosts = ImmutableMap.of( - "lobby.example.com", ImmutableList.of("lobby"), - "factions.example.com", ImmutableList.of("factions"), - "minigames.example.com", ImmutableList.of("minigames") - ); + private Map> forcedHosts = ImmutableMap.of(); private ForcedHosts() { }