Some changes. Slowly approaching forge....

Forge-1.14.4
Szum123321 2020-04-10 22:07:34 +02:00
parent 6c2715f652
commit 73bee53ee7
9 changed files with 169 additions and 170 deletions

View File

@ -13,9 +13,9 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse' apply plugin: 'eclipse'
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
version = '1.0' version = '1.1.1-1.14.4'
group = 'net.szum123321.TextileBackup' // http://maven.apache.org/guides/mini/guide-naming-conventions.html group = 'szum123321.textile_backup' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'textile_backup' archivesBaseName = 'textile_backup[FORGE]'
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
@ -117,12 +117,12 @@ dependencies {
jar { jar {
manifest { manifest {
attributes([ attributes([
"Specification-Title": "examplemod", "Specification-Title": "Textile Backup",
"Specification-Vendor": "examplemodsareus", "Specification-Vendor": "Szum123321",
"Specification-Version": "1", // We are version 1 of ourselves "Specification-Version": "1", // We are version 1 of ourselves
"Implementation-Title": project.name, "Implementation-Title": project.name,
"Implementation-Version": "${version}", "Implementation-Version": "${version}",
"Implementation-Vendor" :"examplemodsareus", "Implementation-Vendor" :"Szum123321",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
]) ])
} }

View File

@ -65,19 +65,18 @@ public class ConfigHandler {
public static ConfigData loadConfig(){ public static ConfigData loadConfig(){
File configFile = getConfigFile(); File configFile = getConfigFile();
if(!configFile.exists()) { if(!configFile.exists())
TextileBackup.logger.info("Creating new config file");
saveConfig(new ConfigData()); saveConfig(new ConfigData());
}
try { try {
Jankson jankson = Jankson.builder().build(); Jankson jankson = Jankson.builder().build();
return jankson.fromJson(jankson.load(configFile), ConfigData.class); 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.error(e.getMessage());
} }
TextileBackup.logger.info("Loading default config!");
return new ConfigData(); return new ConfigData();
} }

View File

@ -46,12 +46,10 @@ public class TextileBackup {
} }
public void setup(FMLCommonSetupEvent event){ public void setup(FMLCommonSetupEvent event){
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
MinecraftForge.EVENT_BUS.register(ServerBackupScheduler.class); MinecraftForge.EVENT_BUS.register(ServerBackupScheduler.class);
config = ConfigHandler.loadConfig(); config = ConfigHandler.loadConfig();
logger.info("Now");
} }
@SubscribeEvent @SubscribeEvent

View File

@ -32,13 +32,10 @@ public class ServerBackupScheduler {
@SubscribeEvent @SubscribeEvent
public static void onServerTick(TickEvent.ServerTickEvent event) { public static void onServerTick(TickEvent.ServerTickEvent event) {
if(event.phase == TickEvent.Phase.START) { if(event.phase == TickEvent.Phase.START) {
TextileBackup.logger.info("Diiff: " + (System.currentTimeMillis() - lastBackupTime));
if(System.currentTimeMillis() - lastBackupTime >= TextileBackup.config.backupInterval * 1000) { if(System.currentTimeMillis() - lastBackupTime >= TextileBackup.config.backupInterval * 1000) {
if(server.getPlayerList().getCurrentPlayerCount() > 0 || TextileBackup.config.doBackupsOnEmptyServer) if(server.getPlayerList().getCurrentPlayerCount() > 0 || TextileBackup.config.doBackupsOnEmptyServer)
BackupHelper.create(server, null, true, null); BackupHelper.create(server, null, true, null);
TextileBackup.logger.info("Time: " + lastBackupTime);
lastBackupTime = System.currentTimeMillis(); lastBackupTime = System.currentTimeMillis();
} }
} }
@ -48,9 +45,6 @@ public class ServerBackupScheduler {
public static void onServerStarted(FMLServerStartingEvent event) { public static void onServerStarted(FMLServerStartingEvent event) {
server = event.getServer(); server = event.getServer();
lastBackupTime = System.currentTimeMillis(); lastBackupTime = System.currentTimeMillis();
TextileBackup.logger.info("Server Starting at: " + lastBackupTime);
TextileBackup.logger.info("Interval is: " + TextileBackup.config.backupInterval);
} }
@SubscribeEvent @SubscribeEvent

View File

@ -1,17 +1,15 @@
modLoader="javafml" #mandatory modLoader="javafml" #mandatory
loaderVersion="[28,)" #mandatory (28 is current forge version) 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 [[mods]] #mandatory
# The modid of the mod
modId="textile_backup" #mandatory modId="textile_backup" #mandatory
version="${file.jarVersion}" #mandatory version="[Forge]1.1.1-1.14.4" #mandatory
displayName="Textile Backup" #mandatory displayName="Textile Backup" #mandatory
# A URL to query for updates for this mod. See the JSON update specification <here>
updateJSONURL="http://myurl.me/" #optional updateJSONURL="http://myurl.me/" #optional
displayURL="http://example.com/" #optional displayURL="https://www.curseforge.com/minecraft/mc-mods/textile-backup" #optional
logoFile="examplemod.png" #optional logoFile="textile_backup.png" #optional
credits="Thanks for this example mod goes to Java" #optional credits="Made on request of one of curseforge users" #optional
authors="Szum123321" #optional authors="Szum123321" #optional
description=''' description='''

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

10
update.json Normal file
View File

@ -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"
}
}