Added Config option to enable/disable global announcement of backup starting and finishing
parent
3bf91ea915
commit
eb6f4fdb10
|
@ -141,6 +141,16 @@ public class ConfigPOJO implements ConfigData {
|
||||||
@ConfigEntry.Category("Manage")
|
@ConfigEntry.Category("Manage")
|
||||||
public List<String> playerBlacklist = new ArrayList<>();
|
public List<String> playerBlacklist = new ArrayList<>();
|
||||||
|
|
||||||
|
@Comment("\nAnnounce to ALL players when backup starts\n")
|
||||||
|
@ConfigEntry.Gui.NoTooltip()
|
||||||
|
@ConfigEntry.Category("Manage")
|
||||||
|
public boolean broadcastBackupStart = true;
|
||||||
|
|
||||||
|
@Comment("\nAnnounce to ALL players when backup finishes\n")
|
||||||
|
@ConfigEntry.Gui.NoTooltip()
|
||||||
|
@ConfigEntry.Category("Manage")
|
||||||
|
public boolean broadcastBackupDone = true;
|
||||||
|
|
||||||
@Comment("""
|
@Comment("""
|
||||||
\nFormat of date&time used to name backup files.
|
\nFormat of date&time used to name backup files.
|
||||||
Remember not to use '#' symbol or any other character that is not allowed by your operating system such as:
|
Remember not to use '#' symbol or any other character that is not allowed by your operating system such as:
|
||||||
|
|
|
@ -37,10 +37,14 @@ public class BackupHelper {
|
||||||
private final static ConfigHelper config = ConfigHelper.INSTANCE;
|
private final static ConfigHelper config = ConfigHelper.INSTANCE;
|
||||||
|
|
||||||
public static Runnable create(BackupContext ctx) {
|
public static Runnable create(BackupContext ctx) {
|
||||||
Utilities.notifyPlayers(ctx.getServer(),
|
if(config.get().broadcastBackupStart) {
|
||||||
ctx.getInitiatorUUID(),
|
Utilities.notifyPlayers(ctx.getServer(),
|
||||||
"Warning! Server backup will begin shortly. You may experience some lag."
|
ctx.getInitiatorUUID(),
|
||||||
);
|
"Warning! Server backup will begin shortly. You may experience some lag."
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
log.sendInfoAL(ctx, "Warning! Server backup will begin shortly. You may experience some lag.");
|
||||||
|
}
|
||||||
|
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,8 @@ public class MakeBackupRunnable implements Runnable {
|
||||||
Utilities.disableWorldSaving(context.getServer());
|
Utilities.disableWorldSaving(context.getServer());
|
||||||
Statics.disableWatchdog = true;
|
Statics.disableWatchdog = true;
|
||||||
|
|
||||||
|
Utilities.updateTMPFSFlag(context.getServer());
|
||||||
|
|
||||||
log.sendInfoAL(context, "Starting backup");
|
log.sendInfoAL(context, "Starting backup");
|
||||||
|
|
||||||
File world = Utilities.getWorldFolder(context.getServer());
|
File world = Utilities.getWorldFolder(context.getServer());
|
||||||
|
@ -113,11 +115,15 @@ public class MakeBackupRunnable implements Runnable {
|
||||||
|
|
||||||
BackupHelper.executeFileLimit(context.getCommandSource(), Utilities.getLevelName(context.getServer()));
|
BackupHelper.executeFileLimit(context.getCommandSource(), Utilities.getLevelName(context.getServer()));
|
||||||
|
|
||||||
Utilities.notifyPlayers(
|
if(config.get().broadcastBackupDone) {
|
||||||
context.getServer(),
|
Utilities.notifyPlayers(
|
||||||
context.getInitiatorUUID(),
|
context.getServer(),
|
||||||
"Done!"
|
context.getInitiatorUUID(),
|
||||||
);
|
"Done!"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
log.sendInfoAL(context, "Done!");
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
Utilities.enableWorldSaving(context.getServer());
|
Utilities.enableWorldSaving(context.getServer());
|
||||||
Statics.disableWatchdog = false;
|
Statics.disableWatchdog = false;
|
||||||
|
|
|
@ -12,6 +12,10 @@
|
||||||
"text.autoconfig.textile_backup.option.restoreDelay": "Restore Delay",
|
"text.autoconfig.textile_backup.option.restoreDelay": "Restore Delay",
|
||||||
"text.autoconfig.textile_backup.option.restoreDelay.@Tooltip": "In seconds",
|
"text.autoconfig.textile_backup.option.restoreDelay.@Tooltip": "In seconds",
|
||||||
|
|
||||||
|
"text.autoconfig.textile_backup.option.broadcastBackupStart": "Announce backup start",
|
||||||
|
|
||||||
|
"text.autoconfig.textile_backup.option.broadcastBackupDone": "Announce backup done",
|
||||||
|
|
||||||
"text.autoconfig.textile_backup.option.doBackupsOnEmptyServer": "Make automatic backups on empty server",
|
"text.autoconfig.textile_backup.option.doBackupsOnEmptyServer": "Make automatic backups on empty server",
|
||||||
|
|
||||||
"text.autoconfig.textile_backup.option.shutdownBackup": "Make a backup on shutdown",
|
"text.autoconfig.textile_backup.option.shutdownBackup": "Make a backup on shutdown",
|
||||||
|
|
Loading…
Reference in New Issue