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) Increments the play time for a user with the specified user ID by one unit.voidaddTime(int userId, PlayTimeType type, int time) Adds a specified amount of play time for a user based on the given play time type.voidcreateUser(int userId) Creates a user with the specified user ID in the playtime system.voiddeleteUser(int userId) Deletes a user with the specified user ID from the playtime system.booleanexistsUser(int userId) Checks if a user with the specified user ID exists in the playtime system.intgetTime(int userId) Retrieves the play time, in seconds, of a user identified by the specified user ID.voidremoveTime(int userId) Removes one unit of play time from the play time of the user with the specified user ID.voidremoveTime(int userId, PlayTimeType type, int time) Removes a specified amount of play time for a user with the given user ID and play time type.voidresetTime(int userId) Resets the playtime of a user with the specified user ID to zero.voidsetTime(int userId, int time) Sets the play time for a specific user.
-
Method Details
-
existsUser
boolean existsUser(int userId) Checks if a user with the specified user ID exists in the playtime system.- Parameters:
userId- The ID of the user to check for existence.- Returns:
trueif the user exists,falseotherwise.
-
createUser
void createUser(int userId) Creates a user with the specified user ID in the playtime system. If the user already exists, no action is taken.- Parameters:
userId- The ID of the user to create
-
deleteUser
void deleteUser(int userId) Deletes a user with the specified user ID from the playtime system.- Parameters:
userId- The ID of the user to delete
-
getTime
int getTime(int userId) Retrieves the play time, in seconds, of a user identified by the specified user ID.- Parameters:
userId- The ID of the user whose play time is being retrieved.- Returns:
- The play time of the user in seconds, or -1 if the user ID does not exist in the database.
-
setTime
void setTime(int userId, int time) Sets the play time for a specific user.- Parameters:
userId- The ID of the user whose play time is being set.time- The new play time value to set, specified in seconds.
-
addTime
void addTime(int userId) Increments the play time for a user with the specified user ID by one unit.- Parameters:
userId- The ID of the user whose play time will be incremented
-
addTime
Adds a specified amount of play time for a user based on the given play time type.- Parameters:
userId- The ID of the user whose play time will be increasedtype- The type of play time to be added (e.g., seconds, minutes, hours, etc.)time- The amount of play time to add, specified in the given play time type
-
removeTime
void removeTime(int userId) Removes one unit of play time from the play time of the user with the specified user ID.- Parameters:
userId- The ID of the user whose play time will be decreased by one unit
-
removeTime
Removes a specified amount of play time for a user with the given user ID and play time type.- Parameters:
userId- The ID of the user whose play time will be reducedtype- The type of play time to be removed (e.g., seconds, minutes, hours)time- The amount of time to be removed, specified in the given play time type
-
resetTime
void resetTime(int userId) Resets the playtime of a user with the specified user ID to zero.- Parameters:
userId- The ID of the user whose playtime is to be reset
-