Class UserSettingsProvider
java.lang.Object
de.murmelmeister.murmelapi.user.settings.UserSettingsProvider
- All Implemented Interfaces:
UserSettings
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcreateTable(String tableName) voidcreateUser(int id) Creates a new user and checks if the user already exists.voiddeleteUser(int id) Deletes a user.booleanexistsUser(int id) Checks if a user exists.getFirstJoinDate(int id) Obtains the first join date of a user.longgetFirstJoinTime(int id) Obtains the first join time of a user.getLastQuitDate(int id) Retrieves the last quit date of a user identified by the given ID.longgetLastQuitTime(int id) Retrieves the last quit time of a user.intgetOnline(int id) Retrieves the online status of a user identified by the given ID.private voidloadTablesIfNotCreated(User user) voidsetLastQuitTime(int id, long time) Sets the last quit time for a user identified by the given ID.voidsetOnline(int id, int online) Sets the online status of a user identified by the given ID.
-
Field Details
-
dateFormat
-
-
Constructor Details
-
UserSettingsProvider
-
-
Method Details
-
createTable
-
existsUser
public boolean existsUser(int id) Description copied from interface:UserSettingsChecks if a user exists.- Specified by:
existsUserin interfaceUserSettings- Parameters:
id- The id of the user.- Returns:
- True if the user exists, otherwise false.
-
createUser
public void createUser(int id) Description copied from interface:UserSettingsCreates a new user and checks if the user already exists. If the user already exists, the method will return without creating a new user.- Specified by:
createUserin interfaceUserSettings- Parameters:
id- The id of the user.
-
deleteUser
public void deleteUser(int id) Description copied from interface:UserSettingsDeletes a user.- Specified by:
deleteUserin interfaceUserSettings- Parameters:
id- The id of the user.
-
getFirstJoinTime
public long getFirstJoinTime(int id) Description copied from interface:UserSettingsObtains the first join time of a user.- Specified by:
getFirstJoinTimein interfaceUserSettings- Parameters:
id- The id of the user.- Returns:
- The first join time of the user.
-
getFirstJoinDate
Description copied from interface:UserSettingsObtains the first join date of a user.- Specified by:
getFirstJoinDatein interfaceUserSettings- Parameters:
id- The id of the user.- Returns:
- The first join date of the user.
-
setLastQuitTime
public void setLastQuitTime(int id, long time) Description copied from interface:UserSettingsSets the last quit time for a user identified by the given ID. This method updates the last quit time of the user in the user settings database.- Specified by:
setLastQuitTimein interfaceUserSettings- Parameters:
id- The ID of the user.time- The last quit time to set for the user, represented as a long value.
-
getLastQuitTime
public long getLastQuitTime(int id) Description copied from interface:UserSettingsRetrieves the last quit time of a user.- Specified by:
getLastQuitTimein interfaceUserSettings- Parameters:
id- The id of the user.- Returns:
- The last quit time of the user as a long value.
-
getLastQuitDate
Description copied from interface:UserSettingsRetrieves the last quit date of a user identified by the given ID.- Specified by:
getLastQuitDatein interfaceUserSettings- Parameters:
id- The ID of the user.- Returns:
- The last quit date of the user as a string.
-
setOnline
public void setOnline(int id, int online) Description copied from interface:UserSettingsSets the online status of a user identified by the given ID. This method updates the online status of the user in the user settings database.- Specified by:
setOnlinein interfaceUserSettings- Parameters:
id- The ID of the user.online- The online status to set for the user, represented as a byte value.
-
getOnline
public int getOnline(int id) Description copied from interface:UserSettingsRetrieves the online status of a user identified by the given ID. This method retrieves the online status of the user from the user settings database.- Specified by:
getOnlinein interfaceUserSettings- Parameters:
id- The ID of the user.- Returns:
- The online status of the user as a boolean value. True indicates that the user is online, false indicates that the user is offline.
-
loadTablesIfNotCreated
-