Fix temp claims not expiring

This commit is contained in:
Len 2022-05-01 19:34:39 +02:00
parent 61823e98fb
commit 5577636b94
2 changed files with 41 additions and 38 deletions

View File

@ -644,7 +644,7 @@ public abstract class DataStore
this.deleteClaim(claim, true, releasePets); this.deleteClaim(claim, true, releasePets);
} }
synchronized void deleteClaim(Claim claim, boolean fireEvent, boolean releasePets) public synchronized void deleteClaim(Claim claim, boolean fireEvent, boolean releasePets)
{ {
//delete any children //delete any children
for (int j = 1; (j - 1) < claim.children.size(); j++) for (int j = 1; (j - 1) < claim.children.size(); j++)

View File

@ -1,5 +1,6 @@
package me.ryanhamshire.GriefPrevention.alttd.tasks; package me.ryanhamshire.GriefPrevention.alttd.tasks;
import me.ryanhamshire.GriefPrevention.Claim;
import me.ryanhamshire.GriefPrevention.GriefPrevention; import me.ryanhamshire.GriefPrevention.GriefPrevention;
import me.ryanhamshire.GriefPrevention.alttd.config.Config; import me.ryanhamshire.GriefPrevention.alttd.config.Config;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
@ -28,6 +29,8 @@ public class AdminClaimExpireTask extends BukkitRunnable
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(); 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(); it.remove();
plugin.getLogger().info("Removed temporary admin claim with id " + entry.getKey()); plugin.getLogger().info("Removed temporary admin claim with id " + entry.getKey());
} }