From c7284dc7abd0c126f0107c70da429409bee8c41e Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Fri, 3 Oct 2025 13:33:31 +0200 Subject: [PATCH] Implement Linkage for SchematicSystem --- .../SchematicSystem_Core/build.gradle.kts | 2 ++ .../schematicsystem/SchematicSystem.java | 17 ++++----- .../commands/DownloadCommand.java | 2 ++ .../schematiccommand/SchematicCommand.java | 2 ++ .../SchematicCommandInitializer.java | 36 ------------------- .../schematiccommand/parts/CheckPart.java | 2 ++ .../schematiccommand/parts/MemberPart.java | 2 ++ .../schematiccommand/parts/ModifyPart.java | 2 ++ .../schematiccommand/parts/SavePart.java | 2 ++ .../schematiccommand/parts/SearchPart.java | 2 ++ .../schematiccommand/parts/ViewPart.java | 6 ++-- .../listener/PlayerEventListener.java | 2 ++ 12 files changed, 30 insertions(+), 47 deletions(-) delete mode 100644 SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/SchematicCommandInitializer.java diff --git a/SchematicSystem/SchematicSystem_Core/build.gradle.kts b/SchematicSystem/SchematicSystem_Core/build.gradle.kts index df9415f2..36a0e019 100644 --- a/SchematicSystem/SchematicSystem_Core/build.gradle.kts +++ b/SchematicSystem/SchematicSystem_Core/build.gradle.kts @@ -22,6 +22,8 @@ plugins { } dependencies { + compileOnly(libs.classindex) + annotationProcessor(libs.classindex) compileOnly(project(":SpigotCore", "default")) compileOnly(libs.spigotapi) diff --git a/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/SchematicSystem.java b/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/SchematicSystem.java index d6b94807..96267f9f 100644 --- a/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/SchematicSystem.java +++ b/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/SchematicSystem.java @@ -19,11 +19,9 @@ package de.steamwar.schematicsystem; +import de.steamwar.linkage.AbstractLinker; +import de.steamwar.linkage.SpigotLinker; import de.steamwar.message.Message; -import de.steamwar.schematicsystem.commands.DownloadCommand; -import de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommand; -import de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandInitializer; -import de.steamwar.schematicsystem.listener.PlayerEventListener; import org.bukkit.Bukkit; import org.bukkit.plugin.java.JavaPlugin; @@ -36,10 +34,13 @@ public class SchematicSystem extends JavaPlugin { public void onEnable() { instance = this; - SchematicCommandInitializer.init(); - new DownloadCommand(); - - Bukkit.getPluginManager().registerEvents(new PlayerEventListener(), this); + SpigotLinker spigotLinker = new SpigotLinker(this, MESSAGE); + try { + spigotLinker.link(); + } catch (AbstractLinker.LinkException e) { + e.printStackTrace(); + Bukkit.shutdown(); + } } public static SchematicSystem getInstance() { diff --git a/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/DownloadCommand.java b/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/DownloadCommand.java index 3e2f009d..f4fd1c29 100644 --- a/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/DownloadCommand.java +++ b/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/DownloadCommand.java @@ -20,6 +20,7 @@ package de.steamwar.schematicsystem.commands; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; import de.steamwar.schematicsystem.SchematicSystem; import de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils; import de.steamwar.sql.*; @@ -27,6 +28,7 @@ import org.bukkit.entity.Player; import java.io.IOException; +@Linked public class DownloadCommand extends SWCommand { public DownloadCommand() { super("download", "/download"); diff --git a/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/SchematicCommand.java b/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/SchematicCommand.java index b3ecf374..caccd1a5 100644 --- a/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/SchematicCommand.java +++ b/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/SchematicCommand.java @@ -23,6 +23,7 @@ import com.sk89q.worldedit.*; import com.sk89q.worldedit.extent.clipboard.Clipboard; import de.steamwar.command.*; import de.steamwar.core.VersionDependent; +import de.steamwar.linkage.Linked; import de.steamwar.schematicsystem.CheckSchemType; import de.steamwar.schematicsystem.SchematicSystem; import de.steamwar.schematicsystem.autocheck.AutoCheckerResult; @@ -34,6 +35,7 @@ import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCom import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils.*; @SuppressWarnings("unused") +@Linked public class SchematicCommand extends SWCommand { public SchematicCommand() { diff --git a/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/SchematicCommandInitializer.java b/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/SchematicCommandInitializer.java deleted file mode 100644 index 7245ead6..00000000 --- a/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/SchematicCommandInitializer.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - This file is a part of the SteamWar software. - - Copyright (C) 2023 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.schematicsystem.commands.schematiccommand; - -import de.steamwar.schematicsystem.SchematicSystem; -import de.steamwar.schematicsystem.commands.schematiccommand.parts.*; - -public class SchematicCommandInitializer { - - public static void init() { - new SchematicCommand().setMessage(SchematicSystem.MESSAGE); - new CheckPart().setMessage(SchematicSystem.MESSAGE); - new MemberPart().setMessage(SchematicSystem.MESSAGE); - new ModifyPart().setMessage(SchematicSystem.MESSAGE); - new SavePart().setMessage(SchematicSystem.MESSAGE); - new SearchPart().setMessage(SchematicSystem.MESSAGE); - new ViewPart().setMessage(SchematicSystem.MESSAGE); - } -} diff --git a/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/CheckPart.java b/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/CheckPart.java index 9f23a795..246b990b 100644 --- a/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/CheckPart.java +++ b/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/CheckPart.java @@ -28,6 +28,7 @@ import com.sk89q.worldedit.session.ClipboardHolder; import de.steamwar.command.AbstractSWCommand; import de.steamwar.command.SWCommand; import de.steamwar.core.Core; +import de.steamwar.linkage.Linked; import de.steamwar.schematicsystem.CheckSchemType; import de.steamwar.schematicsystem.SchematicSystem; import de.steamwar.schematicsystem.autocheck.AutoChecker; @@ -44,6 +45,7 @@ import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCom import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommand.impl; @AbstractSWCommand.PartOf(SchematicCommand.class) +@Linked public class CheckPart extends SWCommand { public CheckPart() { super(null); diff --git a/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/MemberPart.java b/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/MemberPart.java index f7f09ac3..6d42c97a 100644 --- a/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/MemberPart.java +++ b/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/MemberPart.java @@ -21,6 +21,7 @@ package de.steamwar.schematicsystem.commands.schematiccommand.parts; import de.steamwar.command.AbstractSWCommand; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; import de.steamwar.schematicsystem.SchematicSystem; import de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommand; import de.steamwar.sql.*; @@ -36,6 +37,7 @@ import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCom import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils.mkdirs; @AbstractSWCommand.PartOf(SchematicCommand.class) +@Linked public class MemberPart extends SWCommand { public MemberPart() { super(null); diff --git a/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/ModifyPart.java b/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/ModifyPart.java index ab699d28..7fae8acd 100644 --- a/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/ModifyPart.java +++ b/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/ModifyPart.java @@ -22,6 +22,7 @@ package de.steamwar.schematicsystem.commands.schematiccommand.parts; import com.sk89q.worldedit.extent.clipboard.Clipboard; import de.steamwar.command.AbstractSWCommand; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; import de.steamwar.schematicsystem.CheckSchemType; import de.steamwar.schematicsystem.SafeSchematicNode; import de.steamwar.schematicsystem.SchematicSystem; @@ -40,6 +41,7 @@ import java.io.IOException; import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils.*; @AbstractSWCommand.PartOf(SchematicCommand.class) +@Linked public class ModifyPart extends SWCommand { public ModifyPart() { super(null); diff --git a/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/SavePart.java b/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/SavePart.java index d373f503..9b6f2cb6 100644 --- a/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/SavePart.java +++ b/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/SavePart.java @@ -23,6 +23,7 @@ import de.steamwar.command.AbstractSWCommand; import de.steamwar.command.SWCommand; import de.steamwar.inventory.SWAnvilInv; import de.steamwar.inventory.SchematicSelector; +import de.steamwar.linkage.Linked; import de.steamwar.providers.BauServerInfo; import de.steamwar.schematicsystem.SchematicSystem; import de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommand; @@ -36,6 +37,7 @@ import java.util.logging.Level; import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils.*; @AbstractSWCommand.PartOf(SchematicCommand.class) +@Linked public class SavePart extends SWCommand { public SavePart() { diff --git a/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/SearchPart.java b/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/SearchPart.java index 00dfd850..e3c698f2 100644 --- a/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/SearchPart.java +++ b/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/SearchPart.java @@ -20,6 +20,7 @@ package de.steamwar.schematicsystem.commands.schematiccommand.parts; import de.steamwar.command.*; +import de.steamwar.linkage.Linked; import de.steamwar.schematicsystem.SchematicSystem; import de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils; import de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommand; @@ -40,6 +41,7 @@ import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCom import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils.getUser; @AbstractSWCommand.PartOf(SchematicCommand.class) +@Linked public class SearchPart extends SWCommand { private static final Map> searchMapper = new HashMap<>(); diff --git a/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/ViewPart.java b/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/ViewPart.java index a22c1813..da51fdca 100644 --- a/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/ViewPart.java +++ b/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/ViewPart.java @@ -21,10 +21,11 @@ package de.steamwar.schematicsystem.commands.schematiccommand.parts; import de.steamwar.command.AbstractSWCommand; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; import de.steamwar.schematicsystem.SchematicSystem; import de.steamwar.schematicsystem.commands.schematiccommand.GUI; -import de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils; import de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommand; +import de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils; import de.steamwar.sql.NodeData; import de.steamwar.sql.SchematicNode; import de.steamwar.sql.SteamwarUser; @@ -34,13 +35,12 @@ import net.md_5.bungee.api.chat.HoverEvent; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.entity.Player; -import java.time.format.DateTimeFormatter; -import java.time.format.FormatStyle; import java.util.List; import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils.*; @AbstractSWCommand.PartOf(SchematicCommand.class) +@Linked public class ViewPart extends SWCommand { public ViewPart() { super(null); diff --git a/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/listener/PlayerEventListener.java b/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/listener/PlayerEventListener.java index 3afb8ddd..84913014 100644 --- a/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/listener/PlayerEventListener.java +++ b/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/listener/PlayerEventListener.java @@ -19,11 +19,13 @@ package de.steamwar.schematicsystem.listener; +import de.steamwar.linkage.Linked; import de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerQuitEvent; +@Linked public class PlayerEventListener implements Listener { @EventHandler