mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-26 10:44:43 +02:00
Clean up some of our messes.
This commit is contained in:
@ -56,7 +56,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
try {
|
||||
in = new BufferedReader(new FileReader(usersFilePath));
|
||||
StringBuilder writer = new StringBuilder();
|
||||
String line = "";
|
||||
String line;
|
||||
|
||||
while ((line = in.readLine()) != null) {
|
||||
String[] character = line.split(":");
|
||||
@ -111,7 +111,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
try {
|
||||
in = new BufferedReader(new FileReader(usersFilePath));
|
||||
StringBuilder writer = new StringBuilder();
|
||||
String line = "";
|
||||
String line;
|
||||
|
||||
while ((line = in.readLine()) != null) {
|
||||
String[] character = line.split(":");
|
||||
@ -173,7 +173,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
try {
|
||||
in = new BufferedReader(new FileReader(usersFilePath));
|
||||
StringBuilder writer = new StringBuilder();
|
||||
String line = "";
|
||||
String line;
|
||||
|
||||
while ((line = in.readLine()) != null) {
|
||||
// Write out the same file but when we get to the player we want to remove, we skip his line.
|
||||
@ -390,8 +390,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
continue;
|
||||
}
|
||||
|
||||
PlayerProfile p = loadFromLine(character);
|
||||
return p;
|
||||
return loadFromLine(character);
|
||||
}
|
||||
|
||||
// Didn't find the player, create a new one
|
||||
@ -515,7 +514,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
synchronized (fileWritingLock) {
|
||||
try {
|
||||
in = new BufferedReader(new FileReader(usersFilePath));
|
||||
String line = "";
|
||||
String line;
|
||||
|
||||
while ((line = in.readLine()) != null) {
|
||||
String[] data = line.split(":");
|
||||
@ -594,7 +593,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
try {
|
||||
in = new BufferedReader(new FileReader(usersFilePath));
|
||||
StringBuilder writer = new StringBuilder();
|
||||
String line = "";
|
||||
String line;
|
||||
HashSet<String> players = new HashSet<String>();
|
||||
|
||||
while ((line = in.readLine()) != null) {
|
||||
|
@ -195,7 +195,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
|
||||
if (checkConnected()) {
|
||||
String query = skill == null ? "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing+alchemy" : skill.name().toLowerCase();
|
||||
ResultSet resultSet = null;
|
||||
ResultSet resultSet;
|
||||
PreparedStatement statement = null;
|
||||
|
||||
try {
|
||||
@ -448,16 +448,16 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
+ "JOIN " + tablePrefix + "huds h ON (u.id = h.user_id) "
|
||||
+ "WHERE u.user = ?");
|
||||
List<String> usernames = getStoredUsers();
|
||||
ResultSet result = null;
|
||||
ResultSet resultSet;
|
||||
int convertedUsers = 0;
|
||||
long startMillis = System.currentTimeMillis();
|
||||
for (String playerName : usernames) {
|
||||
statement.setString(1, playerName);
|
||||
try {
|
||||
result = statement.executeQuery();
|
||||
result.next();
|
||||
destination.saveUser(loadFromResult(playerName, result));
|
||||
result.close();
|
||||
resultSet = statement.executeQuery();
|
||||
resultSet.next();
|
||||
destination.saveUser(loadFromResult(playerName, resultSet));
|
||||
resultSet.close();
|
||||
}
|
||||
catch (SQLException e) {
|
||||
// Ignore
|
||||
@ -798,7 +798,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
break;
|
||||
}
|
||||
|
||||
ResultSet resultSet = null;
|
||||
ResultSet resultSet;
|
||||
HashMap<Integer, ArrayList<String>> rows = new HashMap<Integer, ArrayList<String>>();
|
||||
PreparedStatement statement = null;
|
||||
|
||||
@ -984,7 +984,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
int result = -1;
|
||||
|
||||
if (checkConnected()) {
|
||||
ResultSet resultSet = null;
|
||||
ResultSet resultSet;
|
||||
|
||||
try {
|
||||
resultSet = statement.executeQuery();
|
||||
|
Reference in New Issue
Block a user