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();
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(!results.next())
{
this.savePlayerData(playerID, playerData);
}
//otherwise, just read from the database
else
//if data for this player exists, use it
if(results.next())
{
playerData.lastLogin = results.getTimestamp("lastlogin");
playerData.accruedClaimBlocks = results.getInt("accruedblocks");

View File

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