diff --git a/LICENSE.txt b/LICENSE_FORGE.txt similarity index 100% rename from LICENSE.txt rename to LICENSE_FORGE.txt diff --git a/README.txt b/README_FORGE.txt similarity index 100% rename from README.txt rename to README_FORGE.txt diff --git a/build.gradle b/build.gradle index 5c55a1d..dec4991 100644 --- a/build.gradle +++ b/build.gradle @@ -1,151 +1,151 @@ -buildscript { - repositories { - maven { url = 'https://files.minecraftforge.net/maven' } - jcenter() - mavenCentral() - } - dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true - } -} -apply plugin: 'net.minecraftforge.gradle' -// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. -apply plugin: 'eclipse' -apply plugin: 'maven-publish' - -version = '1.0' -group = 'net.szum123321.TextileBackup' // http://maven.apache.org/guides/mini/guide-naming-conventions.html -archivesBaseName = 'textile_backup' - -sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. - -minecraft { - // The mappings can be changed at any time, and must be in the following format. - // snapshot_YYYYMMDD Snapshot are built nightly. - // stable_# Stables are built at the discretion of the MCP team. - // Use non-default mappings at your own risk. they may not always work. - // Simply re-run your setup task after changing the mappings to update your workspace. - mappings channel: 'snapshot', version: '20190719-1.14.3' - // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. - - // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') - - // Default run configurations. - // These can be tweaked, removed, or duplicated as needed. - runs { - client { - workingDirectory project.file('run') - - // Recommended logging data for a userdev environment - property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' - - // Recommended logging level for the console - property 'forge.logging.console.level', 'debug' - - mods { - examplemod { - source sourceSets.main - } - } - } - - server { - workingDirectory project.file('run') - - // Recommended logging data for a userdev environment - property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' - - // Recommended logging level for the console - property 'forge.logging.console.level', 'debug' - - mods { - examplemod { - source sourceSets.main - } - } - } - - data { - workingDirectory project.file('run') - - // Recommended logging data for a userdev environment - property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' - - // Recommended logging level for the console - property 'forge.logging.console.level', 'debug' - - args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/') - - mods { - examplemod { - source sourceSets.main - } - } - } - } -} - -dependencies { - // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed - // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied. - // The userdev artifact is a special name and will get all sorts of transformations applied to it. - minecraft 'net.minecraftforge:forge:1.14.4-28.2.0' - - compile "blue.endless:jankson:1.2.0" - - // You may put jars on which you depend on in ./libs or you may define them like so.. - // compile "some.group:artifact:version:classifier" - // compile "some.group:artifact:version" - - // Real examples - // compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env - // compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env - - // The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime. - // provided 'com.mod-buildcraft:buildcraft:6.0.8:dev' - - // These dependencies get remapped to your current MCP mappings - // deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev' - - // For more info... - // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html - // http://www.gradle.org/docs/current/userguide/dependency_management.html - -} - -// Example for how to get properties into the manifest for reading by the runtime.. -jar { - manifest { - attributes([ - "Specification-Title": "examplemod", - "Specification-Vendor": "examplemodsareus", - "Specification-Version": "1", // We are version 1 of ourselves - "Implementation-Title": project.name, - "Implementation-Version": "${version}", - "Implementation-Vendor" :"examplemodsareus", - "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") - ]) - } -} - -// Example configuration to allow publishing using the maven-publish task -// we define a custom artifact that is sourced from the reobfJar output task -// and then declare that to be published -// Note you'll need to add a repository here -def reobfFile = file("$buildDir/reobfJar/output.jar") -def reobfArtifact = artifacts.add('default', reobfFile) { - type 'jar' - builtBy 'reobfJar' -} -publishing { - publications { - mavenJava(MavenPublication) { - artifact reobfArtifact - } - } - repositories { - maven { - url "file:///${project.projectDir}/mcmodsrepo" - } - } +buildscript { + repositories { + maven { url = 'https://files.minecraftforge.net/maven' } + jcenter() + mavenCentral() + } + dependencies { + classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true + } +} +apply plugin: 'net.minecraftforge.gradle' +// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. +apply plugin: 'eclipse' +apply plugin: 'maven-publish' + +version = '1.1.1-1.14.4' +group = 'szum123321.textile_backup' // http://maven.apache.org/guides/mini/guide-naming-conventions.html +archivesBaseName = 'textile_backup[FORGE]' + +sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. + +minecraft { + // The mappings can be changed at any time, and must be in the following format. + // snapshot_YYYYMMDD Snapshot are built nightly. + // stable_# Stables are built at the discretion of the MCP team. + // Use non-default mappings at your own risk. they may not always work. + // Simply re-run your setup task after changing the mappings to update your workspace. + mappings channel: 'snapshot', version: '20190719-1.14.3' + // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. + + // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') + + // Default run configurations. + // These can be tweaked, removed, or duplicated as needed. + runs { + client { + workingDirectory project.file('run') + + // Recommended logging data for a userdev environment + property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' + + // Recommended logging level for the console + property 'forge.logging.console.level', 'debug' + + mods { + examplemod { + source sourceSets.main + } + } + } + + server { + workingDirectory project.file('run') + + // Recommended logging data for a userdev environment + property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' + + // Recommended logging level for the console + property 'forge.logging.console.level', 'debug' + + mods { + examplemod { + source sourceSets.main + } + } + } + + data { + workingDirectory project.file('run') + + // Recommended logging data for a userdev environment + property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' + + // Recommended logging level for the console + property 'forge.logging.console.level', 'debug' + + args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/') + + mods { + examplemod { + source sourceSets.main + } + } + } + } +} + +dependencies { + // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed + // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied. + // The userdev artifact is a special name and will get all sorts of transformations applied to it. + minecraft 'net.minecraftforge:forge:1.14.4-28.2.0' + + compile "blue.endless:jankson:1.2.0" + + // You may put jars on which you depend on in ./libs or you may define them like so.. + // compile "some.group:artifact:version:classifier" + // compile "some.group:artifact:version" + + // Real examples + // compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env + // compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env + + // The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime. + // provided 'com.mod-buildcraft:buildcraft:6.0.8:dev' + + // These dependencies get remapped to your current MCP mappings + // deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev' + + // For more info... + // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html + // http://www.gradle.org/docs/current/userguide/dependency_management.html + +} + +// Example for how to get properties into the manifest for reading by the runtime.. +jar { + manifest { + attributes([ + "Specification-Title": "Textile Backup", + "Specification-Vendor": "Szum123321", + "Specification-Version": "1", // We are version 1 of ourselves + "Implementation-Title": project.name, + "Implementation-Version": "${version}", + "Implementation-Vendor" :"Szum123321", + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") + ]) + } +} + +// Example configuration to allow publishing using the maven-publish task +// we define a custom artifact that is sourced from the reobfJar output task +// and then declare that to be published +// Note you'll need to add a repository here +def reobfFile = file("$buildDir/reobfJar/output.jar") +def reobfArtifact = artifacts.add('default', reobfFile) { + type 'jar' + builtBy 'reobfJar' +} +publishing { + publications { + mavenJava(MavenPublication) { + artifact reobfArtifact + } + } + repositories { + maven { + url "file:///${project.projectDir}/mcmodsrepo" + } + } } \ No newline at end of file diff --git a/src/main/java/szum123321/textile_backup/ConfigHandler.java b/src/main/java/szum123321/textile_backup/ConfigHandler.java index 18fd173..836a8af 100644 --- a/src/main/java/szum123321/textile_backup/ConfigHandler.java +++ b/src/main/java/szum123321/textile_backup/ConfigHandler.java @@ -65,19 +65,18 @@ public class ConfigHandler { public static ConfigData loadConfig(){ File configFile = getConfigFile(); - if(!configFile.exists()) { - TextileBackup.logger.info("Creating new config file"); + if(!configFile.exists()) saveConfig(new ConfigData()); - } try { Jankson jankson = Jankson.builder().build(); return jankson.fromJson(jankson.load(configFile), ConfigData.class); - } catch (IOException | SyntaxError e) { + } catch (IOException e) { + TextileBackup.logger.error(e.getMessage()); + } catch(SyntaxError e) { TextileBackup.logger.error(e.getMessage()); } - TextileBackup.logger.info("Loading default config!"); return new ConfigData(); } diff --git a/src/main/java/szum123321/textile_backup/TextileBackup.java b/src/main/java/szum123321/textile_backup/TextileBackup.java index 8c92e01..9cbd515 100644 --- a/src/main/java/szum123321/textile_backup/TextileBackup.java +++ b/src/main/java/szum123321/textile_backup/TextileBackup.java @@ -46,12 +46,10 @@ public class TextileBackup { } public void setup(FMLCommonSetupEvent event){ - MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(ServerBackupScheduler.class); config = ConfigHandler.loadConfig(); - logger.info("Now"); } @SubscribeEvent diff --git a/src/main/java/szum123321/textile_backup/core/ServerBackupScheduler.java b/src/main/java/szum123321/textile_backup/core/ServerBackupScheduler.java index 91ac116..d8a08f0 100644 --- a/src/main/java/szum123321/textile_backup/core/ServerBackupScheduler.java +++ b/src/main/java/szum123321/textile_backup/core/ServerBackupScheduler.java @@ -32,13 +32,10 @@ public class ServerBackupScheduler { @SubscribeEvent public static void onServerTick(TickEvent.ServerTickEvent event) { if(event.phase == TickEvent.Phase.START) { - TextileBackup.logger.info("Diiff: " + (System.currentTimeMillis() - lastBackupTime)); if(System.currentTimeMillis() - lastBackupTime >= TextileBackup.config.backupInterval * 1000) { if(server.getPlayerList().getCurrentPlayerCount() > 0 || TextileBackup.config.doBackupsOnEmptyServer) BackupHelper.create(server, null, true, null); - TextileBackup.logger.info("Time: " + lastBackupTime); - lastBackupTime = System.currentTimeMillis(); } } @@ -48,9 +45,6 @@ public class ServerBackupScheduler { public static void onServerStarted(FMLServerStartingEvent event) { server = event.getServer(); lastBackupTime = System.currentTimeMillis(); - - TextileBackup.logger.info("Server Starting at: " + lastBackupTime); - TextileBackup.logger.info("Interval is: " + TextileBackup.config.backupInterval); } @SubscribeEvent diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index bab0560..d12f239 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -1,17 +1,15 @@ modLoader="javafml" #mandatory loaderVersion="[28,)" #mandatory (28 is current forge version) -issueTrackerURL="http://my.issue.tracker/" #optional +issueTrackerURL="https://github.com/Szum123321/textile_backup/issues" #optional [[mods]] #mandatory -# The modid of the mod modId="textile_backup" #mandatory -version="${file.jarVersion}" #mandatory +version="[Forge]1.1.1-1.14.4" #mandatory displayName="Textile Backup" #mandatory -# A URL to query for updates for this mod. See the JSON update specification updateJSONURL="http://myurl.me/" #optional -displayURL="http://example.com/" #optional -logoFile="examplemod.png" #optional -credits="Thanks for this example mod goes to Java" #optional +displayURL="https://www.curseforge.com/minecraft/mc-mods/textile-backup" #optional +logoFile="textile_backup.png" #optional +credits="Made on request of one of curseforge users" #optional authors="Szum123321" #optional description=''' diff --git a/src/main/resources/textile_backup.png b/src/main/resources/textile_backup.png new file mode 100644 index 0000000..0499833 Binary files /dev/null and b/src/main/resources/textile_backup.png differ diff --git a/update.json b/update.json new file mode 100644 index 0000000..09f592a --- /dev/null +++ b/update.json @@ -0,0 +1,10 @@ +{ + "homepage": "https://www.curseforge.com/minecraft/mc-mods/textile-backup", + "promos": { + "1.14.4-latest": "1.1.1-1.14.4", + "1.14.4-recommended": "1.1.1-1.14.4" + }, + "1.14.4": { + "1.1.1": "Initial release for forge" + } +} \ No newline at end of file