[#891] Empty world name no longer in Bungee sessions

This commit is contained in:
Rsl1122 2019-01-19 13:02:56 +02:00
parent 7f81b07f67
commit beebc4ca01
5 changed files with 13 additions and 5 deletions

View File

@ -78,7 +78,7 @@ public class PlayerOnlineListener implements Listener {
InetAddress address = player.getAddress().getAddress(); InetAddress address = player.getAddress().getAddress();
long time = System.currentTimeMillis(); 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); boolean gatheringGeolocations = config.isTrue(DataGatheringSettings.GEOLOCATIONS);
@ -114,7 +114,7 @@ public class PlayerOnlineListener implements Listener {
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
// Replaces the current session in the cache. // 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)); processing.submit(processors.info().playerPageUpdateProcessor(uuid));
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.WARN, this.getClass(), e); errorHandler.log(L.WARN, this.getClass(), e);

View File

@ -55,6 +55,7 @@ public class WorldTimes {
} }
private void addWorld(String worldName, String gameMode, long changeTime) { private void addWorld(String worldName, String gameMode, long changeTime) {
if (worldName == null || gameMode == null) return;
times.put(worldName, new GMTimes(gameMode, changeTime)); times.put(worldName, new GMTimes(gameMode, changeTime));
} }

View File

@ -85,6 +85,8 @@ public class WorldAliasSettings {
* @param world World name * @param world World name
*/ */
public void addWorld(String world) { public void addWorld(String world) {
Verify.isFalse(Verify.isEmpty(world), () -> new IllegalArgumentException("Attempted to save a world alias '" + world + "'"));
ConfigNode aliasSect = getAliasSection(); ConfigNode aliasSect = getAliasSection();
String previousValue = aliasSect.getString(world); String previousValue = aliasSect.getString(world);
@ -165,7 +167,7 @@ public class WorldAliasSettings {
} }
WorldTimes worldTimes = session.getUnsafe(SessionKeys.WORLD_TIMES); WorldTimes worldTimes = session.getUnsafe(SessionKeys.WORLD_TIMES);
if (!session.supports(SessionKeys.END)) { if (!session.supports(SessionKeys.END)) {
return "Current: " + aliases.get(worldTimes.getCurrentWorld()); return "Current: " + aliases.getOrDefault(worldTimes.getCurrentWorld(), "Unknown");
} }
Map<String, Long> playtimePerAlias = getPlaytimePerAlias(worldTimes); Map<String, Long> playtimePerAlias = getPlaytimePerAlias(worldTimes);

View File

@ -139,6 +139,11 @@ Formatting:
NoSeconds: 'MMM d YYYY, HH:mm' NoSeconds: 'MMM d YYYY, HH:mm'
JustClock: 'HH:mm:ss' 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. # 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 # Relative path will render to /plugins/Plan/path
# Make sure user running the server has write permissions to the path. # Make sure user running the server has write permissions to the path.

View File

@ -81,7 +81,7 @@ public class PlayerOnlineListener {
InetAddress address = player.getRemoteAddress().getAddress(); InetAddress address = player.getRemoteAddress().getAddress();
long time = System.currentTimeMillis(); 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); boolean gatheringGeolocations = config.isTrue(DataGatheringSettings.GEOLOCATIONS);
@ -117,7 +117,7 @@ public class PlayerOnlineListener {
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
// Replaces the current session in the cache. // 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)); processing.submit(processors.info().playerPageUpdateProcessor(uuid));
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.WARN, this.getClass(), e); errorHandler.log(L.WARN, this.getClass(), e);