Interface PlayTime
- All Known Implementing Classes:
PlayTimeProvider
The PlayTime interface provides methods to manage and manipulate play time for users.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddTime(int userId, PlayTimeType type) Adds 1 unit of time to the play time of a user with the given user ID and play time type.voidaddTime(int userId, PlayTimeType type, long time) Adds the specified amount of time to the play time of a user with the given user ID and play time type.voidcreateUser(int userId) Creates a new user with the given user ID.voiddeleteUser(int userId) Deletes a user with the given user ID from the database.booleanexistsUser(int userId) Checks if a user with the given user ID exists.longgetTime(int userId, PlayTimeType type) Obtains the time for the given user ID and play time type.voidremoveTime(int userId, PlayTimeType type) Removes the play time for a user with the given user ID and play time type.voidremoveTime(int userId, PlayTimeType type, long time) Removes the specified amount of time from the play time of a user with the given user ID and play time type.voidresetTime(int userId, PlayTimeType type) Resets the play time for a user with the given user ID and play time type.voidsetTime(int userId, PlayTimeType type, long time) Sets the play time for a user with the given user ID and play time type.voidtimer(int userId) Starts a timer for the specified user.
-
Method Details
-
existsUser
boolean existsUser(int userId) Checks if a user with the given user ID exists.- Parameters:
userId- the ID of the user to check- Returns:
- true if a user with the given ID exists, false otherwise
-
createUser
void createUser(int userId) Creates a new user with the given user ID.- Parameters:
userId- the ID of the user to create
-
deleteUser
void deleteUser(int userId) Deletes a user with the given user ID from the database.- Parameters:
userId- the ID of the user to delete
-
getTime
Obtains the time for the given user ID and play time type.- Parameters:
userId- the ID of the usertype- the type of play time- Returns:
- the time for the given user ID and play time type
-
setTime
Sets the play time for a user with the given user ID and play time type.- Parameters:
userId- the ID of the usertype- the type of play timetime- the play time to set for the user
-
addTime
Adds 1 unit of time to the play time of a user with the given user ID and play time type.- Parameters:
userId- the ID of the usertype- the type of play time
-
addTime
Adds the specified amount of time to the play time of a user with the given user ID and play time type.- Parameters:
userId- the ID of the usertype- the type of play timetime- the amount of time to add to the user's play time, in milliseconds
-
removeTime
Removes the play time for a user with the given user ID and play time type.- Parameters:
userId- the ID of the usertype- the type of play time
-
removeTime
Removes the specified amount of time from the play time of a user with the given user ID and play time type.- Parameters:
userId- the ID of the usertype- the type of play timetime- the amount of time to remove from the user's play time, in milliseconds
-
resetTime
Resets the play time for a user with the given user ID and play time type.- Parameters:
userId- the ID of the usertype- the type of play time
-
timer
void timer(int userId) Starts a timer for the specified user.- Parameters:
userId- the ID of the user for whom to start the timer
-