diff --git a/Plan/common/src/main/java/com/djrapitops/plan/delivery/webserver/Addresses.java b/Plan/common/src/main/java/com/djrapitops/plan/delivery/webserver/Addresses.java index 7d3f4c9ab..f8d3cb757 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/delivery/webserver/Addresses.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/delivery/webserver/Addresses.java @@ -105,7 +105,7 @@ public class Addresses { } public Optional getProxyServerAddress() { - return dbSystem.getDatabase().query(ServerQueries.fetchProxyServers()) + return dbSystem.getDatabase().query(ServerQueries.fetchPlanServerInformationCollection()) .stream() .map(Server::getWebAddress) .filter(this::isValidAddress) @@ -113,7 +113,12 @@ public class Addresses { } private boolean isValidAddress(String address) { - return address != null && !address.isEmpty() && !"0.0.0.0".equals(address); + return address != null + && !address.isEmpty() + && !"0.0.0.0".equals(address) + && !"https://www.example.address".equals(address) + && !"http://www.example.address".equals(address) + && !"http://localhost:0".equals(address); } public Optional getServerPropertyIP() { diff --git a/Plan/common/src/main/java/com/djrapitops/plan/identification/ServerServerInfo.java b/Plan/common/src/main/java/com/djrapitops/plan/identification/ServerServerInfo.java index afc7a9b92..a7e51a593 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/identification/ServerServerInfo.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/identification/ServerServerInfo.java @@ -90,7 +90,7 @@ public class ServerServerInfo extends ServerInfo { } private void updateStorage() { - String address = addresses.getAccessAddress().orElseGet(addresses::getFallbackLocalhostAddress); + String address = getAddress(); String name = config.get(PluginSettings.SERVER_NAME); server.setName(name); @@ -101,6 +101,11 @@ public class ServerServerInfo extends ServerInfo { fromFile.save(server); } + private String getAddress() { + return addresses.getAccessAddress() + .orElse(addresses.isWebserverEnabled() ? addresses.getFallbackLocalhostAddress() : null); + } + private Server registerNew() { return registerNew(generateNewUUID()); } @@ -117,7 +122,7 @@ public class ServerServerInfo extends ServerInfo { } private Server createServerObject(ServerUUID serverUUID) { - String webAddress = addresses.getAccessAddress().orElseGet(addresses::getFallbackLocalhostAddress); + String webAddress = getAddress(); String name = config.get(PluginSettings.SERVER_NAME); return new Server(serverUUID, name, webAddress, currentVersion); }