mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-30 12:44:45 +02:00
Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into configurable
This commit is contained in:
@ -30,9 +30,17 @@ public interface DatabaseManager {
|
||||
* Remove a user from the database.
|
||||
*
|
||||
* @param playerName The name of the user to remove
|
||||
* @param uuid player UUID, can be null
|
||||
* @return true if the user was successfully removed, false otherwise
|
||||
*/
|
||||
boolean removeUser(String playerName);
|
||||
public 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);
|
||||
|
||||
/**
|
||||
* Save a user to the database.
|
||||
|
@ -209,7 +209,8 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
mcMMO.p.getLogger().info("Purged " + removedPlayers + " users from the database.");
|
||||
}
|
||||
|
||||
public boolean removeUser(String playerName) {
|
||||
public boolean removeUser(String playerName, UUID uuid) {
|
||||
//NOTE: UUID is unused for FlatFile for this interface implementation
|
||||
boolean worked = false;
|
||||
|
||||
BufferedReader in = null;
|
||||
@ -260,6 +261,11 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
return worked;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanupUser(UUID uuid) {
|
||||
//Not used in FlatFile
|
||||
}
|
||||
|
||||
public boolean saveUser(PlayerProfile profile) {
|
||||
String playerName = profile.getPlayerName();
|
||||
UUID uuid = profile.getUniqueId();
|
||||
|
@ -176,7 +176,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
mcMMO.p.getLogger().info("Purged " + purged + " users from the database.");
|
||||
}
|
||||
|
||||
public boolean removeUser(String playerName) {
|
||||
public boolean removeUser(String playerName, UUID uuid) {
|
||||
boolean success = false;
|
||||
Connection connection = null;
|
||||
PreparedStatement statement = null;
|
||||
@ -202,12 +202,20 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
}
|
||||
|
||||
if (success) {
|
||||
if(uuid != null)
|
||||
cleanupUser(uuid);
|
||||
|
||||
Misc.profileCleanup(playerName);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
public void cleanupUser(UUID uuid) {
|
||||
if(cachedUserIDs.containsKey(uuid))
|
||||
cachedUserIDs.remove(uuid);
|
||||
}
|
||||
|
||||
public boolean saveUser(PlayerProfile profile) {
|
||||
boolean success = true;
|
||||
PreparedStatement statement = null;
|
||||
|
Reference in New Issue
Block a user