diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index 80ad767..3444f5f 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -32,7 +32,7 @@ jobs: if: ${{ runner.os != 'Windows' }} run: chmod +x ./gradlew - name: build - run: ./gradlew build --no-daemon + run: ./gradlew build --no-daemon --max-workers 1 #- name: test # run: ./gradlew test --no-daemon diff --git a/Core/src/main/java/fr/altarik/toolbox/core/data/DataTracker.java b/Core/src/main/java/fr/altarik/toolbox/core/data/DataTracker.java new file mode 100644 index 0000000..aa9bcb9 --- /dev/null +++ b/Core/src/main/java/fr/altarik/toolbox/core/data/DataTracker.java @@ -0,0 +1,37 @@ +package fr.altarik.toolbox.core.data; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +public class DataTracker { + + private final Map trackedData; + + public DataTracker() { + this.trackedData = new HashMap<>(); + } + + public void startTracking(TrackedData data) { + trackedData.put(data, data.defaultValue()); + } + + public String getOrDefault(TrackedData data) { + return Objects.requireNonNull(trackedData.get(data)); + } + + public void set(TrackedData data, String value) { + String v = trackedData.get(data); + if(v != null) { + trackedData.putIfAbsent(data, value); + } else { + throw new IllegalArgumentException("Data " + data.name() + " is not tracked, please initialize it with DataTracker#startTracking(TrackedData, String) first"); + } + + } + + public void saveToDb() { + + } + +} diff --git a/Core/src/main/java/fr/altarik/toolbox/core/data/TrackedData.java b/Core/src/main/java/fr/altarik/toolbox/core/data/TrackedData.java new file mode 100644 index 0000000..c8bec33 --- /dev/null +++ b/Core/src/main/java/fr/altarik/toolbox/core/data/TrackedData.java @@ -0,0 +1,5 @@ +package fr.altarik.toolbox.core.data; + +public record TrackedData(String name, String defaultValue) { + +} diff --git a/Core/src/main/resources/assets/core/icon.png b/Core/src/main/resources/assets/core/icon.png new file mode 100644 index 0000000..1049a98 Binary files /dev/null and b/Core/src/main/resources/assets/core/icon.png differ diff --git a/Core/src/main/resources/fabric.mod.json b/Core/src/main/resources/fabric.mod.json new file mode 100644 index 0000000..65236f7 --- /dev/null +++ b/Core/src/main/resources/fabric.mod.json @@ -0,0 +1,29 @@ +{ + "schemaVersion": 1, + "id": "toolbox-core", + "version": "${version}", + "name": "Core", + "description": "", + "authors": [ + "Altarik" + ], + "contributors": [ + "Legot Quentin" + ], + "contact": { + "homepage": "https://altarik.fr" + }, + "license": "Altarik @ All-Rights-Reserved ", + "icon": "assets/core/icon.png", + "environment": "*", + "entrypoints": { + "main": [] + }, + "mixins": [], + "depends": { + "fabricloader": "^0.14.12", + "fabric-api": "*", + "minecraft": "1.19.3", + "java": ">=17" + } +} diff --git a/Database/src/main/resources/assets/database/icon.png b/Database/src/main/resources/assets/database/icon.png new file mode 100644 index 0000000..1049a98 Binary files /dev/null and b/Database/src/main/resources/assets/database/icon.png differ diff --git a/Database/src/main/resources/fabric.mod.json b/Database/src/main/resources/fabric.mod.json new file mode 100644 index 0000000..6f9451d --- /dev/null +++ b/Database/src/main/resources/fabric.mod.json @@ -0,0 +1,29 @@ +{ + "schemaVersion": 1, + "id": "toolbox-database", + "version": "${version}", + "name": "Database", + "description": "", + "authors": [ + "Altarik" + ], + "contributors": [ + "Legot Quentin" + ], + "contact": { + "homepage": "https://altarik.fr" + }, + "license": "Altarik @ All-Rights-Reserved ", + "icon": "assets/database/icon.png", + "environment": "*", + "entrypoints": { + "main": [] + }, + "mixins": [], + "depends": { + "fabricloader": "^0.14.12", + "fabric-api": "*", + "minecraft": "1.19.3", + "java": ">=17" + } +} diff --git a/Pagination/build.gradle b/Pagination/build.gradle deleted file mode 100644 index e69de29..0000000 diff --git a/Pagination/src/main/resources/fabric.mod.json b/Pagination/src/main/resources/fabric.mod.json index 52051dc..68cc742 100644 --- a/Pagination/src/main/resources/fabric.mod.json +++ b/Pagination/src/main/resources/fabric.mod.json @@ -1,8 +1,8 @@ { "schemaVersion": 1, - "id": "pagination", + "id": "toolbox-pagination", "version": "${version}", - "name": "Task", + "name": "Pagination", "description": "A mod to use to paginate long result to player in chat", "authors": [ "Altarik" diff --git a/Tasks/build.gradle b/Tasks/build.gradle deleted file mode 100644 index e69de29..0000000 diff --git a/Tasks/src/main/resources/fabric.mod.json b/Tasks/src/main/resources/fabric.mod.json index c7940a1..217672b 100644 --- a/Tasks/src/main/resources/fabric.mod.json +++ b/Tasks/src/main/resources/fabric.mod.json @@ -1,6 +1,6 @@ { "schemaVersion": 1, - "id": "task", + "id": "toolbox-task", "version": "${version}", "name": "Task", "description": "A mod to use as a dependency for others to schedule tasks", diff --git a/build.gradle b/build.gradle index e6c86e7..f291487 100644 --- a/build.gradle +++ b/build.gradle @@ -92,6 +92,7 @@ allprojects { dependencies { include subprojects.collect { project -> project } + implementation subprojects.collect { project -> project } } /*jar { diff --git a/gradle.properties b/gradle.properties index 16c0d2a..59d1cfe 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,6 +8,6 @@ loader_version=0.14.14 fabric_version=0.75.1+1.19.3 maven_group=fr.altarik.toolbox -maven_version=4.0.0-SNAPSHOT +maven_version=4.1.0-SNAPSHOT repo_username=Altarik repo_password=password diff --git a/settings.gradle b/settings.gradle index 4a814ce..c266500 100644 --- a/settings.gradle +++ b/settings.gradle @@ -10,4 +10,7 @@ pluginManagement { } rootProject.name = 'Toolbox' -include(':Tasks', ':Database', ':Pagination', ':Core') +include(':Tasks') +include(':Database') +include(':Pagination') +include(':Core') diff --git a/src/main/resources/assets/toolbox/icon.png b/src/main/resources/assets/toolbox/icon.png new file mode 100644 index 0000000..1049a98 Binary files /dev/null and b/src/main/resources/assets/toolbox/icon.png differ diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 797e8d6..ce07720 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -14,13 +14,17 @@ "homepage": "https://altarik.fr" }, "license": "Altarik @ All-Rights-Reserved ", - "icon": "assets/quests/icon.png", + "icon": "assets/toolbox/icon.png", "environment": "*", "depends": { "fabricloader": "^0.14.12", "fabric-api": "*", "minecraft": "1.19.3", - "java": ">=17" + "java": ">=17", + "toolbox-core": "${version}", + "toolbox-database": "${version}", + "toolbox-pagination": "${version}", + "toolbox-task": "${version}" } }