Class PlayTimeProvider
java.lang.Object
de.murmelmeister.murmelapi.playtime.PlayTimeProvider
- All Implemented Interfaces:
PlayTime
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
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.private voidcreateTable(String tableName) 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.private voidloadTables(User user) 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.
-
Constructor Details
-
PlayTimeProvider
-
-
Method Details
-
createTable
-
existsUser
public boolean existsUser(int userId) Description copied from interface:PlayTimeChecks if a user with the given user ID exists.- Specified by:
existsUserin interfacePlayTime- 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:PlayTimeCreates a new user with the given user ID.- 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 given user ID from the database.- Specified by:
deleteUserin interfacePlayTime- Parameters:
userId- the ID of the user to delete
-
getTime
Description copied from interface:PlayTimeObtains the time for the given user ID and play time type. -
setTime
Description copied from interface:PlayTimeSets the play time for a user with the given user ID and play time type. -
addTime
Description copied from interface:PlayTimeAdds 1 unit of time to the play time of a user with the given user ID and play time type. -
addTime
Description copied from interface:PlayTimeAdds the specified amount of time to the play time of a user with the given user ID and play time type. -
removeTime
Description copied from interface:PlayTimeRemoves the play time for a user with the given user ID and play time type.- Specified by:
removeTimein interfacePlayTime- Parameters:
userId- the ID of the usertype- the type of play time
-
removeTime
Description copied from interface:PlayTimeRemoves the specified amount of time from the play time of a user with the given user ID and play time type.- Specified by:
removeTimein interfacePlayTime- 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
Description copied from interface:PlayTimeResets the play time for a user with the given user ID and play time type. -
timer
public void timer(int userId) Description copied from interface:PlayTimeStarts a timer for the specified user. -
loadTables
-