diff --git a/Plan/bungeecord/src/main/java/com/djrapitops/plan/system/listeners/bungee/PlayerOnlineListener.java b/Plan/bungeecord/src/main/java/com/djrapitops/plan/system/listeners/bungee/PlayerOnlineListener.java index d39cd9c8e..e59e35351 100644 --- a/Plan/bungeecord/src/main/java/com/djrapitops/plan/system/listeners/bungee/PlayerOnlineListener.java +++ b/Plan/bungeecord/src/main/java/com/djrapitops/plan/system/listeners/bungee/PlayerOnlineListener.java @@ -78,7 +78,7 @@ public class PlayerOnlineListener implements Listener { InetAddress address = player.getAddress().getAddress(); long time = System.currentTimeMillis(); - sessionCache.cacheSession(uuid, new Session(uuid, serverInfo.getServerUUID(), time, "", "")); + sessionCache.cacheSession(uuid, new Session(uuid, serverInfo.getServerUUID(), time, null, null)); boolean gatheringGeolocations = config.isTrue(DataGatheringSettings.GEOLOCATIONS); @@ -114,7 +114,7 @@ public class PlayerOnlineListener implements Listener { long time = System.currentTimeMillis(); // Replaces the current session in the cache. - sessionCache.cacheSession(uuid, new Session(uuid, serverInfo.getServerUUID(), time, "", "")); + sessionCache.cacheSession(uuid, new Session(uuid, serverInfo.getServerUUID(), time, null, null)); processing.submit(processors.info().playerPageUpdateProcessor(uuid)); } catch (Exception e) { errorHandler.log(L.WARN, this.getClass(), e); diff --git a/Plan/common/src/main/java/com/djrapitops/plan/data/time/WorldTimes.java b/Plan/common/src/main/java/com/djrapitops/plan/data/time/WorldTimes.java index 1ecc3b809..0424be87e 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/data/time/WorldTimes.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/data/time/WorldTimes.java @@ -55,6 +55,7 @@ public class WorldTimes { } private void addWorld(String worldName, String gameMode, long changeTime) { + if (worldName == null || gameMode == null) return; times.put(worldName, new GMTimes(gameMode, changeTime)); } diff --git a/Plan/common/src/main/java/com/djrapitops/plan/system/settings/config/WorldAliasSettings.java b/Plan/common/src/main/java/com/djrapitops/plan/system/settings/config/WorldAliasSettings.java index 5206f0f95..866af95c2 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/system/settings/config/WorldAliasSettings.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/system/settings/config/WorldAliasSettings.java @@ -85,6 +85,8 @@ public class WorldAliasSettings { * @param world World name */ public void addWorld(String world) { + Verify.isFalse(Verify.isEmpty(world), () -> new IllegalArgumentException("Attempted to save a world alias '" + world + "'")); + ConfigNode aliasSect = getAliasSection(); String previousValue = aliasSect.getString(world); @@ -165,7 +167,7 @@ public class WorldAliasSettings { } WorldTimes worldTimes = session.getUnsafe(SessionKeys.WORLD_TIMES); if (!session.supports(SessionKeys.END)) { - return "Current: " + aliases.get(worldTimes.getCurrentWorld()); + return "Current: " + aliases.getOrDefault(worldTimes.getCurrentWorld(), "Unknown"); } Map playtimePerAlias = getPlaytimePerAlias(worldTimes); diff --git a/Plan/common/src/main/resources/bungeeconfig.yml b/Plan/common/src/main/resources/bungeeconfig.yml index c439053fb..d5d2c4385 100644 --- a/Plan/common/src/main/resources/bungeeconfig.yml +++ b/Plan/common/src/main/resources/bungeeconfig.yml @@ -139,6 +139,11 @@ Formatting: NoSeconds: 'MMM d YYYY, HH:mm' JustClock: 'HH:mm:ss' # ----------------------------------------------------- +# World aliases can be used to rename worlds and to combine multiple worlds into a group. +# ----------------------------------------------------- +World_aliases: + world: world +# ----------------------------------------------------- # These settings will make Plan write .js, .css, .json and .html files to some location on disk. # Relative path will render to /plugins/Plan/path # Make sure user running the server has write permissions to the path. diff --git a/Plan/velocity/src/main/java/com/djrapitops/plan/system/listeners/velocity/PlayerOnlineListener.java b/Plan/velocity/src/main/java/com/djrapitops/plan/system/listeners/velocity/PlayerOnlineListener.java index e96dbf447..9019379bf 100644 --- a/Plan/velocity/src/main/java/com/djrapitops/plan/system/listeners/velocity/PlayerOnlineListener.java +++ b/Plan/velocity/src/main/java/com/djrapitops/plan/system/listeners/velocity/PlayerOnlineListener.java @@ -81,7 +81,7 @@ public class PlayerOnlineListener { InetAddress address = player.getRemoteAddress().getAddress(); long time = System.currentTimeMillis(); - sessionCache.cacheSession(uuid, new Session(uuid, serverInfo.getServerUUID(), time, "", "")); + sessionCache.cacheSession(uuid, new Session(uuid, serverInfo.getServerUUID(), time, null, null)); boolean gatheringGeolocations = config.isTrue(DataGatheringSettings.GEOLOCATIONS); @@ -117,7 +117,7 @@ public class PlayerOnlineListener { long now = System.currentTimeMillis(); // Replaces the current session in the cache. - sessionCache.cacheSession(uuid, new Session(uuid, serverInfo.getServerUUID(), now, "", "")); + sessionCache.cacheSession(uuid, new Session(uuid, serverInfo.getServerUUID(), now, null, null)); processing.submit(processors.info().playerPageUpdateProcessor(uuid)); } catch (Exception e) { errorHandler.log(L.WARN, this.getClass(), e);