mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-29 16:46:46 +01:00
Fixed formatting!
This commit is contained in:
parent
7118f8850d
commit
7861e93497
@ -124,7 +124,7 @@ public interface DatabaseManager {
|
||||
|
||||
public boolean saveUserUUID(String userName, UUID uuid);
|
||||
|
||||
public boolean saveUserUUIDs(Map<String, UUID> user_info);
|
||||
public boolean saveUserUUIDs(Map<String, UUID> fetchedUUIDs);
|
||||
|
||||
/**
|
||||
* Retrieve the type of database in use. Custom databases should return CUSTOM.
|
||||
|
@ -540,8 +540,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
return worked;
|
||||
}
|
||||
|
||||
public boolean saveUserUUIDs(Map<String, UUID> user_data) {
|
||||
|
||||
public boolean saveUserUUIDs(Map<String, UUID> fetchedUUIDs) {
|
||||
BufferedReader in = null;
|
||||
FileWriter out = null;
|
||||
String usersFilePath = mcMMO.getUsersFilePath();
|
||||
@ -552,16 +551,16 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
StringBuilder writer = new StringBuilder();
|
||||
String line;
|
||||
|
||||
while (((line = in.readLine()) != null) && !user_data.isEmpty()) {
|
||||
while (((line = in.readLine()) != null) && !fetchedUUIDs.isEmpty()) {
|
||||
String[] character = line.split(":");
|
||||
if (user_data.containsKey(character[0])) {
|
||||
if (fetchedUUIDs.containsKey(character[0])) {
|
||||
if (character.length < 42) {
|
||||
mcMMO.p.getLogger().severe("Could not update UUID for " + character[0] + "!");
|
||||
mcMMO.p.getLogger().severe("Database entry is invalid.");
|
||||
return false;
|
||||
}
|
||||
|
||||
line = line.replace(character[41], user_data.remove(character[0]).toString());
|
||||
line = line.replace(character[41], fetchedUUIDs.remove(character[0]).toString());
|
||||
}
|
||||
|
||||
writer.append(line).append("\r\n");
|
||||
|
@ -621,7 +621,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
// Problem, nothing was returned
|
||||
}
|
||||
|
||||
public boolean saveUserUUIDs(Map<String,UUID> player_info) {
|
||||
public boolean saveUserUUIDs(Map<String, UUID> fetchedUUIDs) {
|
||||
if (!checkConnected()) {
|
||||
// return false
|
||||
return false;
|
||||
@ -633,7 +633,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
try {
|
||||
statement = connection.prepareStatement("UPDATE " + tablePrefix + "users SET uuid = ? WHERE user = ?");
|
||||
|
||||
for (Map.Entry<String,UUID> entry : player_info.entrySet()) {
|
||||
for (Map.Entry<String, UUID> entry : fetchedUUIDs.entrySet()) {
|
||||
statement.setString(1, entry.getValue().toString());
|
||||
statement.setString(2, entry.getKey());
|
||||
|
||||
@ -1051,11 +1051,11 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
|
||||
resultSet = statement.executeQuery("SELECT `user` FROM `" + tablePrefix + "users`");
|
||||
|
||||
while(resultSet.next()) {
|
||||
while (resultSet.next()) {
|
||||
names.add(resultSet.getString("user"));
|
||||
}
|
||||
|
||||
new UUIDUpdateAsyncTask(mcMMO.p,names).runTaskAsynchronously(mcMMO.p);
|
||||
new UUIDUpdateAsyncTask(mcMMO.p, names).runTaskAsynchronously(mcMMO.p);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ public class UUIDUpdateAsyncTask extends BukkitRunnable {
|
||||
plugin.getLogger().info("Starting to check and update UUIDs, total amount of users: " + size);
|
||||
|
||||
List<String> userNamesSection;
|
||||
Map<String,UUID> fetchedUUIDs = new HashMap<String,UUID>();
|
||||
Map<String, UUID> fetchedUUIDs = new HashMap<String, UUID>();
|
||||
|
||||
while (size != 0) {
|
||||
if (size > MAX_LOOKUP) {
|
||||
@ -59,9 +59,7 @@ public class UUIDUpdateAsyncTask extends BukkitRunnable {
|
||||
}
|
||||
|
||||
checkedUsers += userNamesSection.size();
|
||||
|
||||
userNamesSection.clear();
|
||||
|
||||
size = userNames.size();
|
||||
|
||||
Misc.printProgress(checkedUsers, DatabaseManager.progressInterval, startMillis);
|
||||
|
Loading…
Reference in New Issue
Block a user