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);
|
||||
}
|
||||
|
||||
synchronized void deleteClaim(Claim claim, boolean fireEvent, boolean releasePets)
|
||||
public synchronized void deleteClaim(Claim claim, boolean fireEvent, boolean releasePets)
|
||||
{
|
||||
//delete any children
|
||||
for (int j = 1; (j - 1) < claim.children.size(); j++)
|
||||
|
|
|
|||
|
|
@ -1,37 +1,40 @@
|
|||
package me.ryanhamshire.GriefPrevention.alttd.tasks;
|
||||
|
||||
import me.ryanhamshire.GriefPrevention.GriefPrevention;
|
||||
import me.ryanhamshire.GriefPrevention.alttd.config.Config;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
public class AdminClaimExpireTask extends BukkitRunnable
|
||||
{
|
||||
private GriefPrevention plugin;
|
||||
|
||||
public AdminClaimExpireTask(GriefPrevention plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
runTaskTimer(plugin, 0, Config.adminClaimExpireCheckRate);
|
||||
}
|
||||
|
||||
@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(); ) {
|
||||
Map.Entry<Long, Long> entry = it.next();
|
||||
if(System.currentTimeMillis() >= entry.getValue()) {
|
||||
it.remove();
|
||||
plugin.getLogger().info("Removed temporary admin claim with id " + entry.getKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
package me.ryanhamshire.GriefPrevention.alttd.tasks;
|
||||
|
||||
import me.ryanhamshire.GriefPrevention.Claim;
|
||||
import me.ryanhamshire.GriefPrevention.GriefPrevention;
|
||||
import me.ryanhamshire.GriefPrevention.alttd.config.Config;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
public class AdminClaimExpireTask extends BukkitRunnable
|
||||
{
|
||||
private GriefPrevention plugin;
|
||||
|
||||
public AdminClaimExpireTask(GriefPrevention plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
runTaskTimer(plugin, 0, Config.adminClaimExpireCheckRate);
|
||||
}
|
||||
|
||||
@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(); ) {
|
||||
Map.Entry<Long, Long> entry = it.next();
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user