Add DataTracker and TrackedData #15
@ -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
|
||||
|
||||
|
@ -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, String> 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() {
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package fr.altarik.toolbox.core.data;
|
||||
|
||||
public record TrackedData(String name, String defaultValue) {
|
||||
|
||||
}
|
BIN
Core/src/main/resources/assets/core/icon.png
Normal file
BIN
Core/src/main/resources/assets/core/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
29
Core/src/main/resources/fabric.mod.json
Normal file
29
Core/src/main/resources/fabric.mod.json
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "toolbox-core",
|
||||
"version": "${version}",
|
||||
"name": "Core",
|
||||
"description": "",
|
||||
"authors": [
|
||||
"Altarik"
|
||||
],
|
||||
"contributors": [
|
||||
"Legot Quentin<legotquentin@gmail.com>"
|
||||
],
|
||||
"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"
|
||||
}
|
||||
}
|
BIN
Database/src/main/resources/assets/database/icon.png
Normal file
BIN
Database/src/main/resources/assets/database/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
29
Database/src/main/resources/fabric.mod.json
Normal file
29
Database/src/main/resources/fabric.mod.json
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "toolbox-database",
|
||||
"version": "${version}",
|
||||
"name": "Database",
|
||||
"description": "",
|
||||
"authors": [
|
||||
"Altarik"
|
||||
],
|
||||
"contributors": [
|
||||
"Legot Quentin<legotquentin@gmail.com>"
|
||||
],
|
||||
"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"
|
||||
}
|
||||
}
|
@ -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"
|
||||
|
@ -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",
|
||||
|
@ -92,6 +92,7 @@ allprojects {
|
||||
|
||||
dependencies {
|
||||
include subprojects.collect { project -> project }
|
||||
implementation subprojects.collect { project -> project }
|
||||
}
|
||||
|
||||
/*jar {
|
||||
|
@ -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
|
||||
|
@ -10,4 +10,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
rootProject.name = 'Toolbox'
|
||||
include(':Tasks', ':Database', ':Pagination', ':Core')
|
||||
include(':Tasks')
|
||||
include(':Database')
|
||||
include(':Pagination')
|
||||
include(':Core')
|
||||
|
BIN
src/main/resources/assets/toolbox/icon.png
Normal file
BIN
src/main/resources/assets/toolbox/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
@ -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}"
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user