Fixed formatting!

This commit is contained in:
TfT_02 2014-07-23 23:35:05 +02:00
parent bab99babcc
commit e459eaa547
4 changed files with 11 additions and 14 deletions

View File

@ -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.

View File

@ -542,8 +542,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();
@ -554,16 +553,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");

View File

@ -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;
}

View File

@ -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) {
@ -51,7 +51,7 @@ public class UUIDUpdateAsyncTask extends BukkitRunnable {
}
try {
fetchedUUIDs.putAll(new UUIDFetcher(userNamesSection).call());
fetchedUUIDs.putAll(new UUIDFetcher(userNamesSection).call());
}
catch (Exception e) {
plugin.getLogger().severe("Unable to fetch UUIDs!");
@ -59,9 +59,7 @@ public class UUIDUpdateAsyncTask extends BukkitRunnable {
}
checkedUsers += userNamesSection.size();
userNamesSection.clear();
size = userNames.size();
Misc.printProgress(checkedUsers, DatabaseManager.progressInterval, startMillis);