diff --git a/.all-contributorsrc b/.all-contributorsrc
new file mode 100644
index 0000000..c3b9d68
--- /dev/null
+++ b/.all-contributorsrc
@@ -0,0 +1,39 @@
+{
+ "files": [
+ "README.md"
+ ],
+ "imageSize": 100,
+ "commit": false,
+ "contributors": [
+ {
+ "login": "wulkanat",
+ "name": "Wieland Schöbl",
+ "avatar_url": "https://avatars.githubusercontent.com/u/19289296?v=4",
+ "profile": "https://github.com/wulkanat",
+ "contributions": [
+ "test",
+ "code",
+ "doc",
+ "ideas"
+ ]
+ },
+ {
+ "login": "UnrealValentin",
+ "name": "UnrealValentin",
+ "avatar_url": "https://avatars.githubusercontent.com/u/30842467?v=4",
+ "profile": "https://github.com/UnrealValentin",
+ "contributions": [
+ "doc",
+ "test",
+ "code",
+ "ideas"
+ ]
+ }
+ ],
+ "contributorsPerLine": 7,
+ "projectName": "Core",
+ "projectOwner": "HMCore",
+ "repoType": "github",
+ "repoHost": "https://github.com",
+ "skipCi": true
+}
diff --git a/README.md b/README.md
index e544038..4ee1bdc 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,28 @@
# Core
+
+[](#contributors-)
+
## The Core Mod of HMCore which powers the whole system.
### TODO
+
+## Contributors ✨
+
+Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
+
+
+
+
+
+
+
+
+
+
+
+This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 4dced80..2318de4 100644
--- a/build.gradle
+++ b/build.gradle
@@ -19,7 +19,7 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib"
implementation 'com.google.code.gson:gson:2.8.6'
- testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0'
+ testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
}
diff --git a/src/main/java/org/hmcore/registration/config/ModuleInfo.java b/src/main/java/org/hmcore/registration/config/ModuleInfo.java
deleted file mode 100644
index 26b94dd..0000000
--- a/src/main/java/org/hmcore/registration/config/ModuleInfo.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.hmcore.registration.config;
-
-public class ModuleInfo {
-
- public final String moduleName;
- public final ObjectInfoData[] objects;
-
- public ModuleInfo(String moduleName, ObjectInfoData[] objects) {
- this.moduleName = moduleName;
- this.objects = objects;
- }
-}
diff --git a/src/main/java/org/hmcore/registration/config/ObjectInfoConfig.java b/src/main/java/org/hmcore/registration/config/ObjectInfoConfig.java
deleted file mode 100644
index 8bcd2df..0000000
--- a/src/main/java/org/hmcore/registration/config/ObjectInfoConfig.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.hmcore.registration.config;
-
-public class ObjectInfoConfig {
-
- public final ModuleInfo[] modules;
-
- public ObjectInfoConfig(ModuleInfo[] modules) {
- this.modules = modules;
- }
-}
diff --git a/src/main/java/org/hmcore/registration/config/ObjectInfoConfigHandler.java b/src/main/java/org/hmcore/registration/config/ObjectInfoConfigHandler.java
index 0902bf2..80d6815 100644
--- a/src/main/java/org/hmcore/registration/config/ObjectInfoConfigHandler.java
+++ b/src/main/java/org/hmcore/registration/config/ObjectInfoConfigHandler.java
@@ -43,10 +43,10 @@ public class ObjectInfoConfigHandler {
RegistryModule, ?> registryModule = (RegistryModule, ?>) module;
for (ObjectInfoData data:
moduleInfo.objects) {
- if(registryModule.objectAndInfoExist(data.objectName, data.objectInfoChoosen)) {
- registryModule.forceObjectInfoForObject(data.objectName, data.objectInfoChoosen);
+ if(registryModule.objectAndInfoExist(data.objectInfoName, data.objectInfoChosen)) {
+ registryModule.forceObjectInfoForObject(data.objectInfoName, data.objectInfoChosen);
} else {
- System.out.println("[!] Either Object Info " + data.objectInfoChoosen + " doesn't exist for " + data.objectName + " or " + data.objectName + " doesn't exist!\n" +
+ System.out.println("[!] Either Object Info " + data.objectInfoChosen + " doesn't exist for " + data.objectInfoName + " or " + data.objectInfoName + " doesn't exist!\n" +
"Please stop the Server, delete objetc-infos.json and let the server regenertate a new config [!]");
}
}
diff --git a/src/main/java/org/hmcore/registration/config/ObjectInfoData.java b/src/main/java/org/hmcore/registration/config/ObjectInfoData.java
deleted file mode 100644
index 7602584..0000000
--- a/src/main/java/org/hmcore/registration/config/ObjectInfoData.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.hmcore.registration.config;
-
-import org.jetbrains.annotations.Nullable;
-
-public class ObjectInfoData {
-
- public final String objectName;
- public final String objectInfoChoosen;
- public final String _availableOptions;
-
- public ObjectInfoData(String objectName, @Nullable String objectInfoChoosen, String availableOptions) {
- this.objectName = objectName;
- this.objectInfoChoosen = objectInfoChoosen == null ? "default" : objectInfoChoosen;
- _availableOptions = availableOptions;
- }
-}
diff --git a/src/main/kotlin/extensions/Array.kt b/src/main/kotlin/extensions/Array.kt
new file mode 100644
index 0000000..ce9b3f4
--- /dev/null
+++ b/src/main/kotlin/extensions/Array.kt
@@ -0,0 +1,7 @@
+package extensions
+
+/**
+ * Map a Java array to another Java array
+ */
+inline fun Array.map(crossinline transform: (T) -> I) =
+ Array(size) { transform(this[it]) }
\ No newline at end of file
diff --git a/src/main/kotlin/org/hmcore/registration/config/ModuleInfo.kt b/src/main/kotlin/org/hmcore/registration/config/ModuleInfo.kt
new file mode 100644
index 0000000..ebe41fc
--- /dev/null
+++ b/src/main/kotlin/org/hmcore/registration/config/ModuleInfo.kt
@@ -0,0 +1,6 @@
+package org.hmcore.registration.config
+
+internal class ModuleInfo(
+ @JvmField val moduleName: String,
+ @JvmField val objects: Array,
+)
\ No newline at end of file
diff --git a/src/main/kotlin/org/hmcore/registration/config/ObjectInfoConfig.kt b/src/main/kotlin/org/hmcore/registration/config/ObjectInfoConfig.kt
new file mode 100644
index 0000000..b236bef
--- /dev/null
+++ b/src/main/kotlin/org/hmcore/registration/config/ObjectInfoConfig.kt
@@ -0,0 +1,5 @@
+package org.hmcore.registration.config
+
+internal class ObjectInfoConfig(
+ @JvmField val modules: Array,
+)
\ No newline at end of file
diff --git a/src/main/kotlin/org/hmcore/registration/config/ObjectInfoConfigHandler.kt b/src/main/kotlin/org/hmcore/registration/config/ObjectInfoConfigHandler.kt
new file mode 100644
index 0000000..4446164
--- /dev/null
+++ b/src/main/kotlin/org/hmcore/registration/config/ObjectInfoConfigHandler.kt
@@ -0,0 +1,12 @@
+@file:JvmName("ObjectInfoConfigHandler")
+
+package org.hmcore.registration.config
+
+import com.google.gson.GsonBuilder
+import org.hmcore.modules.Module
+import extensions.map
+
+private val GSON = GsonBuilder().setPrettyPrinting().create()
+
+internal fun Array>.generateFreshJSON(): String =
+ GSON.toJson(ObjectInfoConfig(map { ModuleInfo(it.name, it.objectInfoArray) }))
\ No newline at end of file
diff --git a/src/main/kotlin/org/hmcore/registration/config/ObjectInfoData.kt b/src/main/kotlin/org/hmcore/registration/config/ObjectInfoData.kt
new file mode 100644
index 0000000..0d89f2c
--- /dev/null
+++ b/src/main/kotlin/org/hmcore/registration/config/ObjectInfoData.kt
@@ -0,0 +1,7 @@
+package org.hmcore.registration.config
+
+internal class ObjectInfoData @JvmOverloads constructor(
+ @JvmField val objectInfoName: String,
+ @JvmField val availableOptions: String,
+ @JvmField val objectInfoChosen: String = "default",
+)
\ No newline at end of file
diff --git a/src/test/java/org/hmcore/tests/JavaTests.java b/src/test/java/org/hmcore/tests/JavaTests.java
index 94504cc..058545f 100644
--- a/src/test/java/org/hmcore/tests/JavaTests.java
+++ b/src/test/java/org/hmcore/tests/JavaTests.java
@@ -12,6 +12,7 @@ import java.io.FileNotFoundException;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
+@SuppressWarnings("KotlinInternalInJava")
public class JavaTests {
@Test
diff --git a/src/test/java/org/hmcore/tests/modules/impl/JavaTestRegistryModule.java b/src/test/java/org/hmcore/tests/modules/impl/JavaTestRegistryModule.java
index c701e28..4f51d17 100644
--- a/src/test/java/org/hmcore/tests/modules/impl/JavaTestRegistryModule.java
+++ b/src/test/java/org/hmcore/tests/modules/impl/JavaTestRegistryModule.java
@@ -8,6 +8,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+@SuppressWarnings("KotlinInternalInJava")
public class JavaTestRegistryModule extends RegistryModule {
public HashMap objectMap = new HashMap<>();