Class Session
- java.lang.Object
-
- com.djrapitops.plan.delivery.domain.container.DynamicDataContainer
-
- com.djrapitops.plan.gathering.domain.Session
-
- All Implemented Interfaces:
DataContainer
,DateHolder
public class Session extends DynamicDataContainer implements DateHolder
DataContainer for information about a player's play session.- See Also:
for Key objects.
-
-
Constructor Summary
Constructors Constructor Description Session(int id, java.util.UUID uuid, java.util.UUID serverUUID, long sessionStart, long sessionEnd, int mobKills, int deaths, long afkTime)
Recreates a Session found in the database.Session(java.util.UUID uuid, java.util.UUID serverUUID, long sessionStart, java.lang.String world, java.lang.String gm)
Creates a new session based on a join event.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAFKTime(long timeAFK)
void
changeState(java.lang.String world, java.lang.String gm, long time)
Updates WorldTimes state.void
died()
void
endSession(long endOfSession)
Ends the session with given end point.boolean
equals(java.lang.Object o)
long
getDate()
Get the date the object holds.long
getLength()
Get the length of the session in milliseconds.java.util.List<PlayerKill>
getPlayerKills()
int
hashCode()
boolean
isFetchedFromDB()
boolean
isFirstSession()
void
mobKilled()
void
playerKilled(PlayerKill kill)
void
setAsFirstSessionIfMatches(java.lang.Long registerDate)
void
setPlayerKills(java.util.List<PlayerKill> playerKills)
void
setSessionID(int sessionID)
void
setWorldTimes(WorldTimes worldTimes)
java.lang.String
toString()
void
updateState()
-
Methods inherited from class com.djrapitops.plan.delivery.domain.container.DynamicDataContainer
clear, getMap, getUnsafe, getValue, putAll, putCachingSupplier, putRawData, putSupplier, supports
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.djrapitops.plan.delivery.domain.container.DataContainer
getFormatted, getFormattedUnsafe, handleList, handleMap, mapToNormalMap
-
-
-
-
Constructor Detail
-
Session
public Session(java.util.UUID uuid, java.util.UUID serverUUID, long sessionStart, java.lang.String world, java.lang.String gm)
Creates a new session based on a join event.- Parameters:
uuid
- UUID of the Player.serverUUID
- UUID of the server.sessionStart
- Epoch ms the session started.world
- Starting world.gm
- Starting GameMode.
-
Session
public Session(int id, java.util.UUID uuid, java.util.UUID serverUUID, long sessionStart, long sessionEnd, int mobKills, int deaths, long afkTime)
Recreates a Session found in the database.WorldTimes and Player kills need to be set separately.
- Parameters:
id
- ID in the database (Used for fetching world times and player kills.uuid
- UUID of the Player.serverUUID
- UUID of the Server.sessionStart
- Epoch ms the session started.sessionEnd
- Epoch ms the session ended.mobKills
- Mobs killed during the session.deaths
- Death count during the session.afkTime
- Time spent AFK during the session.
-
-
Method Detail
-
endSession
public void endSession(long endOfSession)
Ends the session with given end point.Updates world times to the latest value.
- Parameters:
endOfSession
- Epoch millisecond the session ended.
-
changeState
public void changeState(java.lang.String world, java.lang.String gm, long time)
Updates WorldTimes state.- Parameters:
world
- World Name the player has moved togm
- GameMode the player is in.time
- Epoch ms of the event.
-
playerKilled
public void playerKilled(PlayerKill kill)
-
mobKilled
public void mobKilled()
-
died
public void died()
-
getLength
public long getLength()
Get the length of the session in milliseconds.- Returns:
- Long in ms.
-
getDate
public long getDate()
Description copied from interface:DateHolder
Get the date the object holds.- Specified by:
getDate
in interfaceDateHolder
- Returns:
- Epoch ms - milliseconds passed since January 1st 1970.
-
setWorldTimes
public void setWorldTimes(WorldTimes worldTimes)
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
isFetchedFromDB
public boolean isFetchedFromDB()
-
addAFKTime
public void addAFKTime(long timeAFK)
-
setSessionID
public void setSessionID(int sessionID)
-
setAsFirstSessionIfMatches
public void setAsFirstSessionIfMatches(java.lang.Long registerDate)
-
isFirstSession
public boolean isFirstSession()
-
getPlayerKills
public java.util.List<PlayerKill> getPlayerKills()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
setPlayerKills
public void setPlayerKills(java.util.List<PlayerKill> playerKills)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
updateState
public void updateState()
-
-