Perf boost for first-time logins.

This commit is contained in:
ryanhamshire 2014-10-10 21:27:12 -07:00
parent 25a3e8101e
commit 50d670a93c
2 changed files with 4 additions and 17 deletions

View File

@ -492,14 +492,8 @@ public class DatabaseDataStore extends DataStore
Statement statement = this.databaseConnection.createStatement(); Statement statement = this.databaseConnection.createStatement();
ResultSet results = statement.executeQuery("SELECT * FROM griefprevention_playerdata WHERE name='" + playerID.toString() + "';"); ResultSet results = statement.executeQuery("SELECT * FROM griefprevention_playerdata WHERE name='" + playerID.toString() + "';");
//if there's no data for this player, create it with defaults //if data for this player exists, use it
if(!results.next()) if(results.next())
{
this.savePlayerData(playerID, playerData);
}
//otherwise, just read from the database
else
{ {
playerData.lastLogin = results.getTimestamp("lastlogin"); playerData.lastLogin = results.getTimestamp("lastlogin");
playerData.accruedClaimBlocks = results.getInt("accruedblocks"); playerData.accruedClaimBlocks = results.getInt("accruedblocks");

View File

@ -462,15 +462,8 @@ public class FlatFileDataStore extends DataStore
PlayerData playerData = new PlayerData(); PlayerData playerData = new PlayerData();
playerData.playerID = playerID; playerData.playerID = playerID;
//if it doesn't exist as a file //if it exists as a file, read the file
if(!playerFile.exists()) if(playerFile.exists())
{
//create a file with defaults
this.savePlayerData(playerID, playerData);
}
//otherwise, read the file
else
{ {
BufferedReader inStream = null; BufferedReader inStream = null;
try try