Class Session

    • 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 to
        gm - 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 interface DateHolder
        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 class java.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 class java.lang.Object
      • setPlayerKills

        public void setPlayerKills​(java.util.List<PlayerKill> playerKills)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • updateState

        public void updateState()