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 { dependencies {
compileOnly(libs.classindex)
annotationProcessor(libs.classindex)
compileOnly(project(":SpigotCore", "default")) compileOnly(project(":SpigotCore", "default"))
compileOnly(libs.spigotapi) compileOnly(libs.spigotapi)
@@ -19,11 +19,9 @@
package de.steamwar.schematicsystem; package de.steamwar.schematicsystem;
import de.steamwar.linkage.AbstractLinker;
import de.steamwar.linkage.SpigotLinker;
import de.steamwar.message.Message; 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.Bukkit;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@@ -36,10 +34,13 @@ public class SchematicSystem extends JavaPlugin {
public void onEnable() { public void onEnable() {
instance = this; instance = this;
SchematicCommandInitializer.init(); SpigotLinker spigotLinker = new SpigotLinker(this, MESSAGE);
new DownloadCommand(); try {
spigotLinker.link();
Bukkit.getPluginManager().registerEvents(new PlayerEventListener(), this); } catch (AbstractLinker.LinkException e) {
e.printStackTrace();
Bukkit.shutdown();
}
} }
public static SchematicSystem getInstance() { public static SchematicSystem getInstance() {
@@ -20,6 +20,7 @@
package de.steamwar.schematicsystem.commands; package de.steamwar.schematicsystem.commands;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.linkage.Linked;
import de.steamwar.schematicsystem.SchematicSystem; import de.steamwar.schematicsystem.SchematicSystem;
import de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils; import de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils;
import de.steamwar.sql.*; import de.steamwar.sql.*;
@@ -27,6 +28,7 @@ import org.bukkit.entity.Player;
import java.io.IOException; import java.io.IOException;
@Linked
public class DownloadCommand extends SWCommand { public class DownloadCommand extends SWCommand {
public DownloadCommand() { public DownloadCommand() {
super("download", "/download"); super("download", "/download");
@@ -23,6 +23,7 @@ import com.sk89q.worldedit.*;
import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard;
import de.steamwar.command.*; import de.steamwar.command.*;
import de.steamwar.core.VersionDependent; import de.steamwar.core.VersionDependent;
import de.steamwar.linkage.Linked;
import de.steamwar.schematicsystem.CheckSchemType; import de.steamwar.schematicsystem.CheckSchemType;
import de.steamwar.schematicsystem.SchematicSystem; import de.steamwar.schematicsystem.SchematicSystem;
import de.steamwar.schematicsystem.autocheck.AutoCheckerResult; 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.*; import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils.*;
@SuppressWarnings("unused") @SuppressWarnings("unused")
@Linked
public class SchematicCommand extends SWCommand { public class SchematicCommand extends SWCommand {
public SchematicCommand() { 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.AbstractSWCommand;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import de.steamwar.linkage.Linked;
import de.steamwar.schematicsystem.CheckSchemType; import de.steamwar.schematicsystem.CheckSchemType;
import de.steamwar.schematicsystem.SchematicSystem; import de.steamwar.schematicsystem.SchematicSystem;
import de.steamwar.schematicsystem.autocheck.AutoChecker; 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; import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommand.impl;
@AbstractSWCommand.PartOf(SchematicCommand.class) @AbstractSWCommand.PartOf(SchematicCommand.class)
@Linked
public class CheckPart extends SWCommand { public class CheckPart extends SWCommand {
public CheckPart() { public CheckPart() {
super(null); super(null);
@@ -21,6 +21,7 @@ package de.steamwar.schematicsystem.commands.schematiccommand.parts;
import de.steamwar.command.AbstractSWCommand; import de.steamwar.command.AbstractSWCommand;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.linkage.Linked;
import de.steamwar.schematicsystem.SchematicSystem; import de.steamwar.schematicsystem.SchematicSystem;
import de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommand; import de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommand;
import de.steamwar.sql.*; 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; import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils.mkdirs;
@AbstractSWCommand.PartOf(SchematicCommand.class) @AbstractSWCommand.PartOf(SchematicCommand.class)
@Linked
public class MemberPart extends SWCommand { public class MemberPart extends SWCommand {
public MemberPart() { public MemberPart() {
super(null); super(null);
@@ -22,6 +22,7 @@ package de.steamwar.schematicsystem.commands.schematiccommand.parts;
import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard;
import de.steamwar.command.AbstractSWCommand; import de.steamwar.command.AbstractSWCommand;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.linkage.Linked;
import de.steamwar.schematicsystem.CheckSchemType; import de.steamwar.schematicsystem.CheckSchemType;
import de.steamwar.schematicsystem.SafeSchematicNode; import de.steamwar.schematicsystem.SafeSchematicNode;
import de.steamwar.schematicsystem.SchematicSystem; import de.steamwar.schematicsystem.SchematicSystem;
@@ -40,6 +41,7 @@ import java.io.IOException;
import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils.*; import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils.*;
@AbstractSWCommand.PartOf(SchematicCommand.class) @AbstractSWCommand.PartOf(SchematicCommand.class)
@Linked
public class ModifyPart extends SWCommand { public class ModifyPart extends SWCommand {
public ModifyPart() { public ModifyPart() {
super(null); super(null);
@@ -23,6 +23,7 @@ import de.steamwar.command.AbstractSWCommand;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.inventory.SWAnvilInv; import de.steamwar.inventory.SWAnvilInv;
import de.steamwar.inventory.SchematicSelector; import de.steamwar.inventory.SchematicSelector;
import de.steamwar.linkage.Linked;
import de.steamwar.providers.BauServerInfo; import de.steamwar.providers.BauServerInfo;
import de.steamwar.schematicsystem.SchematicSystem; import de.steamwar.schematicsystem.SchematicSystem;
import de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommand; import de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommand;
@@ -36,6 +37,7 @@ import java.util.logging.Level;
import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils.*; import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils.*;
@AbstractSWCommand.PartOf(SchematicCommand.class) @AbstractSWCommand.PartOf(SchematicCommand.class)
@Linked
public class SavePart extends SWCommand { public class SavePart extends SWCommand {
public SavePart() { public SavePart() {
@@ -20,6 +20,7 @@
package de.steamwar.schematicsystem.commands.schematiccommand.parts; package de.steamwar.schematicsystem.commands.schematiccommand.parts;
import de.steamwar.command.*; import de.steamwar.command.*;
import de.steamwar.linkage.Linked;
import de.steamwar.schematicsystem.SchematicSystem; import de.steamwar.schematicsystem.SchematicSystem;
import de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils; import de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils;
import de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommand; 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; import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils.getUser;
@AbstractSWCommand.PartOf(SchematicCommand.class) @AbstractSWCommand.PartOf(SchematicCommand.class)
@Linked
public class SearchPart extends SWCommand { public class SearchPart extends SWCommand {
private static final Map<String, AbstractTypeMapper<CommandSender, ?>> searchMapper = new HashMap<>(); 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.AbstractSWCommand;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.linkage.Linked;
import de.steamwar.schematicsystem.SchematicSystem; import de.steamwar.schematicsystem.SchematicSystem;
import de.steamwar.schematicsystem.commands.schematiccommand.GUI; 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.SchematicCommand;
import de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils;
import de.steamwar.sql.NodeData; import de.steamwar.sql.NodeData;
import de.steamwar.sql.SchematicNode; import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SteamwarUser; 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 net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
import java.util.List; import java.util.List;
import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils.*; import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils.*;
@AbstractSWCommand.PartOf(SchematicCommand.class) @AbstractSWCommand.PartOf(SchematicCommand.class)
@Linked
public class ViewPart extends SWCommand { public class ViewPart extends SWCommand {
public ViewPart() { public ViewPart() {
super(null); super(null);
@@ -19,11 +19,13 @@
package de.steamwar.schematicsystem.listener; package de.steamwar.schematicsystem.listener;
import de.steamwar.linkage.Linked;
import de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils; import de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
@Linked
public class PlayerEventListener implements Listener { public class PlayerEventListener implements Listener {
@EventHandler @EventHandler