When backup interval is set to zero, no automatic backups will be performed
This commit is contained in:
parent
55f5fdf1c4
commit
d13bc5256c
@ -21,12 +21,15 @@ package net.szum123321.textile_backup;
|
||||
import blue.endless.jankson.Comment;
|
||||
import io.github.cottonmc.cotton.config.annotations.ConfigFile;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashSet;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
@ConfigFile(name = TextileBackup.MOD_ID)
|
||||
public class ConfigHandler {
|
||||
@Comment("\nTime between automatic backups in seconds\n")
|
||||
@Comment("\nTime between automatic backups in seconds\n" +
|
||||
"When set to 0 backups will not be performed automatically\n")
|
||||
public long backupInterval = 3600;
|
||||
|
||||
@Comment("\nShould backups be done even if there are no players?\n")
|
||||
|
@ -15,6 +15,9 @@ public class BackupScheduler {
|
||||
}
|
||||
|
||||
public void tick(MinecraftServer server) {
|
||||
if(TextileBackup.config.backupInterval <= 0)
|
||||
return;
|
||||
|
||||
long now = Instant.now().getEpochSecond();
|
||||
|
||||
if(TextileBackup.config.doBackupsOnEmptyServer || server.getPlayerManager().getCurrentPlayerCount() > 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user