1
0
mirror of https://github.com/mcMMO-Dev/mcMMO.git synced 2026-02-19 02:12:58 +01:00

Misc code fixes

This commit is contained in:
nossr50
2020-07-13 11:39:03 -07:00
parent 428c093ae4
commit 7eae59a0b3
153 changed files with 1139 additions and 1474 deletions

View File

@@ -12,19 +12,19 @@ import java.util.UUID;
public interface DatabaseManager {
// One month in milliseconds
public final long PURGE_TIME = 2630000000L * Config.getInstance().getOldUsersCutoff();
long PURGE_TIME = 2630000000L * Config.getInstance().getOldUsersCutoff();
// During convertUsers, how often to output a status
public final int progressInterval = 200;
int progressInterval = 200;
/**
* Purge users with 0 power level from the database.
*/
public void purgePowerlessUsers();
void purgePowerlessUsers();
/**
* Purge users who haven't logged on in over a certain time frame from the database.
*/
public void purgeOldUsers();
void purgeOldUsers();
/**
* Remove a user from the database.
@@ -33,14 +33,14 @@ public interface DatabaseManager {
* @param uuid player UUID, can be null
* @return true if the user was successfully removed, false otherwise
*/
public boolean removeUser(String playerName, UUID uuid);
boolean removeUser(String playerName, UUID uuid);
/**
* Removes any cache used for faster lookups
* Currently only used for SQL
* @param uuid target UUID to cleanup
*/
public void cleanupUser(UUID uuid);
void cleanupUser(UUID uuid);
/**
* Save a user to the database.
@@ -48,7 +48,7 @@ public interface DatabaseManager {
* @param profile The profile of the player to save
* @return true if successful, false on failure
*/
public boolean saveUser(PlayerProfile profile);
boolean saveUser(PlayerProfile profile);
/**
* Retrieve leaderboard info.
@@ -58,7 +58,7 @@ public interface DatabaseManager {
* @param statsPerPage The number of stats per page
* @return the requested leaderboard information
*/
public List<PlayerStat> readLeaderboard(PrimarySkillType skill, int pageNumber, int statsPerPage);
List<PlayerStat> readLeaderboard(PrimarySkillType skill, int pageNumber, int statsPerPage);
/**
* Retrieve rank info into a HashMap from PrimarySkillType to the rank.
@@ -69,7 +69,7 @@ public interface DatabaseManager {
* @param playerName The name of the user to retrieve the rankings for
* @return the requested rank information
*/
public Map<PrimarySkillType, Integer> readRank(String playerName);
Map<PrimarySkillType, Integer> readRank(String playerName);
/**
* Add a new user to the database.
@@ -77,7 +77,7 @@ public interface DatabaseManager {
* @param playerName The name of the player to be added to the database
* @param uuid The uuid of the player to be added to the database
*/
public void newUser(String playerName, UUID uuid);
void newUser(String playerName, UUID uuid);
/**
* Load a player from the database.
@@ -91,7 +91,7 @@ public interface DatabaseManager {
* and createNew is false
*/
@Deprecated
public PlayerProfile loadPlayerProfile(String playerName, boolean createNew);
PlayerProfile loadPlayerProfile(String playerName, boolean createNew);
/**
* Load a player from the database.
@@ -99,7 +99,7 @@ public interface DatabaseManager {
* @param uuid The uuid of the player to load from the database
* @return The player's data, or an unloaded PlayerProfile if not found
*/
public PlayerProfile loadPlayerProfile(UUID uuid);
PlayerProfile loadPlayerProfile(UUID uuid);
/**
* Load a player from the database. Attempt to use uuid, fall back on playername
@@ -111,14 +111,14 @@ public interface DatabaseManager {
* @return The player's data, or an unloaded PlayerProfile if not found
* and createNew is false
*/
public PlayerProfile loadPlayerProfile(String playerName, UUID uuid, boolean createNew);
PlayerProfile loadPlayerProfile(String playerName, UUID uuid, boolean createNew);
/**
* Get all users currently stored in the database.
*
* @return list of playernames
*/
public List<String> getStoredUsers();
List<String> getStoredUsers();
/**
* Convert all users from this database to the provided database using
@@ -126,21 +126,21 @@ public interface DatabaseManager {
*
* @param destination The DatabaseManager to save to
*/
public void convertUsers(DatabaseManager destination);
void convertUsers(DatabaseManager destination);
public boolean saveUserUUID(String userName, UUID uuid);
boolean saveUserUUID(String userName, UUID uuid);
public boolean saveUserUUIDs(Map<String, UUID> fetchedUUIDs);
boolean saveUserUUIDs(Map<String, UUID> fetchedUUIDs);
/**
* Retrieve the type of database in use. Custom databases should return CUSTOM.
*
* @return The type of database
*/
public DatabaseType getDatabaseType();
DatabaseType getDatabaseType();
/**
* Called when the plugin disables
*/
public void onDisable();
void onDisable();
}