Fix temp claims not expiring
This commit is contained in:
parent
61823e98fb
commit
5577636b94
|
|
@ -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++)
|
||||||
|
|
|
||||||
|
|
@ -1,37 +1,40 @@
|
||||||
package me.ryanhamshire.GriefPrevention.alttd.tasks;
|
package me.ryanhamshire.GriefPrevention.alttd.tasks;
|
||||||
|
|
||||||
import me.ryanhamshire.GriefPrevention.GriefPrevention;
|
import me.ryanhamshire.GriefPrevention.Claim;
|
||||||
import me.ryanhamshire.GriefPrevention.alttd.config.Config;
|
import me.ryanhamshire.GriefPrevention.GriefPrevention;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import me.ryanhamshire.GriefPrevention.alttd.config.Config;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map;
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
public class AdminClaimExpireTask extends BukkitRunnable
|
|
||||||
{
|
public class AdminClaimExpireTask extends BukkitRunnable
|
||||||
private GriefPrevention plugin;
|
{
|
||||||
|
private GriefPrevention plugin;
|
||||||
public AdminClaimExpireTask(GriefPrevention plugin)
|
|
||||||
{
|
public AdminClaimExpireTask(GriefPrevention plugin)
|
||||||
this.plugin = plugin;
|
{
|
||||||
}
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
public void init()
|
|
||||||
{
|
public void init()
|
||||||
runTaskTimer(plugin, 0, Config.adminClaimExpireCheckRate);
|
{
|
||||||
}
|
runTaskTimer(plugin, 0, Config.adminClaimExpireCheckRate);
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public void run()
|
@Override
|
||||||
{
|
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(); ) {
|
//Config.expiringClaims.entrySet().removeIf(entry -> System.currentTimeMillis() >= entry.getValue());
|
||||||
Map.Entry<Long, Long> entry = it.next();
|
for(Iterator<Map.Entry<Long, Long>> it = Config.expiringClaims.entrySet().iterator(); it.hasNext(); ) {
|
||||||
if(System.currentTimeMillis() >= entry.getValue()) {
|
Map.Entry<Long, Long> entry = it.next();
|
||||||
it.remove();
|
if(System.currentTimeMillis() >= entry.getValue()) {
|
||||||
plugin.getLogger().info("Removed temporary admin claim with id " + entry.getKey());
|
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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user