diff --git a/Tasks/src/main/java/fr/altarik/toolbox/task/Task.java b/Tasks/src/main/java/fr/altarik/toolbox/task/server/DedicatedServerTask.java similarity index 78% rename from Tasks/src/main/java/fr/altarik/toolbox/task/Task.java rename to Tasks/src/main/java/fr/altarik/toolbox/task/server/DedicatedServerTask.java index f2d163a..29b4785 100644 --- a/Tasks/src/main/java/fr/altarik/toolbox/task/Task.java +++ b/Tasks/src/main/java/fr/altarik/toolbox/task/server/DedicatedServerTask.java @@ -1,22 +1,26 @@ -package fr.altarik.toolbox.task; +package fr.altarik.toolbox.task.server; +import fr.altarik.toolbox.task.PeriodicTaskI; +import fr.altarik.toolbox.task.TaskI; import fr.altarik.toolbox.task.async.AsyncPeriodicTasks; import fr.altarik.toolbox.task.async.AsyncTaskI; import fr.altarik.toolbox.task.async.AsyncTasks; import fr.altarik.toolbox.task.sync.PeriodicSyncTask; -import net.fabricmc.api.ModInitializer; +import net.fabricmc.api.DedicatedServerModInitializer; -public class Task implements ModInitializer { +public class DedicatedServerTask implements DedicatedServerModInitializer { + @SuppressWarnings("unused") public final TaskI asyncWorkers = AsyncTasks.initialize(); + @SuppressWarnings("unused") public final PeriodicTaskI periodicSyncTask = PeriodicSyncTask.initialize(); - + @SuppressWarnings("unused") public final AsyncTaskI asyncTasks = AsyncTasks.initialize(); - + @SuppressWarnings("unused") public final PeriodicTaskI periodicAsyncTask = AsyncPeriodicTasks.initialize(); @Override - public void onInitialize() { + public void onInitializeServer() { /* try { asyncWorkers.addTask(new AltarikRunnable() { @Override @@ -47,6 +51,7 @@ public class Task implements ModInitializer { } */ } + @SuppressWarnings("unused") public TaskI getAsyncWorkers() { return asyncWorkers; } diff --git a/Tasks/src/main/resources/fabric.mod.json b/Tasks/src/main/resources/fabric.mod.json index 853c737..a03be36 100644 --- a/Tasks/src/main/resources/fabric.mod.json +++ b/Tasks/src/main/resources/fabric.mod.json @@ -17,8 +17,8 @@ "icon": "assets/tasks/icon.png", "environment": "*", "entrypoints": { - "main": [ - "fr.altarik.toolbox.task.Task" + "server": [ + "fr.altarik.toolbox.task.server.DedicatedServerTask" ] }, "mixins": [ diff --git a/build.gradle b/build.gradle index 333cd5f..51d2d7b 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,10 @@ plugins { } Properties local = new Properties() -local.load(new FileInputStream(rootProject.file("local.properties"))) +try { + local.load(new FileInputStream(rootProject.file("local.properties"))) +} catch (IOException ignored) {} + allprojects { apply plugin: 'maven-publish' @@ -42,8 +45,8 @@ allprojects { name 'altarik' url 'https://repo.altarik.fr/'.concat(project.version.endsWith('SNAPSHOT') ? 'snapshots/' : 'releases/') credentials { - username = System.getProperty("REPO_USERNAME", local.getProperty("repo_username")) - password = System.getProperty("REPO_PASSWORD", local.getProperty("repo_password")) + username = getEnv("REPO_USERNAME", local.getProperty("repo_username")) + password = getEnv("REPO_PASSWORD", local.getProperty("repo_password")) } } } @@ -98,6 +101,15 @@ dependencies { implementation subprojects.collect { project -> project } } +static def getEnv(String envName, String defaultValue) { + String r = System.getenv(envName) + if(r != null) { + return r + } else { + return defaultValue + } +} + /*jar { dependsOn subprojects.jar subprojects.each { project -> diff --git a/gradle.properties b/gradle.properties index 9dcf69e..72cb25d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ org.gradle.jvmargs=-Xmx3G - +fabric.loom.multiProjectOptimisation=true junit_version=5.9.0 minecraft_version=1.19.3 @@ -8,5 +8,4 @@ loader_version=0.14.14 fabric_version=0.75.1+1.19.3 maven_group=fr.altarik.toolbox -maven_version=4.3.0-SNAPSHOT -repo_username=Altarik +maven_version=4.3.1-SNAPSHOT