Implement Linkage for SchematicSystem

This commit is contained in:
2025-10-03 13:33:31 +02:00
parent 91a5da9cd2
commit c7284dc7ab
12 changed files with 30 additions and 47 deletions
@@ -22,6 +22,8 @@ plugins {
}
dependencies {
compileOnly(libs.classindex)
annotationProcessor(libs.classindex)
compileOnly(project(":SpigotCore", "default"))
compileOnly(libs.spigotapi)
@@ -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() {
@@ -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");
@@ -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() {
@@ -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 <https://www.gnu.org/licenses/>.
*/
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);
}
}
@@ -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);
@@ -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);
@@ -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);
@@ -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() {
@@ -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<String, AbstractTypeMapper<CommandSender, ?>> searchMapper = new HashMap<>();
@@ -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);
@@ -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