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
d61b837dcf
commit
37e3bfe7d9
@ -27,7 +27,6 @@ import com.gmail.nossr50.datatypes.skills.AbilityType;
|
|||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.datatypes.spout.huds.HudType;
|
import com.gmail.nossr50.datatypes.spout.huds.HudType;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
|
||||||
|
|
||||||
public final class FlatfileDatabaseManager implements DatabaseManager {
|
public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||||
private final HashMap<SkillType, List<PlayerStat>> playerStatHash = new HashMap<SkillType, List<PlayerStat>>();
|
private final HashMap<SkillType, List<PlayerStat>> playerStatHash = new HashMap<SkillType, List<PlayerStat>>();
|
||||||
@ -104,7 +103,6 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
mcMMO.p.getLogger().info("Purging old users...");
|
mcMMO.p.getLogger().info("Purging old users...");
|
||||||
|
|
||||||
|
|
||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
FileWriter out = null;
|
FileWriter out = null;
|
||||||
String usersFilePath = mcMMO.getUsersFilePath();
|
String usersFilePath = mcMMO.getUsersFilePath();
|
||||||
@ -123,8 +121,8 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
boolean rewrite = false;
|
boolean rewrite = false;
|
||||||
try {
|
try {
|
||||||
lastPlayed = Long.parseLong(character[37]) * Misc.TIME_CONVERSION_FACTOR;
|
lastPlayed = Long.parseLong(character[37]) * Misc.TIME_CONVERSION_FACTOR;
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
}
|
}
|
||||||
|
catch (NumberFormatException e) {}
|
||||||
if (lastPlayed == 0) {
|
if (lastPlayed == 0) {
|
||||||
OfflinePlayer player = Bukkit.getOfflinePlayer(name);
|
OfflinePlayer player = Bukkit.getOfflinePlayer(name);
|
||||||
lastPlayed = player.getLastPlayed();
|
lastPlayed = player.getLastPlayed();
|
||||||
@ -594,10 +592,12 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
// If they're valid, rewrite them to the file.
|
// If they're valid, rewrite them to the file.
|
||||||
if (character.length > 38) {
|
if (character.length > 38) {
|
||||||
writer.append(line).append("\r\n");
|
writer.append(line).append("\r\n");
|
||||||
} else if (character.length < 33) {
|
}
|
||||||
|
else if (character.length < 33) {
|
||||||
// Before Version 1.0 - Drop
|
// Before Version 1.0 - Drop
|
||||||
mcMMO.p.getLogger().warning("Dropping malformed or before version 1.0 line from database - " + line);
|
mcMMO.p.getLogger().warning("Dropping malformed or before version 1.0 line from database - " + line);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
String oldVersion = null;
|
String oldVersion = null;
|
||||||
StringBuilder newLine = new StringBuilder(line);
|
StringBuilder newLine = new StringBuilder(line);
|
||||||
boolean announce = false;
|
boolean announce = false;
|
||||||
@ -614,14 +614,18 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
// commit a814b57311bc7734661109f0e77fc8bab3a0bd29
|
// commit a814b57311bc7734661109f0e77fc8bab3a0bd29
|
||||||
newLine.append(0).append(":");
|
newLine.append(0).append(":");
|
||||||
newLine.append(0).append(":");
|
newLine.append(0).append(":");
|
||||||
if (oldVersion == null) oldVersion = "1.2.00";
|
if (oldVersion == null) {
|
||||||
|
oldVersion = "1.2.00";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (character.length <= 36) {
|
if (character.length <= 36) {
|
||||||
// Introduction of Blast Mining cooldowns
|
// Introduction of Blast Mining cooldowns
|
||||||
// Version 1.3.00-dev
|
// Version 1.3.00-dev
|
||||||
// commit fadbaf429d6b4764b8f1ad0efaa524a090e82ef5
|
// commit fadbaf429d6b4764b8f1ad0efaa524a090e82ef5
|
||||||
newLine.append((int) 0).append(":");
|
newLine.append((int) 0).append(":");
|
||||||
if (oldVersion == null) oldVersion = "1.3.00";
|
if (oldVersion == null) {
|
||||||
|
oldVersion = "1.3.00";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (character.length <= 37) {
|
if (character.length <= 37) {
|
||||||
// Making old-purge work with flatfile
|
// Making old-purge work with flatfile
|
||||||
@ -630,14 +634,18 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
// XXX Cannot create an OfflinePlayer at startup, use 0 and fix in purge
|
// XXX Cannot create an OfflinePlayer at startup, use 0 and fix in purge
|
||||||
newLine.append("0").append(":");
|
newLine.append("0").append(":");
|
||||||
announce = true; // TODO move this down
|
announce = true; // TODO move this down
|
||||||
if (oldVersion == null) oldVersion = "1.4.00";
|
if (oldVersion == null) {
|
||||||
|
oldVersion = "1.4.00";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (character.length <= 38) {
|
if (character.length <= 38) {
|
||||||
// Addition of mob healthbars
|
// Addition of mob healthbars
|
||||||
// Version 1.4.06
|
// Version 1.4.06
|
||||||
// commit da29185b7dc7e0d992754bba555576d48fa08aa6
|
// commit da29185b7dc7e0d992754bba555576d48fa08aa6
|
||||||
newLine.append(Config.getInstance().getMobHealthbarDefault().toString()).append(":");
|
newLine.append(Config.getInstance().getMobHealthbarDefault().toString()).append(":");
|
||||||
if (oldVersion == null) oldVersion = "1.4.06";
|
if (oldVersion == null) {
|
||||||
|
oldVersion = "1.4.06";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (announce) {
|
if (announce) {
|
||||||
@ -674,10 +682,13 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void tryClose(Closeable c) {
|
private void tryClose(Closeable c) {
|
||||||
if (c == null) return;
|
if (c == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
c.close();
|
c.close();
|
||||||
} catch (IOException e) {
|
}
|
||||||
|
catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user