Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
ddabee9d99
Commit
01cb4abb39
@ -20,19 +20,19 @@
|
|||||||
package de.steamwar.bausystem.region;
|
package de.steamwar.bausystem.region;
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.linkage.Disable;
|
|
||||||
import de.steamwar.bausystem.linkage.Enable;
|
import de.steamwar.bausystem.linkage.Enable;
|
||||||
import de.steamwar.bausystem.linkage.LinkageType;
|
import de.steamwar.bausystem.linkage.LinkageType;
|
||||||
import de.steamwar.bausystem.linkage.Linked;
|
import de.steamwar.bausystem.linkage.Linked;
|
||||||
import de.steamwar.bausystem.region.tags.Tag;
|
import de.steamwar.bausystem.region.tags.Tag;
|
||||||
import java.util.Iterator;
|
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
|
||||||
@Linked(LinkageType.ENABLE_LINK)
|
@Linked(LinkageType.ENABLE_LINK)
|
||||||
@Linked(LinkageType.DISABLE_LINK)
|
public class BackupScheduler implements Enable {
|
||||||
public class BackupScheduler implements Enable, Disable {
|
|
||||||
|
|
||||||
|
private static final long INITIAL = 20 * 60 * 5;
|
||||||
private static final long PERIOD = 20 * 60 * 30;
|
private static final long PERIOD = 20 * 60 * 30;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -43,15 +43,7 @@ public class BackupScheduler implements Enable, Disable {
|
|||||||
final Iterator<Region> regions = Region.getREGION_MAP().values().stream().filter(region -> region.get(Tag.CHANGED)).iterator();
|
final Iterator<Region> regions = Region.getREGION_MAP().values().stream().filter(region -> region.get(Tag.CHANGED)).iterator();
|
||||||
BackupScheduler.this.doBackup(regions);
|
BackupScheduler.this.doBackup(regions);
|
||||||
}
|
}
|
||||||
}.runTaskTimer(BauSystem.getInstance(), PERIOD, PERIOD);
|
}.runTaskTimer(BauSystem.getInstance(), INITIAL, PERIOD);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void disable() {
|
|
||||||
Region.getREGION_MAP().values().stream().filter(region -> region.get(Tag.CHANGED)).iterator().forEachRemaining(region -> {
|
|
||||||
region.backup();
|
|
||||||
region.remove(Tag.CHANGED);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doBackup(final Iterator<Region> regionIterator) {
|
public void doBackup(final Iterator<Region> regionIterator) {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren