Merge pull request #48 from Mineplex-LLC/alex-mcl

Add catch for rare occurrence where players have no stored data
This commit is contained in:
Conrad 2016-05-02 16:34:50 -04:00
commit 2cd76fbf72

View File

@ -93,20 +93,34 @@ public class EloRepository extends MinecraftRepository
public void getStrikeExpiry(int accountId, Callback<Long> call)
{
Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> executeQuery(GRAB_STRIKE_EXPIRY, resultSet -> {
boolean called = false;
while (resultSet.next())
{
called = true;
call.run(resultSet.getLong(1));
}
if (!called)
{
call.run(0L);
}
}, new ColumnInt("accountId", accountId)));
}
public void getBanExpiryAsync(int accountId, Callback<Long> call)
{
Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> executeQuery(GRAB_BAN_EXPIRY, resultSet -> {
boolean called = false;
while (resultSet.next())
{
called = true;
call.run(resultSet.getLong(1));
}
if (!called)
{
call.run(0L);
}
}, new ColumnInt("accountId", accountId)));
}
@ -129,10 +143,17 @@ public class EloRepository extends MinecraftRepository
public void getStrikes(int accountId, Callback<Integer> call)
{
Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> executeQuery(GRAB_STRIKES, resultSet -> {
boolean called = false;
while (resultSet.next())
{
called = true;
call.run(resultSet.getInt(1));
}
if (!called)
{
call.run(0);
}
}, new ColumnInt("accountId", accountId)));
}