diff --git a/Plan/src/main/java/com/djrapitops/plan/data/time/WorldTimes.java b/Plan/src/main/java/com/djrapitops/plan/data/time/WorldTimes.java index 5c2482e32..35040db40 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/time/WorldTimes.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/time/WorldTimes.java @@ -61,9 +61,11 @@ public class WorldTimes { } currentGMTimes.changeState(currentGamemode, changeTime); } + for (GMTimes gmTimes : worldTimes.values()) { gmTimes.setLastStateChange(changeTime); } + currentWorld = worldName; currentGamemode = gameMode; } @@ -76,10 +78,7 @@ public class WorldTimes { */ public long getWorldPlaytime(String world) { GMTimes gmTimes = worldTimes.get(world); - if (gmTimes != null) { - return gmTimes.getTotal(); - } - return 0; + return gmTimes != null ? gmTimes.getTotal() : 0; } public long getTotal() { @@ -99,11 +98,7 @@ public class WorldTimes { * @return GMTimes object with play times of each GameMode. */ public GMTimes getGMTimes(String world) { - GMTimes gmTimes = worldTimes.get(world); - if (gmTimes != null) { - return gmTimes; - } - return new GMTimes(); + return worldTimes.getOrDefault(world, new GMTimes()); } @Override