diff --git a/BauSystem_Main/build.gradle b/BauSystem_Main/build.gradle
index 1de23ece..0f115ae6 100644
--- a/BauSystem_Main/build.gradle
+++ b/BauSystem_Main/build.gradle
@@ -51,8 +51,19 @@ dependencies {
annotationProcessor 'org.projectlombok:lombok:1.18.6'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.6'
+ implementation 'org.atteo.classindex:classindex:3.4'
+ testImplementation 'org.atteo.classindex:classindex:3.4'
+ annotationProcessor 'org.atteo.classindex:classindex:3.4'
+ testAnnotationProcessor 'org.atteo.classindex:classindex:3.4'
+
compileOnly files("${projectDir}/../lib/Spigot-1.15.jar")
compileOnly files("${projectDir}/../lib/WorldEdit-1.15.jar")
compileOnly files("${projectDir}/../lib/ProtocolLib.jar")
compileOnly files("${projectDir}/../lib/SpigotCore.jar")
}
+
+processResources {
+ from("build/classes/java/main/META-INF/annotations/") {
+ into("de.steamwar.bausystem")
+ }
+}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java
index b480c822..fd7eb15f 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java
@@ -20,7 +20,11 @@
package de.steamwar.bausystem;
import de.steamwar.bausystem.config.BauServer;
+import de.steamwar.bausystem.linkage.LinkageUtils;
+import de.steamwar.bausystem.linkage.LinkedCommand;
+import de.steamwar.bausystem.linkage.LinkedListener;
import lombok.Getter;
+import org.bukkit.Bukkit;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
@@ -35,6 +39,16 @@ public class BauSystem extends JavaPlugin implements Listener {
public void onEnable() {
instance = this;
+ LinkageUtils.link(LinkedCommand.class, clazz -> clazz.getSuperclass() == de.steamwar.command.SWCommand.class, o -> {});
+ LinkageUtils.link(LinkedListener.class, clazz -> {
+ for (Class> interfaceClazz : clazz.getInterfaces()) {
+ if (interfaceClazz == Listener.class) {
+ return true;
+ }
+ }
+ return false;
+ }, o -> Bukkit.getPluginManager().registerEvents((Listener) o, BauSystem.instance));
+
new BauServer();
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/linkage/LinkageUtils.java b/BauSystem_Main/src/de/steamwar/bausystem/linkage/LinkageUtils.java
new file mode 100644
index 00000000..c91c6e2f
--- /dev/null
+++ b/BauSystem_Main/src/de/steamwar/bausystem/linkage/LinkageUtils.java
@@ -0,0 +1,66 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2021 SteamWar.de-Serverteam
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package de.steamwar.bausystem.linkage;
+
+import de.steamwar.bausystem.BauSystem;
+import lombok.experimental.UtilityClass;
+import org.bukkit.Bukkit;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.function.Consumer;
+import java.util.function.Predicate;
+
+@UtilityClass
+public class LinkageUtils {
+
+ public void link(Class> source, Predicate> loadPredicate, Consumer