aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoranhgelus <anhgelus.morhtuuzh@proton.me>2024-07-29 13:06:15 +0000
committeranhgelus <anhgelus.morhtuuzh@proton.me>2024-07-29 13:06:15 +0000
commita0f75bb9fd47e95312c47802065af8e12a26eb00 (patch)
tree2a1eedb4aee04ceae128e430c872b2c270d7be4c
parentfd66b7e84e5fb9557593359732dedca1842256f3 (diff)
feat(config): create config file with midnight lib
-rw-r--r--build.gradle5
-rw-r--r--gradle.properties3
-rw-r--r--src/main/java/world/anhgelus/manhunt/Config.java8
-rw-r--r--src/main/java/world/anhgelus/manhunt/Manhunt.java4
4 files changed, 19 insertions, 1 deletions
diff --git a/build.gradle b/build.gradle
index 5b1eefd..ca323a3 100644
--- a/build.gradle
+++ b/build.gradle
@@ -16,6 +16,9 @@ repositories {
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
+ maven {
+ url = "https://api.modrinth.com/maven"
+ }
}
loom {
@@ -39,6 +42,8 @@ dependencies {
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
+ modImplementation "maven.modrinth:midnightlib:${project.midnightlib_version}"
+ include "maven.modrinth:midnightlib:${project.midnightlib_version}"
}
processResources {
diff --git a/gradle.properties b/gradle.properties
index 341b60b..f286b4f 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -11,6 +11,9 @@ loader_version=0.15.11
# Fabric API
fabric_version=0.100.7+1.21
+# Libs
+midnightlib_version=1.5.7-fabric
+
# Mod Properties
mod_version=1.0.0
maven_group=world.anhgelus.manhunt
diff --git a/src/main/java/world/anhgelus/manhunt/Config.java b/src/main/java/world/anhgelus/manhunt/Config.java
new file mode 100644
index 0000000..d669de2
--- /dev/null
+++ b/src/main/java/world/anhgelus/manhunt/Config.java
@@ -0,0 +1,8 @@
+package world.anhgelus.manhunt;
+
+import eu.midnightdust.lib.config.MidnightConfig;
+
+public class Config extends MidnightConfig {
+ @Entry(category = "timings") public static int secondsBeforeRelease = 30;
+ @Entry(category = "timings") public static int updateCompassEach = 15;
+}
diff --git a/src/main/java/world/anhgelus/manhunt/Manhunt.java b/src/main/java/world/anhgelus/manhunt/Manhunt.java
index 3ababfd..3ebc2ad 100644
--- a/src/main/java/world/anhgelus/manhunt/Manhunt.java
+++ b/src/main/java/world/anhgelus/manhunt/Manhunt.java
@@ -3,6 +3,7 @@ package world.anhgelus.manhunt;
import com.mojang.brigadier.Command;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.builder.RequiredArgumentBuilder;
+import eu.midnightdust.lib.config.MidnightConfig;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.fabricmc.fabric.api.entity.event.v1.ServerPlayerEvents;
@@ -54,6 +55,7 @@ public class Manhunt implements ModInitializer {
@Override
public void onInitialize() {
LOGGER.info("Initializing Manhunt");
+ MidnightConfig.init(MOD_ID, Config.class);
final LiteralArgumentBuilder<ServerCommandSource> command = literal("manhunt");
@@ -215,7 +217,7 @@ public class Manhunt implements ModInitializer {
updateCompass(hunter, tracked);
}
}
- }, 30*1000, 15*1000);
+ }, Config.secondsBeforeRelease*1000L, Config.updateCompassEach*1000L);
}
private void updateCompass(ServerPlayerEntity player, ServerPlayerEntity tracked) {