diff --git a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java
index fd7eb15f..aca76667 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java
@@ -21,10 +21,7 @@ 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;
@@ -39,15 +36,7 @@ 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));
+ LinkageUtils.link();
new BauServer();
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/linkage/LinkageType.java b/BauSystem_Main/src/de/steamwar/bausystem/linkage/LinkageType.java
new file mode 100644
index 00000000..8d1faf4f
--- /dev/null
+++ b/BauSystem_Main/src/de/steamwar/bausystem/linkage/LinkageType.java
@@ -0,0 +1,51 @@
+/*
+ * 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 de.steamwar.command.SWCommand;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import org.bukkit.Bukkit;
+import org.bukkit.event.Listener;
+
+import java.util.function.Consumer;
+import java.util.function.Predicate;
+
+@RequiredArgsConstructor
+@AllArgsConstructor
+public enum LinkageType {
+ LISTENER(clazz -> {
+ for (Class> interfaceClazz : clazz.getInterfaces()) {
+ if (interfaceClazz == Listener.class) {
+ return true;
+ }
+ }
+ return false;
+ }, o -> Bukkit.getPluginManager().registerEvents((Listener) o, BauSystem.getInstance())),
+ COMMAND(clazz -> clazz.getSuperclass() == SWCommand.class);
+
+ @Getter
+ private final Predicate> linkagePredicate;
+
+ @Getter
+ private Consumer