Skip to content

Commit

Permalink
Fixed missing forced-hosts not allowing Velocity to start
Browse files Browse the repository at this point in the history
  • Loading branch information
4drian3d committed Jul 28, 2024
1 parent 5146853 commit 7507789
Showing 1 changed file with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,18 +186,20 @@ public boolean validate() {
valid = false;
}
}

for (Map.Entry<String, List<String>> 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<String, List<String>> configuredForcedHosts = forcedHosts.getForcedHosts();
if (!configuredForcedHosts.isEmpty()) {
for (Map.Entry<String, List<String>> 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;
}
}
}
}
Expand Down Expand Up @@ -638,11 +640,7 @@ public String toString() {

private static class ForcedHosts {

private Map<String, List<String>> forcedHosts = ImmutableMap.of(
"lobby.example.com", ImmutableList.of("lobby"),
"factions.example.com", ImmutableList.of("factions"),
"minigames.example.com", ImmutableList.of("minigames")
);
private Map<String, List<String>> forcedHosts = ImmutableMap.of();

private ForcedHosts() {
}
Expand Down

0 comments on commit 7507789

Please sign in to comment.