diff --git a/Plan/src/main/java/com/djrapitops/plan/data/AnalysisData.java b/Plan/src/main/java/com/djrapitops/plan/data/AnalysisData.java index e43ba532c..118acfbba 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/AnalysisData.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/AnalysisData.java @@ -69,7 +69,7 @@ public class AnalysisData extends RawData { addValue("version", MiscUtils.getIPlan().getVersion()); addValue("worldPieColors", Theme.getValue(ThemeVal.GRAPH_WORLD_PIE)); addValue("gmPieColors", Theme.getValue(ThemeVal.GRAPH_GM_PIE)); - addValue("serverName", Settings.SERVER_NAME.toString()); + addValue("serverName", Settings.SERVER_NAME.toString().replaceAll("[^a-zA-Z0-9_\\s]", "_")); addValue("timeZone", MiscUtils.getTimeZoneOffsetHours()); addValue("refresh", FormatUtils.formatTimeStamp(refreshDate)); diff --git a/Plan/src/main/java/com/djrapitops/plan/systems/info/BukkitInformationManager.java b/Plan/src/main/java/com/djrapitops/plan/systems/info/BukkitInformationManager.java index 843482ab3..0206c1b67 100644 --- a/Plan/src/main/java/com/djrapitops/plan/systems/info/BukkitInformationManager.java +++ b/Plan/src/main/java/com/djrapitops/plan/systems/info/BukkitInformationManager.java @@ -155,7 +155,6 @@ public class BukkitInformationManager extends InformationManager { cacheInspectPluginsTab(uuid, origin); } } else { - String serverName = plugin.getServerInfoManager().getServerName(); HookHandler hookHandler = plugin.getHookHandler(); List plugins = hookHandler.getAdditionalDataSources(); Map containers = new HashMap<>(); diff --git a/Plan/src/main/java/com/djrapitops/plan/systems/info/parsing/InspectPageParser.java b/Plan/src/main/java/com/djrapitops/plan/systems/info/parsing/InspectPageParser.java index fb30f128a..8b946b95d 100644 --- a/Plan/src/main/java/com/djrapitops/plan/systems/info/parsing/InspectPageParser.java +++ b/Plan/src/main/java/com/djrapitops/plan/systems/info/parsing/InspectPageParser.java @@ -235,7 +235,7 @@ public class InspectPageParser extends PageParser { addValue("playerStatus", HtmlStructure.playerStatus(online, profile.getBannedOnServers(), profile.isOp())); if (!plugin.getInfoManager().isUsingAnotherWebServer()) { - addValue("networkName", Settings.SERVER_NAME.toString()); + addValue("networkName", Settings.SERVER_NAME.toString().replaceAll("[^a-zA-Z0-9_\\s]", "_")); } return HtmlUtils.replacePlaceholders(FileUtil.getStringFromResource("web/player.html"), placeHolders); diff --git a/Plan/src/main/java/com/djrapitops/plan/systems/info/server/BukkitServerInfoManager.java b/Plan/src/main/java/com/djrapitops/plan/systems/info/server/BukkitServerInfoManager.java index f1d57935c..170b2219f 100644 --- a/Plan/src/main/java/com/djrapitops/plan/systems/info/server/BukkitServerInfoManager.java +++ b/Plan/src/main/java/com/djrapitops/plan/systems/info/server/BukkitServerInfoManager.java @@ -59,7 +59,7 @@ public class BukkitServerInfoManager { registerServer(serverUUID); return; } - String name = Settings.SERVER_NAME.toString(); + String name = Settings.SERVER_NAME.toString().replaceAll("[^a-zA-Z0-9_\\s]", "_"); String webAddress = plugin.getWebServer().getAccessAddress(); if ("plan".equalsIgnoreCase(name)) { name = "Server " + serverID.get(); @@ -76,7 +76,7 @@ public class BukkitServerInfoManager { private void registerServer(UUID serverUUID) throws SQLException, IOException { String webAddress = plugin.getWebServer().getAccessAddress(); - String name = Settings.SERVER_NAME.toString(); + String name = Settings.SERVER_NAME.toString().replaceAll("[^a-zA-Z0-9_\\s]", "_"); int maxPlayers = plugin.getVariable().getMaxPlayers(); serverInfo = new ServerInfo(-1, serverUUID, name, webAddress, maxPlayers); serverTable.saveCurrentServerInfo(serverInfo); diff --git a/Plan/src/main/java/com/djrapitops/plan/systems/webserver/response/PlayersPageResponse.java b/Plan/src/main/java/com/djrapitops/plan/systems/webserver/response/PlayersPageResponse.java index 395ba018d..448849301 100644 --- a/Plan/src/main/java/com/djrapitops/plan/systems/webserver/response/PlayersPageResponse.java +++ b/Plan/src/main/java/com/djrapitops/plan/systems/webserver/response/PlayersPageResponse.java @@ -37,7 +37,7 @@ public class PlayersPageResponse extends Response { Collections.sort(names); Map replace = new HashMap<>(); if (Check.isBukkitAvailable()) { - replace.put("networkName", Settings.SERVER_NAME.toString()); + replace.put("networkName", Settings.SERVER_NAME.toString().replaceAll("[^a-zA-Z0-9_\\s]", "_")); } else { replace.put("networkName", Settings.BUNGEE_NETWORK_NAME.toString()); } diff --git a/Plan/src/main/java/com/djrapitops/plan/systems/webserver/webapi/bungee/PostOriginalBukkitSettingsWebAPI.java b/Plan/src/main/java/com/djrapitops/plan/systems/webserver/webapi/bungee/PostOriginalBukkitSettingsWebAPI.java index 05b0c8b7e..0f570a605 100644 --- a/Plan/src/main/java/com/djrapitops/plan/systems/webserver/webapi/bungee/PostOriginalBukkitSettingsWebAPI.java +++ b/Plan/src/main/java/com/djrapitops/plan/systems/webserver/webapi/bungee/PostOriginalBukkitSettingsWebAPI.java @@ -50,7 +50,7 @@ public class PostOriginalBukkitSettingsWebAPI extends WebAPI { @Override public void sendRequest(String address) throws WebAPIException { addVariable("WebServerPort", Integer.toString(Settings.WEBSERVER_PORT.getNumber())); - addVariable("ServerName", Settings.SERVER_NAME.toString()); + addVariable("ServerName", Settings.SERVER_NAME.toString().replaceAll("[^a-zA-Z0-9_\\s]", "_")); addVariable("ThemeBase", Settings.THEME_BASE.toString()); super.sendRequest(address); } diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/html/structure/ServerAccordionCreator.java b/Plan/src/main/java/com/djrapitops/plan/utilities/html/structure/ServerAccordionCreator.java index e9a766022..2bff72903 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/html/structure/ServerAccordionCreator.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/html/structure/ServerAccordionCreator.java @@ -38,9 +38,10 @@ public class ServerAccordionCreator { "", ""}; } + int i = 0; for (Map.Entry entry : worldTimesPerServer.entrySet()) { UUID serverUUID = entry.getKey(); - String serverName = serverNames.getOrDefault(serverUUID, "Unknown"); + String serverName = serverNames.getOrDefault(serverUUID, "Unknown"); WorldTimes worldTimes = entry.getValue(); List sessions = profile.getSessions(serverUUID); @@ -60,7 +61,8 @@ public class ServerAccordionCreator { String longest = sessionCount != 0 ? FormatUtils.formatTimeAmount(longestSession) : "-"; String sanitizedServerName = new Format(serverName) - .removeSymbols().removeWhitespace().toString(); + .removeSymbols() + .removeWhitespace().toString() + i; String htmlID = "server_" + sanitizedServerName; String worldId = "worldPieServer" + sanitizedServerName; @@ -116,6 +118,8 @@ public class ServerAccordionCreator { .append(worldId).append("series, ") .append(worldId).append("gmseries") .append(");"); + + i++; } return new String[]{html.append("").toString(), viewScript.toString()}; }