Hopefully fixes startup crashes #46
@ -20,6 +20,7 @@
|
|||||||
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;
|
||||||
@ -29,7 +30,10 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||||||
|
|
||||||
|
|
||||||
@Linked(LinkageType.ENABLE_LINK)
|
@Linked(LinkageType.ENABLE_LINK)
|
||||||
public class BackupScheduler implements Enable {
|
@Linked(LinkageType.DISABLE_LINK)
|
||||||
|
public class BackupScheduler implements Enable, Disable {
|
||||||
|
|
||||||
|
private static final long PERIOD = 20 * 60 * 30;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enable() {
|
public void enable() {
|
||||||
@ -39,7 +43,13 @@ public class BackupScheduler implements Enable {
|
|||||||
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(), 20, 20*60*30);
|
}.runTaskTimer(BauSystem.getInstance(), PERIOD, PERIOD);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disable() {
|
||||||
|
final Iterator<Region> regions = Region.getREGION_MAP().values().stream().filter(region -> region.get(Tag.CHANGED)).iterator();
|
||||||
|
BackupScheduler.this.doBackup(regions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doBackup(final Iterator<Region> regionIterator) {
|
public void doBackup(final Iterator<Region> regionIterator) {
|
||||||
@ -56,6 +66,6 @@ public class BackupScheduler implements Enable {
|
|||||||
region.remove(Tag.CHANGED);
|
region.remove(Tag.CHANGED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.runTaskTimer(BauSystem.getInstance(), 0, 20);
|
}.runTaskTimer(BauSystem.getInstance(), 0, 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
In neuem Issue referenzieren
Einen Benutzer sperren