public class Session extends DynamicDataContainer implements DateHolder
for Key objects.
Constructor and 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.
|
Modifier and Type | Method and 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() |
clear, getMap, getUnsafe, getValue, putAll, putCachingSupplier, putRawData, putSupplier, supports
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getFormatted, getFormattedUnsafe
public Session(java.util.UUID uuid, java.util.UUID serverUUID, long sessionStart, java.lang.String world, java.lang.String gm)
uuid
- UUID of the Player.serverUUID
- UUID of the server.sessionStart
- Epoch ms the session started.world
- Starting world.gm
- Starting GameMode.public Session(int id, java.util.UUID uuid, java.util.UUID serverUUID, long sessionStart, long sessionEnd, int mobKills, int deaths, long afkTime)
WorldTimes and Player kills need to be set separately.
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.public void endSession(long endOfSession)
Updates world times to the latest value.
endOfSession
- Epoch millisecond the session ended.public void changeState(java.lang.String world, java.lang.String gm, long time)
world
- World Name the player has moved togm
- GameMode the player is in.time
- Epoch ms of the event.public void playerKilled(PlayerKill kill)
public void mobKilled()
public void died()
public long getLength()
public long getDate()
DateHolder
getDate
in interface DateHolder
public void setWorldTimes(WorldTimes worldTimes)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public boolean isFetchedFromDB()
public void addAFKTime(long timeAFK)
public void setSessionID(int sessionID)
public void setAsFirstSessionIfMatches(java.lang.Long registerDate)
public boolean isFirstSession()
public java.util.List<PlayerKill> getPlayerKills()
public int hashCode()
hashCode
in class java.lang.Object
public void setPlayerKills(java.util.List<PlayerKill> playerKills)
public java.lang.String toString()
toString
in class java.lang.Object
public void updateState()