Little bit of whitespace cleanup.

This commit is contained in:
GJ 2012-04-27 10:00:29 -04:00
parent e3803702c5
commit 0dd41ab18a

View File

@ -295,12 +295,10 @@ public class PlayerProfile {
return false; return false;
} }
public void save() public void save() {
{ Long timestamp = System.currentTimeMillis() / 1000; //Convert to seconds
Long timestamp = System.currentTimeMillis()/1000; //Convert to seconds
// if we are using mysql save to database // if we are using mysql save to database
if (Config.getInstance().getUseMySQL()) if (Config.getInstance().getUseMySQL()) {
{
mcMMO.database.write("UPDATE "+tablePrefix+"huds SET " mcMMO.database.write("UPDATE "+tablePrefix+"huds SET "
+" hudtype = '"+hud.toString()+"' WHERE user_id = "+this.userid); +" hudtype = '"+hud.toString()+"' WHERE user_id = "+this.userid);
mcMMO.database.write("UPDATE "+tablePrefix+"users SET lastlogin = " + timestamp.intValue() + " WHERE id = " + this.userid); mcMMO.database.write("UPDATE "+tablePrefix+"users SET lastlogin = " + timestamp.intValue() + " WHERE id = " + this.userid);
@ -343,8 +341,8 @@ public class PlayerProfile {
+", acrobatics = "+skillsXp.get(SkillType.ACROBATICS) +", acrobatics = "+skillsXp.get(SkillType.ACROBATICS)
+", fishing = "+skillsXp.get(SkillType.FISHING) +", fishing = "+skillsXp.get(SkillType.FISHING)
+" WHERE user_id = "+this.userid); +" WHERE user_id = "+this.userid);
} else }
{ else {
// otherwise save to flatfile // otherwise save to flatfile
try { try {
//Open the file //Open the file
@ -354,16 +352,14 @@ public class PlayerProfile {
String line = ""; String line = "";
//While not at the end of the file //While not at the end of the file
while((line = in.readLine()) != null) while ((line = in.readLine()) != null) {
{
//Read the line in and copy it to the output it's not the player //Read the line in and copy it to the output it's not the player
//we want to edit //we want to edit
if(!line.split(":")[0].equalsIgnoreCase(playerName)) if (!line.split(":")[0].equalsIgnoreCase(playerName)) {
{
writer.append(line).append("\r\n"); writer.append(line).append("\r\n");
}
else {
//Otherwise write the new player information //Otherwise write the new player information
} else {
writer.append(playerName + ":"); writer.append(playerName + ":");
writer.append(skills.get(SkillType.MINING) + ":"); writer.append(skills.get(SkillType.MINING) + ":");
writer.append("" + ":"); writer.append("" + ":");
@ -406,12 +402,14 @@ public class PlayerProfile {
writer.append("\r\n"); writer.append("\r\n");
} }
} }
in.close(); in.close();
//Write the new file //Write the new file
FileWriter out = new FileWriter(location); FileWriter out = new FileWriter(location);
out.write(writer.toString()); out.write(writer.toString());
out.close(); out.close();
} catch (Exception e) { }
catch (Exception e) {
mcMMO.p.getLogger().severe("Exception while writing to " + location + " (Are you sure you formatted it correctly?)" + e.toString()); mcMMO.p.getLogger().severe("Exception while writing to " + location + " (Are you sure you formatted it correctly?)" + e.toString());
} }
} }