Class PlayTimeProvider

java.lang.Object
de.murmelmeister.murmelapi.time.PlayTimeProvider
All Implemented Interfaces:
PlayTime

public final class PlayTimeProvider extends Object implements PlayTime
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addTime(int userId)
    Adds one unit of play time to the play time of a user with the given user ID.
    void
    addTime(int userId, PlayTimeType type, int time)
    Adds the specified amount of time to the play time of a user with the given user ID and play time type.
    void
    createUser(int userId)
    Creates a new user with the given user ID.
    void
    deleteUser(int userId)
    Deletes a user with the given user ID from the database.
    boolean
    existsUser(int userId)
    Checks if a user with the given user ID exists.
    int
    getTime(int userId)
    Obtains the time for the given user ID and play time type.
    void
    removeTime(int userId)
    Removes one unit of play time from the play time of a user specified with the given user ID.
    void
    removeTime(int userId, PlayTimeType type, int time)
    Removes the specified amount of time from the play time of a user with the given user ID and play time type.
    void
    resetTime(int userId)
    Resets the play time for a user with the given user ID to zero.
    void
    setTime(int userId, int time)
    Sets the play time for a user with the specified user ID.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PlayTimeProvider

      public PlayTimeProvider(User user)
  • Method Details

    • existsUser

      public boolean existsUser(int userId)
      Description copied from interface: PlayTime
      Checks if a user with the given user ID exists.
      Specified by:
      existsUser in interface PlayTime
      Parameters:
      userId - The ID of the user to check
      Returns:
      true if a user with the given ID exists, false otherwise
    • createUser

      public void createUser(int userId)
      Description copied from interface: PlayTime
      Creates a new user with the given user ID.
      Specified by:
      createUser in interface PlayTime
      Parameters:
      userId - The ID of the user to create
    • deleteUser

      public void deleteUser(int userId)
      Description copied from interface: PlayTime
      Deletes a user with the given user ID from the database.
      Specified by:
      deleteUser in interface PlayTime
      Parameters:
      userId - The ID of the user to delete
    • getTime

      public int getTime(int userId)
      Description copied from interface: PlayTime
      Obtains the time for the given user ID and play time type.
      Specified by:
      getTime in interface PlayTime
      Parameters:
      userId - The ID of the user
      Returns:
      the time for the given user ID and play time type
    • setTime

      public void setTime(int userId, int time)
      Description copied from interface: PlayTime
      Sets the play time for a user with the specified user ID.
      Specified by:
      setTime in interface PlayTime
      Parameters:
      userId - The ID of the user
      time - The play time to set for the user, in seconds
    • addTime

      public void addTime(int userId)
      Description copied from interface: PlayTime
      Adds one unit of play time to the play time of a user with the given user ID.
      Specified by:
      addTime in interface PlayTime
      Parameters:
      userId - The ID of the user whose play time will be incremented by one unit
    • addTime

      public void addTime(int userId, PlayTimeType type, int time)
      Description copied from interface: PlayTime
      Adds the specified amount of time to the play time of a user with the given user ID and play time type.
      Specified by:
      addTime in interface PlayTime
      Parameters:
      userId - The ID of the user
      type - The type of play time
      time - The amount of time to add to the user's play time, in milliseconds
    • removeTime

      public void removeTime(int userId)
      Description copied from interface: PlayTime
      Removes one unit of play time from the play time of a user specified with the given user ID.
      Specified by:
      removeTime in interface PlayTime
      Parameters:
      userId - The ID of the user whose play time will be decremented
    • removeTime

      public void removeTime(int userId, PlayTimeType type, int time)
      Description copied from interface: PlayTime
      Removes the specified amount of time from the play time of a user with the given user ID and play time type.
      Specified by:
      removeTime in interface PlayTime
      Parameters:
      userId - The ID of the user
      type - The type of play time
      time - The amount of time to remove from the user's play time, in milliseconds
    • resetTime

      public void resetTime(int userId)
      Description copied from interface: PlayTime
      Resets the play time for a user with the given user ID to zero.
      Specified by:
      resetTime in interface PlayTime
      Parameters:
      userId - The ID of the user whose play time needs to be reset