Package de.murmelmeister.murmelapi.time
Class PlayTimeProvider
java.lang.Object
de.murmelmeister.murmelapi.time.PlayTimeProvider
- All Implemented Interfaces:
PlayTime
-
Constructor Summary
Constructors -
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.static void
-
Constructor Details
-
PlayTimeProvider
-
-
Method Details
-
setup
-
existsUser
public boolean existsUser(int userId) Description copied from interface:PlayTimeChecks if a user with the specified user ID exists in the playtime system.- Specified by:
existsUserin interfacePlayTime- Parameters:
userId- The ID of the user to check for existence.- Returns:
trueif the user exists,falseotherwise.
-
createUser
public void createUser(int userId) Description copied from interface:PlayTimeCreates a user with the specified user ID in the playtime system. If the user already exists, no action is taken.- Specified by:
createUserin interfacePlayTime- Parameters:
userId- The ID of the user to create
-
deleteUser
public void deleteUser(int userId) Description copied from interface:PlayTimeDeletes a user with the specified user ID from the playtime system.- Specified by:
deleteUserin interfacePlayTime- Parameters:
userId- The ID of the user to delete
-
getTime
public int getTime(int userId) Description copied from interface:PlayTimeRetrieves the play time, in seconds, of a user identified by the specified user ID. -
setTime
public void setTime(int userId, int time) Description copied from interface:PlayTimeSets the play time for a specific user. -
addTime
public void addTime(int userId) Description copied from interface:PlayTimeIncrements the play time for a user with the specified user ID by one unit. -
addTime
Description copied from interface:PlayTimeAdds a specified amount of play time for a user based on the given play time type. -
removeTime
public void removeTime(int userId) Description copied from interface:PlayTimeRemoves one unit of play time from the play time of the user with the specified user ID.- Specified by:
removeTimein interfacePlayTime- Parameters:
userId- The ID of the user whose play time will be decreased by one unit
-
removeTime
Description copied from interface:PlayTimeRemoves a specified amount of play time for a user with the given user ID and play time type.- Specified by:
removeTimein interfacePlayTime- 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
public void resetTime(int userId) Description copied from interface:PlayTimeResets the playtime of a user with the specified user ID to zero.
-