Add catch for rare occurrence where players have no stored data
This commit is contained in:
parent
01bc9e9e6b
commit
39c105f0cf
@ -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)));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user