Class WorldTimes
java.lang.Object
com.djrapitops.plan.gathering.domain.WorldTimes
Class that tracks the time spent in each World based on GMTimes.
-
Constructor Summary
ConstructorsConstructorDescriptionWorldTimes(String startingWorld, String startingGM, long time) Creates a new Empty WorldTimes object.WorldTimes(Map<String, GMTimes> times) Re-Creates an existing WorldTimes object for viewing. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(WorldTimes toAdd) booleanbooleangetGMTimes(String world) Used for Quick access to time of each GameMode.longgetTotal()longgetWorldPlaytime(String world) Used to get a total playtime of a world.inthashCode()booleanisEmpty()voidsetAll(WorldTimes worldTimes) voidsetGMTimesForWorld(String world, GMTimes gmTimes) toJson()toString()voidupdateState(long changeTime) Updates the state at the end of the session.voidupdateState(String worldName, String gameMode, long changeTime) Updates the time status to match the new state.
-
Constructor Details
-
WorldTimes
Creates a new Empty WorldTimes object.- Parameters:
startingWorld- World to start the calculations at.startingGM- GameMode to start the calculations at.time- Epoch ms the time calculation should start
-
WorldTimes
Re-Creates an existing WorldTimes object for viewing.- Parameters:
times- Map of each World's GMTimes object.
-
WorldTimes
public WorldTimes()
-
-
Method Details
-
updateState
public void updateState(long changeTime) Updates the state at the end of the session. Does not change world or GameMode.- Parameters:
changeTime- epoch ms session ended.
-
updateState
Updates the time status to match the new state.- Parameters:
worldName- World name of the world swapped to.gameMode- GameMode name of the gm swapped to.changeTime- Epoch ms the change occurred.
-
getWorldPlaytime
Used to get a total playtime of a world.- Parameters:
world- World name being checked.- Returns:
- total milliseconds spent in a world.
-
getTotal
public long getTotal() -
getGMTimes
Used for Quick access to time of each GameMode.Should not be used for changing state, because if player has not played in the world, an empty GMTimes is given, with 0 as playtime
- Parameters:
world- World name being checked.- Returns:
- GMTimes object with play times of each GameMode.
-
getWorldTimes
-
setGMTimesForWorld
-
equals
-
hashCode
public int hashCode() -
toString
-
getCurrentWorld
-
add
-
contains
-
isEmpty
public boolean isEmpty() -
setAll
-
toJson
-