Class GMTimes
- java.lang.Object
-
- com.djrapitops.plan.gathering.domain.TimeKeeper
-
- com.djrapitops.plan.gathering.domain.GMTimes
-
public class GMTimes extends TimeKeeper
TimeKeeper class that tracks the time spent in each GameMode based on Playtime.
-
-
Field Summary
-
Fields inherited from class com.djrapitops.plan.gathering.domain.TimeKeeper
lastStateChange, state, times
-
-
Constructor Summary
Constructors Constructor Description GMTimes()
GMTimes(java.lang.String lastState)
GMTimes(java.lang.String lastState, long lastStateChange)
GMTimes(java.util.Map<java.lang.String,java.lang.Long> times)
GMTimes(java.util.Map<java.lang.String,java.lang.Long> times, java.lang.String lastState, long lastStateChange)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.String[]
getGMKeyArray()
java.util.Optional<java.lang.String>
getMostUsedGameMode()
java.lang.String
getState()
static java.lang.String
magicNumberToGMName(int magicNumber)
void
resetTimes(long time)
void
setAllGMTimes(long... times)
Sets times for all 4 gamemodes.java.lang.String
toJson()
java.lang.String
toString()
-
Methods inherited from class com.djrapitops.plan.gathering.domain.TimeKeeper
addTime, changeState, equals, getLastStateChange, getTime, getTimes, getTotal, hashCode, renameState, resetState, resetState, setLastStateChange, setState, setTime, setTimes
-
-
-
-
Constructor Detail
-
GMTimes
public GMTimes(java.util.Map<java.lang.String,java.lang.Long> times, java.lang.String lastState, long lastStateChange)
-
GMTimes
public GMTimes(java.lang.String lastState, long lastStateChange)
-
GMTimes
public GMTimes(java.lang.String lastState)
-
GMTimes
public GMTimes(java.util.Map<java.lang.String,java.lang.Long> times)
-
GMTimes
public GMTimes()
-
-
Method Detail
-
getGMKeyArray
public static java.lang.String[] getGMKeyArray()
-
magicNumberToGMName
public static java.lang.String magicNumberToGMName(int magicNumber)
-
getMostUsedGameMode
public java.util.Optional<java.lang.String> getMostUsedGameMode()
-
setAllGMTimes
public void setAllGMTimes(long... times)
Sets times for all 4 gamemodes.Give 1 - 4 parameters. times starts from Survival, ends in Spectator.
Given too few parameters (Under 4, rest are set as 0L) Extra parameters are ignored (Over 4)
- Parameters:
times
- 1-4 time parameters.- Throws:
java.lang.IllegalArgumentException
- If any parameter is null.
-
resetTimes
public void resetTimes(long time)
-
getState
public java.lang.String getState()
- Overrides:
getState
in classTimeKeeper
-
toString
public java.lang.String toString()
- Overrides:
toString
in classTimeKeeper
-
toJson
public java.lang.String toJson()
-
-