Package de.murmelmeister.murmelapi.time
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) Adds one unit of play time to the play time of a user with the given user ID.voidaddTime(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.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.intgetTime(int userId) Obtains the time for the given user ID and play time type.voidremoveTime(int userId) Removes one unit of play time from the play time of a user specified with the given user ID.voidremoveTime(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.voidresetTime(int userId) Resets the play time for a user with the given user ID to zero.voidsetTime(int userId, int time) Sets the play time for a user with the specified user ID.
-
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
int getTime(int userId) Obtains the time for the given user ID and play time type.- Parameters:
userId- The ID of the user- Returns:
- the time for the given user ID and play time type
-
setTime
void setTime(int userId, int time) Sets the play time for a user with the specified user ID.- Parameters:
userId- The ID of the usertime- The play time to set for the user, in seconds
-
addTime
void addTime(int userId) Adds one unit of play time to the play time of a user with the given user ID.- Parameters:
userId- The ID of the user whose play time will be incremented by one unit
-
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
void removeTime(int userId) Removes one unit of play time from the play time of a user specified with the given user ID.- Parameters:
userId- The ID of the user whose play time will be decremented
-
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
void resetTime(int userId) Resets the play time for a user with the given user ID to zero.- Parameters:
userId- The ID of the user whose play time needs to be reset
-