Few small tweaks. Most lkely final 1.16.1 version.
This commit is contained in:
parent
1fd25e7344
commit
708659b5dd
@ -9,6 +9,6 @@ loader_version=0.8.8+build.202
|
||||
fabric_version=0.13.1+build.370-1.16
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.2.1-1.16-pre2
|
||||
mod_version = 1.2.2-1.16.1
|
||||
maven_group = net.szum123321
|
||||
archives_base_name = textile_backup
|
@ -26,35 +26,35 @@ import java.util.Set;
|
||||
|
||||
@ConfigFile(name = TextileBackup.MOD_ID)
|
||||
public class ConfigHandler {
|
||||
@Comment("\nTime between backups in seconds\n")
|
||||
@Comment("\nTime between automatic backups in seconds\n")
|
||||
public long backupInterval = 3600;
|
||||
|
||||
@Comment("\nShould backups be done even if there is no players?\n")
|
||||
@Comment("\nShould backups be done even if there are no players?\n")
|
||||
public boolean doBackupsOnEmptyServer = false;
|
||||
|
||||
@Comment("\nShould backups be made on server shutdown\n")
|
||||
@Comment("\nShould backup be made on server shutdown\n")
|
||||
public boolean shutdownBackup = true;
|
||||
|
||||
@Comment("\nA path to backup folder\n")
|
||||
public String path = "backup/";
|
||||
|
||||
@Comment("\nThis setting allows you to exclude files form being backuped.\n"+
|
||||
"Be very careful when setting it, as it is easy to make your backuped world unusable!\n")
|
||||
"Be very careful when setting it, as it is easy corrupt your world!\n")
|
||||
public Set<String> fileBlacklist = new HashSet<>();
|
||||
|
||||
@Comment("\nShould every world has its won backup folder?\n")
|
||||
public boolean perWorldBackup = false;
|
||||
|
||||
@Comment("\nMaximum number of backups to keep. If 0 then no backup will be deleted based on its amount\n")
|
||||
@Comment("\nMaximum number of backups to keep. If set to 0 then no backup will be deleted based their its amount\n")
|
||||
public int backupsToKeep = 10;
|
||||
|
||||
@Comment("\nMaximum age of backups to keep in seconds.\n if 0 then backups will not be deleted based on its age \n")
|
||||
@Comment("\nMaximum age of backups to keep in seconds.\n If set to 0 then backups will not be deleted based their its age \n")
|
||||
public long maxAge = 0;
|
||||
|
||||
@Comment("\nMaximum size of backup folder in kilo bytes. \n")
|
||||
@Comment("\nMaximum size of backup folder in kilo bytes (1024).\n")
|
||||
public int maxSize = 0;
|
||||
|
||||
@Comment("\nCompression level \n0 - 9\n Only available for zip compression.\n")
|
||||
@Comment("\nCompression level \n0 - 9\n Only affects zip compression.\n")
|
||||
public int compression = 6;
|
||||
|
||||
@Comment(value = "\nAvailable formats are:\n" +
|
||||
@ -82,7 +82,9 @@ public class ConfigHandler {
|
||||
@Comment("\nPlayers banned from running backup commands besides their sufficient permission level\n")
|
||||
public Set<String> playerBlacklist = new HashSet<>();
|
||||
|
||||
@Comment("\nFormat of date&time used to name backup files.\n")
|
||||
@Comment("\nFormat of date&time used to name backup files.\n" +
|
||||
"Remember not to use '#' symbol and any other character that is not allowed by your operating system such as:\n" +
|
||||
"':', '\\', etc\n")
|
||||
public String dateTimeFormat = "dd.MM.yyyy_HH-mm-ss";
|
||||
|
||||
public enum ArchiveFormat {
|
||||
|
@ -58,7 +58,7 @@ public class TextileBackup implements ModInitializer {
|
||||
!config.playerBlacklist.contains(ctx.getEntityOrThrow().getEntityName())) ||
|
||||
(ctx.getMinecraftServer().isSinglePlayer() &&
|
||||
config.alwaysSingleplayerAllowed);
|
||||
}catch (Exception e){ //Command was called from server console.
|
||||
} catch (Exception e) { //Command was called from server console.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -98,7 +98,9 @@ public class BackupHelper {
|
||||
Utilities.log("Deleting: " + f.getName(), ctx);
|
||||
f.delete();
|
||||
}
|
||||
} catch (NullPointerException ignored3) {}
|
||||
} catch (NullPointerException ignored3) {
|
||||
Utilities.error("File: " + f.getName() + ", was not deleted beacuse could not parse date and time. Please delete it by hand.", ctx);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class MakeBackupThread implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
File world = ((MinecraftServerSessionAccessor)server) // I'm lost.
|
||||
File world = ((MinecraftServerSessionAccessor)server)
|
||||
.getSession()
|
||||
.method_27424(RegistryKey.of(Registry.DIMENSION, DimensionType.OVERWORLD_REGISTRY_KEY.getValue()));
|
||||
|
||||
|
@ -2,10 +2,8 @@ package net.szum123321.textile_backup.core;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
import net.minecraft.server.dedicated.DedicatedServer;
|
||||
import net.minecraft.server.dedicated.MinecraftDedicatedServer;
|
||||
import net.minecraft.server.integrated.IntegratedServer;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.szum123321.textile_backup.TextileBackup;
|
||||
import net.szum123321.textile_backup.mixin.MinecraftServerSessionAccessor;
|
||||
|
||||
@ -17,11 +15,6 @@ public class Utilities {
|
||||
return ((MinecraftServerSessionAccessor)server).getSession().getDirectoryName();
|
||||
}
|
||||
|
||||
public static boolean isWindows(){
|
||||
String os = System.getProperty("os.name");
|
||||
return os.toLowerCase().startsWith("win");
|
||||
}
|
||||
|
||||
public static boolean isBlacklisted(Path path) {
|
||||
for(String i : TextileBackup.config.fileBlacklist) {
|
||||
if(path.startsWith(i))
|
||||
@ -38,12 +31,8 @@ public class Utilities {
|
||||
return getBackupDateTimeFormatter();
|
||||
}
|
||||
|
||||
public static DateTimeFormatter getBackupDateTimeFormatter(){
|
||||
if(isWindows()){
|
||||
return DateTimeFormatter.ofPattern("dd.MM.yyyy_HH-mm-ss");
|
||||
} else {
|
||||
return DateTimeFormatter.ofPattern("dd.MM.yyyy_HH:mm:ss");
|
||||
}
|
||||
public static DateTimeFormatter getBackupDateTimeFormatter() {
|
||||
return DateTimeFormatter.ofPattern("dd.MM.yyyy_HH-mm-ss");
|
||||
}
|
||||
|
||||
public static void log(String s, ServerCommandSource ctx){
|
||||
@ -56,7 +45,7 @@ public class Utilities {
|
||||
|
||||
public static void error(String s, ServerCommandSource ctx){
|
||||
if(ctx != null)
|
||||
ctx.sendFeedback(new LiteralText(s), true);
|
||||
ctx.sendFeedback(new LiteralText(s).styled(style -> style.withColor(Formatting.RED)), true);
|
||||
|
||||
if(TextileBackup.config.log)
|
||||
TextileBackup.logger.error(s);
|
||||
|
@ -27,7 +27,7 @@
|
||||
],
|
||||
|
||||
"depends": {
|
||||
"fabricloader": ">=0.7.2",
|
||||
"fabricloader": ">=0.8.8",
|
||||
"fabric": "*",
|
||||
"minecraft": "1.16.1"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user