This commit is contained in:
Len 2022-05-08 17:45:31 +02:00
parent 15fce9ad2c
commit 6dfa078fa7

View File

@ -26,13 +26,18 @@ public class AdminClaimExpireTask extends BukkitRunnable
public void run()
{
//Config.expiringClaims.entrySet().removeIf(entry -> System.currentTimeMillis() >= entry.getValue());
for(Iterator<Map.Entry<Long, Long>> it = Config.expiringClaims.entrySet().iterator(); it.hasNext(); ) {
for(Iterator<Map.Entry<Long, Long>> it = Config.expiringClaims.entrySet().iterator(); it.hasNext();)
{
Map.Entry<Long, Long> entry = it.next();
if(System.currentTimeMillis() >= entry.getValue()) {
if(System.currentTimeMillis() >= entry.getValue())
{
Claim claim = plugin.dataStore.getClaim(entry.getKey());
plugin.dataStore.deleteClaim(claim, false, true);
it.remove();
plugin.getLogger().info("Removed temporary admin claim with id " + entry.getKey());
if (claim != null)
{
plugin.dataStore.deleteClaim(claim, false, true);
it.remove();
plugin.getLogger().info("Removed temporary admin claim with id " + entry.getKey());
}
}
}
}