38 lines
1.1 KiB
Java
38 lines
1.1 KiB
Java
|
|
package me.ryanhamshire.GriefPrevention.alttd.tasks;
|
||
|
|
|
||
|
|
import me.ryanhamshire.GriefPrevention.GriefPrevention;
|
||
|
|
import me.ryanhamshire.GriefPrevention.alttd.config.AlttdConfig;
|
||
|
|
import org.bukkit.scheduler.BukkitRunnable;
|
||
|
|
|
||
|
|
import java.util.Iterator;
|
||
|
|
import java.util.Map;
|
||
|
|
|
||
|
|
public class ClaimExpireTask extends BukkitRunnable
|
||
|
|
{
|
||
|
|
private GriefPrevention plugin;
|
||
|
|
|
||
|
|
public ClaimExpireTask(GriefPrevention plugin)
|
||
|
|
{
|
||
|
|
this.plugin = plugin;
|
||
|
|
}
|
||
|
|
|
||
|
|
public void init()
|
||
|
|
{
|
||
|
|
runTaskTimer(plugin, 0, AlttdConfig.expireCheckRate);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public void run()
|
||
|
|
{
|
||
|
|
//Config.expiringClaims.entrySet().removeIf(entry -> System.currentTimeMillis() >= entry.getValue());
|
||
|
|
for(Iterator<Map.Entry<Long, Long>> it = AlttdConfig.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());
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|