From 12482b388669014dae921bc2e5527e1f46ab4ab2 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 23 Sep 2022 15:40:50 +0200 Subject: [PATCH] Update to Linkage --- CommonCore | 2 +- build.gradle | 3 +- src/{plugin.yml => bungee.yml} | 0 src/de/steamwar/bungeecore/Broadcaster.java | 9 +- src/de/steamwar/bungeecore/BungeeCore.java | 112 +++--------------- src/de/steamwar/bungeecore/EventStarter.java | 5 +- .../bungeecore/bot/SteamwarDiscordBot.java | 15 ++- .../bungeecore/commands/AlertCommand.java | 3 + .../bungeecore/commands/ArenaCommand.java | 3 + .../bungeecore/commands/BauCommand.java | 5 + .../bungeecore/commands/BugCommand.java | 3 + .../commands/BuilderCloudCommand.java | 3 + .../bungeecore/commands/ChallengeCommand.java | 5 + .../bungeecore/commands/CheckCommand.java | 5 + .../bungeecore/commands/DevCommand.java | 3 + .../commands/EventRescheduleCommand.java | 3 + .../commands/EventreloadCommand.java | 3 + .../bungeecore/commands/FightCommand.java | 3 + .../bungeecore/commands/GDPRQuery.java | 3 + .../bungeecore/commands/HistoricCommand.java | 5 + .../bungeecore/commands/IgnoreCommand.java | 3 + .../bungeecore/commands/KickCommand.java | 3 + .../bungeecore/commands/ListCommand.java | 3 + .../bungeecore/commands/LocalCommand.java | 3 + .../bungeecore/commands/MsgCommand.java | 3 + .../bungeecore/commands/PingCommand.java | 3 + .../bungeecore/commands/PlaytimeCommand.java | 3 + .../bungeecore/commands/PollCommand.java | 3 + .../commands/PollresultCommand.java | 3 + .../bungeecore/commands/RCommand.java | 3 + .../bungeecore/commands/RankCommand.java | 3 + .../bungeecore/commands/RegelnCommand.java | 3 + .../bungeecore/commands/ReplayCommand.java | 5 + .../commands/ServerSwitchCommand.java | 1 - .../commands/ServerTeamchatCommand.java | 3 + .../bungeecore/commands/SetLocaleCommand.java | 3 + .../bungeecore/commands/StatCommand.java | 3 + .../bungeecore/commands/TeamchatCommand.java | 3 + .../bungeecore/commands/TutorialCommand.java | 5 + .../bungeecore/commands/UnIgnoreCommand.java | 3 + .../bungeecore/commands/VerifyCommand.java | 3 + .../commands/WebpasswordCommand.java | 5 + .../bungeecore/commands/WhoisCommand.java | 3 + .../bungeecore/listeners/BanListener.java | 6 +- .../bungeecore/listeners/BasicListener.java | 31 ----- .../bungeecore/listeners/BrandListener.java | 7 +- .../bungeecore/listeners/ChatListener.java | 20 +++- .../bungeecore/listeners/CheckListener.java | 11 +- .../listeners/ConnectionListener.java | 6 +- .../listeners/EventModeListener.java | 8 +- .../bungeecore/listeners/PollSystem.java | 9 +- .../bungeecore/listeners/SessionManager.java | 6 +- .../listeners/SettingsChangedListener.java | 6 +- .../listeners/SubserverProtocolFixer.java | 6 +- .../bungeecore/listeners/mods/Badlion.java | 7 +- .../bungeecore/listeners/mods/Fabric.java | 7 +- .../bungeecore/listeners/mods/Forge.java | 9 +- .../bungeecore/listeners/mods/Forge12.java | 7 +- .../bungeecore/listeners/mods/LabyMod.java | 7 +- .../listeners/mods/ModLoaderBlocker.java | 7 +- .../listeners/mods/WorldDownloader.java | 7 +- .../listeners/ping/PingListener.java | 7 +- .../bungeecore/network/NetworkReceiver.java | 7 +- .../bungeecore/tablist/TablistManager.java | 16 ++- 64 files changed, 291 insertions(+), 172 deletions(-) rename src/{plugin.yml => bungee.yml} (100%) delete mode 100644 src/de/steamwar/bungeecore/listeners/BasicListener.java diff --git a/CommonCore b/CommonCore index 1dea7199..a249d66d 160000 --- a/CommonCore +++ b/CommonCore @@ -1 +1 @@ -Subproject commit 1dea71993d897354d3f52a705f6e0e1e0c8ec580 +Subproject commit a249d66dcf96bb9aef44b700438c81670ad81de7 diff --git a/build.gradle b/build.gradle index 789fc216..d29cd1a5 100644 --- a/build.gradle +++ b/build.gradle @@ -69,7 +69,7 @@ mainClassName = '' sourceSets { main { java { - srcDirs = ['src/'] + srcDirs = ['src/', 'build/generated/sources/annotationProcessor/java/main/'] } resources { srcDirs = ['src/'] @@ -102,6 +102,7 @@ dependencies { } implementation project(":CommonCore") + annotationProcessor project(":CommonCore") } task buildProject { diff --git a/src/plugin.yml b/src/bungee.yml similarity index 100% rename from src/plugin.yml rename to src/bungee.yml diff --git a/src/de/steamwar/bungeecore/Broadcaster.java b/src/de/steamwar/bungeecore/Broadcaster.java index 925625c6..ba0d222e 100644 --- a/src/de/steamwar/bungeecore/Broadcaster.java +++ b/src/de/steamwar/bungeecore/Broadcaster.java @@ -19,16 +19,21 @@ package de.steamwar.bungeecore; +import de.steamwar.linkage.EventMode; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Plain; import net.md_5.bungee.api.ProxyServer; import java.util.concurrent.TimeUnit; -class Broadcaster { +@Linked(Plain.class) +@EventMode(EventMode.Mode.NonEvent) +public class Broadcaster { private static String [] broadCastMsgs; private int lastBroadCast = 0; - Broadcaster(){ + public Broadcaster(){ ProxyServer.getInstance().getScheduler().schedule(BungeeCore.get(), () -> { if(!ProxyServer.getInstance().getPlayers().isEmpty()) BungeeCore.broadcast(BungeeCore.CHAT_PREFIX + broadCastMsgs[lastBroadCast]); diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index df18fb21..1105ca74 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -19,20 +19,21 @@ package de.steamwar.bungeecore; -import de.steamwar.bungeecore.bot.SteamwarDiscordBot; import de.steamwar.bungeecore.bot.config.SteamwarDiscordBotConfig; import de.steamwar.bungeecore.commands.*; import de.steamwar.bungeecore.listeners.*; import de.steamwar.bungeecore.listeners.mods.*; -import de.steamwar.bungeecore.listeners.ping.PingListener; import de.steamwar.bungeecore.network.BungeeNetworkHandler; -import de.steamwar.bungeecore.network.NetworkReceiver; import de.steamwar.bungeecore.sql.*; -import de.steamwar.bungeecore.tablist.TablistManager; import de.steamwar.command.SWCommandUtils; import de.steamwar.command.SWTypeMapperCreator; import de.steamwar.command.TabCompletionCache; import de.steamwar.command.TypeMapper; +import de.steamwar.bungeecore.linkage.LinkageUtils; +import de.steamwar.linkage.types.Command; +import de.steamwar.linkage.types.DisableLink; +import de.steamwar.linkage.types.ListenerLink; +import de.steamwar.linkage.types.Plain; import net.md_5.bungee.BungeeCord; import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.CommandSender; @@ -72,7 +73,6 @@ public class BungeeCore extends Plugin { public static Node local; private ErrorLogger errorLogger; - private TablistManager tablistManager; @Override public void onEnable(){ @@ -99,20 +99,8 @@ public class BungeeCore extends Plugin { }); BungeeCord.getInstance().getScheduler().schedule(this, TabCompletionCache::invalidateOldEntries, 1, 1, TimeUnit.SECONDS); - new ConnectionListener(); - new Forge(); - new Forge12(); - new LabyMod(); - new Badlion(); - new ChatListener(); - new BanListener(); - new CheckListener(); - new ModLoaderBlocker(); - new WorldDownloader(); - new BrandListener(); - new Fabric(); - new SubserverProtocolFixer(); - new PingListener(); + BungeeNetworkHandler.register(); + LinkageUtils.run(Plain.class, ListenerLink.class); local = new Node.LocalNode(); //new Node.RemoteNode("lx"); @@ -122,99 +110,29 @@ public class BungeeCore extends Plugin { commands.put("/bauchat", null); commands.put("/local", null); - new TeamchatCommand(); - new MsgCommand(); - new RCommand(); - new PingCommand(); - new AlertCommand(); - new KickCommand(); - new JoinmeCommand(); - new TpCommand(); - new HelpCommand(); - new TeamCommand(); - new ServerTeamchatCommand(); - new DevCommand(); + LinkageUtils.run(Command.class); new EventCommand(); - new EventreloadCommand(); - new EventRescheduleCommand(); - new PollCommand(); - new BugCommand(); - new WhoisCommand(); - new RegelnCommand(); - new IgnoreCommand(); - new UnIgnoreCommand(); - new PollresultCommand(); - new ListCommand(); - new StatCommand(); - new VerifyCommand(); - new GDPRQuery(); - new PlaytimeCommand(); - new ArenaCommand(); - new RankCommand(); - new LocalCommand(); - new SetLocaleCommand(); - new BuilderCloudCommand(); + new HelpCommand(); + new JoinmeCommand(); + new TeamCommand(); + new TpCommand(); // Punishment Commands: - new PunishmentCommand("ban", Punishment.PunishmentType.Ban); - new PunishmentCommand("mute", Punishment.PunishmentType.Mute); - new PunishmentCommand("noschemreceiving", Punishment.PunishmentType.NoSchemReceiving); - new PunishmentCommand("noschemsharing", Punishment.PunishmentType.NoSchemSharing); - new PunishmentCommand("noschemsubmitting", Punishment.PunishmentType.NoSchemSubmitting); - new PunishmentCommand("nodev", Punishment.PunishmentType.NoDevServer); - new PunishmentCommand("nofight", Punishment.PunishmentType.NoFightServer); - new PunishmentCommand("noteamserver", Punishment.PunishmentType.NoTeamServer); - new PunishmentCommand("note", Punishment.PunishmentType.Note); - - if(!EVENT_MODE){ - new BauCommand(); - new WebpasswordCommand(); - new FightCommand(); - new ChallengeCommand(); - new HistoricCommand(); - new CheckCommand(); - new ReplayCommand(); - new TutorialCommand(); - - new Broadcaster(); - }else{ - new EventModeListener(); + for (Punishment.PunishmentType punishmentType : Punishment.PunishmentType.values()) { + new PunishmentCommand(punishmentType.name().toLowerCase(), punishmentType); } - new EventStarter(); - new SessionManager(); - new NetworkReceiver(); - BungeeNetworkHandler.register(); - tablistManager = new TablistManager(); - new SettingsChangedListener(); - getProxy().getScheduler().schedule(this, () -> { SteamwarUser.clearCache(); UserElo.clearCache(); Team.clearCache(); }, 1, 1, TimeUnit.HOURS); - - if (SteamwarDiscordBotConfig.loaded) { - try { - new SteamwarDiscordBot(); - } catch (Throwable e) { - getLogger().log(Level.SEVERE, "Could not initialize discord bot", e); - } - } } @Override public void onDisable(){ - if (SteamwarDiscordBotConfig.loaded) { - try { - SteamwarDiscordBot.instance().getJda().shutdown(); - } catch (Throwable e) { - getLogger().log(Level.SEVERE, "Could not shutdown discord bot", e); - } - } + LinkageUtils.run(DisableLink.class); - if(tablistManager != null) - tablistManager.disable(); errorLogger.unregister(); Statement.closeAll(); } diff --git a/src/de/steamwar/bungeecore/EventStarter.java b/src/de/steamwar/bungeecore/EventStarter.java index 0de56678..65263f36 100644 --- a/src/de/steamwar/bungeecore/EventStarter.java +++ b/src/de/steamwar/bungeecore/EventStarter.java @@ -23,6 +23,8 @@ import de.steamwar.bungeecore.sql.Event; import de.steamwar.bungeecore.sql.EventFight; import de.steamwar.bungeecore.sql.SteamwarUser; import de.steamwar.bungeecore.sql.Team; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Plain; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -35,11 +37,12 @@ import java.util.concurrent.TimeUnit; import static de.steamwar.bungeecore.Storage.eventServer; +@Linked(Plain.class) public class EventStarter implements Runnable { private static ScheduledTask task = null; - EventStarter(){ + public EventStarter(){ EventFight.loadAllComingFights(); if(task != null) diff --git a/src/de/steamwar/bungeecore/bot/SteamwarDiscordBot.java b/src/de/steamwar/bungeecore/bot/SteamwarDiscordBot.java index 3811c185..88938089 100644 --- a/src/de/steamwar/bungeecore/bot/SteamwarDiscordBot.java +++ b/src/de/steamwar/bungeecore/bot/SteamwarDiscordBot.java @@ -29,6 +29,11 @@ import de.steamwar.bungeecore.bot.util.DiscordRolesMessage; import de.steamwar.bungeecore.bot.util.DiscordRulesMessage; import de.steamwar.bungeecore.bot.util.DiscordTicketMessage; import de.steamwar.bungeecore.sql.Event; +import de.steamwar.linkage.DiscordMode; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.api.Disable; +import de.steamwar.linkage.types.DisableLink; +import de.steamwar.linkage.types.Plain; import de.steamwar.messages.ChatSender; import lombok.Getter; import net.dv8tion.jda.api.JDA; @@ -48,7 +53,10 @@ import java.util.Map; import java.util.concurrent.TimeUnit; import java.util.logging.Level; -public class SteamwarDiscordBot { +@Linked(Plain.class) +@DiscordMode +@Linked(DisableLink.class) +public class SteamwarDiscordBot implements Disable { private static SteamwarDiscordBot INSTANCE; @@ -163,4 +171,9 @@ public class SteamwarDiscordBot { public void addListener(ListenerAdapter listenerAdapter) { jda.addEventListener(listenerAdapter); } + + @Override + public void disable() { + INSTANCE.getJda().shutdown(); + } } diff --git a/src/de/steamwar/bungeecore/commands/AlertCommand.java b/src/de/steamwar/bungeecore/commands/AlertCommand.java index 9eb32d3f..90efa8df 100644 --- a/src/de/steamwar/bungeecore/commands/AlertCommand.java +++ b/src/de/steamwar/bungeecore/commands/AlertCommand.java @@ -22,10 +22,13 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.bot.SteamwarDiscordBot; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import de.steamwar.messages.ChatSender; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.CommandSender; +@Linked(Command.class) public class AlertCommand extends SWCommand { public AlertCommand() { diff --git a/src/de/steamwar/bungeecore/commands/ArenaCommand.java b/src/de/steamwar/bungeecore/commands/ArenaCommand.java index 7f6503f2..890343d0 100644 --- a/src/de/steamwar/bungeecore/commands/ArenaCommand.java +++ b/src/de/steamwar/bungeecore/commands/ArenaCommand.java @@ -23,6 +23,8 @@ import de.steamwar.bungeecore.Servertype; import de.steamwar.bungeecore.Subserver; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeMapper; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -31,6 +33,7 @@ import java.util.Collection; import java.util.List; import java.util.stream.Collectors; +@Linked(Command.class) public class ArenaCommand extends SWCommand { public ArenaCommand() { diff --git a/src/de/steamwar/bungeecore/commands/BauCommand.java b/src/de/steamwar/bungeecore/commands/BauCommand.java index 7c03c4a2..15cf8c67 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -28,6 +28,9 @@ import de.steamwar.bungeecore.util.Chat19; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeMapper; import de.steamwar.command.TypeValidator; +import de.steamwar.linkage.EventMode; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import de.steamwar.messages.ChatSender; import de.steamwar.network.packets.server.BaumemberUpdatePacket; import net.md_5.bungee.api.CommandSender; @@ -39,6 +42,8 @@ import java.util.Collection; import java.util.HashMap; import java.util.Map; +@Linked(Command.class) +@EventMode(EventMode.Mode.NonEvent) public class BauCommand extends SWCommand { public BauCommand(){ diff --git a/src/de/steamwar/bungeecore/commands/BugCommand.java b/src/de/steamwar/bungeecore/commands/BugCommand.java index 96484236..fe8bb378 100644 --- a/src/de/steamwar/bungeecore/commands/BugCommand.java +++ b/src/de/steamwar/bungeecore/commands/BugCommand.java @@ -22,9 +22,12 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.sql.SWException; import de.steamwar.bungeecore.sql.SteamwarUser; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import de.steamwar.messages.ChatSender; import net.md_5.bungee.api.connection.ProxiedPlayer; +@Linked(Command.class) public class BugCommand extends SWCommand { public BugCommand() { super("bug", null); diff --git a/src/de/steamwar/bungeecore/commands/BuilderCloudCommand.java b/src/de/steamwar/bungeecore/commands/BuilderCloudCommand.java index 54369197..a762faf7 100644 --- a/src/de/steamwar/bungeecore/commands/BuilderCloudCommand.java +++ b/src/de/steamwar/bungeecore/commands/BuilderCloudCommand.java @@ -3,6 +3,8 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.ServerStarter; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeMapper; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -10,6 +12,7 @@ import java.io.File; import java.util.*; import java.util.stream.Collectors; +@Linked(Command.class) public class BuilderCloudCommand extends SWCommand { private final Map versionMap = new HashMap<>(); diff --git a/src/de/steamwar/bungeecore/commands/ChallengeCommand.java b/src/de/steamwar/bungeecore/commands/ChallengeCommand.java index 6f050ac9..55cf1812 100644 --- a/src/de/steamwar/bungeecore/commands/ChallengeCommand.java +++ b/src/de/steamwar/bungeecore/commands/ChallengeCommand.java @@ -23,6 +23,9 @@ import de.steamwar.bungeecore.*; import de.steamwar.bungeecore.sql.IgnoreSystem; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeValidator; +import de.steamwar.linkage.EventMode; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -30,6 +33,8 @@ import java.util.LinkedList; import static de.steamwar.bungeecore.Storage.challenges; +@Linked(Command.class) +@EventMode(EventMode.Mode.NonEvent) public class ChallengeCommand extends SWCommand { public ChallengeCommand() { diff --git a/src/de/steamwar/bungeecore/commands/CheckCommand.java b/src/de/steamwar/bungeecore/commands/CheckCommand.java index 02fc7a87..6937e7fe 100644 --- a/src/de/steamwar/bungeecore/commands/CheckCommand.java +++ b/src/de/steamwar/bungeecore/commands/CheckCommand.java @@ -27,6 +27,9 @@ import de.steamwar.bungeecore.sql.SchematicNode; import de.steamwar.bungeecore.sql.SchematicType; import de.steamwar.bungeecore.sql.SteamwarUser; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.EventMode; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.ProxyServer; @@ -42,6 +45,8 @@ import java.util.*; import java.util.concurrent.TimeUnit; import java.util.logging.Level; +@Linked(Command.class) +@EventMode(EventMode.Mode.NonEvent) public class CheckCommand extends SWCommand { private static Map> checkQuestions = new HashMap<>(); private static Map> ranks = new HashMap<>(); diff --git a/src/de/steamwar/bungeecore/commands/DevCommand.java b/src/de/steamwar/bungeecore/commands/DevCommand.java index 5858a49e..588fbef6 100644 --- a/src/de/steamwar/bungeecore/commands/DevCommand.java +++ b/src/de/steamwar/bungeecore/commands/DevCommand.java @@ -23,6 +23,8 @@ import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.Punishment; import de.steamwar.bungeecore.sql.SteamwarUser; import de.steamwar.command.*; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import de.steamwar.messages.ChatSender; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.config.ServerInfo; @@ -33,6 +35,7 @@ import java.net.InetSocketAddress; import java.util.HashMap; import java.util.Map; +@Linked(Command.class) public class DevCommand extends SWCommand { private final File devServerDir = new File("/configs/DevServer"); diff --git a/src/de/steamwar/bungeecore/commands/EventRescheduleCommand.java b/src/de/steamwar/bungeecore/commands/EventRescheduleCommand.java index bc7465c2..6ed1d39f 100644 --- a/src/de/steamwar/bungeecore/commands/EventRescheduleCommand.java +++ b/src/de/steamwar/bungeecore/commands/EventRescheduleCommand.java @@ -25,6 +25,8 @@ import de.steamwar.bungeecore.sql.EventFight; import de.steamwar.bungeecore.sql.Team; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeMapper; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -36,6 +38,7 @@ import java.util.ListIterator; import java.util.stream.Collectors; import java.util.stream.Stream; +@Linked(Command.class) public class EventRescheduleCommand extends SWCommand { public EventRescheduleCommand() { diff --git a/src/de/steamwar/bungeecore/commands/EventreloadCommand.java b/src/de/steamwar/bungeecore/commands/EventreloadCommand.java index 9d5008a3..c4309afb 100644 --- a/src/de/steamwar/bungeecore/commands/EventreloadCommand.java +++ b/src/de/steamwar/bungeecore/commands/EventreloadCommand.java @@ -21,8 +21,11 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.sql.EventFight; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import net.md_5.bungee.api.CommandSender; +@Linked(Command.class) public class EventreloadCommand extends SWCommand { public EventreloadCommand() { super("eventreload", "bungeecore.softreload"); diff --git a/src/de/steamwar/bungeecore/commands/FightCommand.java b/src/de/steamwar/bungeecore/commands/FightCommand.java index 5911db55..aa39617b 100644 --- a/src/de/steamwar/bungeecore/commands/FightCommand.java +++ b/src/de/steamwar/bungeecore/commands/FightCommand.java @@ -25,6 +25,8 @@ import de.steamwar.bungeecore.inventory.SWItem; import de.steamwar.bungeecore.listeners.mods.ModLoaderBlocker; import de.steamwar.bungeecore.sql.Punishment; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import de.steamwar.messages.ChatSender; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatMessageType; @@ -44,6 +46,7 @@ import net.md_5.bungee.api.connection.ProxiedPlayer; * Sollte die Map fehlen, kann sie mit getMap() bestimmt werden. */ +@Linked(Command.class) public class FightCommand extends SWCommand { public FightCommand() { diff --git a/src/de/steamwar/bungeecore/commands/GDPRQuery.java b/src/de/steamwar/bungeecore/commands/GDPRQuery.java index 671d5a2d..c78072c8 100644 --- a/src/de/steamwar/bungeecore/commands/GDPRQuery.java +++ b/src/de/steamwar/bungeecore/commands/GDPRQuery.java @@ -5,6 +5,8 @@ import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.Statement; import de.steamwar.bungeecore.sql.SteamwarUser; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import net.md_5.bungee.BungeeCord; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -13,6 +15,7 @@ import java.io.*; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; +@Linked(Command.class) public class GDPRQuery extends SWCommand { public GDPRQuery() { diff --git a/src/de/steamwar/bungeecore/commands/HistoricCommand.java b/src/de/steamwar/bungeecore/commands/HistoricCommand.java index 03e7abbb..8d5458cf 100644 --- a/src/de/steamwar/bungeecore/commands/HistoricCommand.java +++ b/src/de/steamwar/bungeecore/commands/HistoricCommand.java @@ -24,9 +24,14 @@ import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.ServerStarter; import de.steamwar.bungeecore.Subserver; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.EventMode; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.connection.ProxiedPlayer; +@Linked(Command.class) +@EventMode(EventMode.Mode.NonEvent) public class HistoricCommand extends SWCommand { public HistoricCommand() { super("historic", null); diff --git a/src/de/steamwar/bungeecore/commands/IgnoreCommand.java b/src/de/steamwar/bungeecore/commands/IgnoreCommand.java index 0c11ee0c..2a435d77 100644 --- a/src/de/steamwar/bungeecore/commands/IgnoreCommand.java +++ b/src/de/steamwar/bungeecore/commands/IgnoreCommand.java @@ -25,12 +25,15 @@ import de.steamwar.bungeecore.sql.SteamwarUser; import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommandUtils; import de.steamwar.command.TypeMapper; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import net.md_5.bungee.BungeeCord; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.connection.ProxiedPlayer; import java.util.stream.Collectors; +@Linked(Command.class) public class IgnoreCommand extends SWCommand { public IgnoreCommand() { diff --git a/src/de/steamwar/bungeecore/commands/KickCommand.java b/src/de/steamwar/bungeecore/commands/KickCommand.java index 54a2e495..43c9cf26 100644 --- a/src/de/steamwar/bungeecore/commands/KickCommand.java +++ b/src/de/steamwar/bungeecore/commands/KickCommand.java @@ -24,6 +24,8 @@ import de.steamwar.bungeecore.Message; import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommandUtils; import de.steamwar.command.TypeMapper; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import net.md_5.bungee.BungeeCord; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.ProxyServer; @@ -31,6 +33,7 @@ import net.md_5.bungee.api.connection.ProxiedPlayer; import java.util.stream.Collectors; +@Linked(Command.class) public class KickCommand extends SWCommand { public KickCommand() { diff --git a/src/de/steamwar/bungeecore/commands/ListCommand.java b/src/de/steamwar/bungeecore/commands/ListCommand.java index 6caa4a14..6861a14a 100644 --- a/src/de/steamwar/bungeecore/commands/ListCommand.java +++ b/src/de/steamwar/bungeecore/commands/ListCommand.java @@ -23,6 +23,8 @@ import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.Servertype; import de.steamwar.bungeecore.Subserver; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.config.ServerInfo; @@ -34,6 +36,7 @@ import java.util.List; import java.util.TreeMap; import java.util.stream.Collectors; +@Linked(Command.class) public class ListCommand extends SWCommand { public ListCommand() { diff --git a/src/de/steamwar/bungeecore/commands/LocalCommand.java b/src/de/steamwar/bungeecore/commands/LocalCommand.java index ab77eb3e..46d27fee 100644 --- a/src/de/steamwar/bungeecore/commands/LocalCommand.java +++ b/src/de/steamwar/bungeecore/commands/LocalCommand.java @@ -21,9 +21,12 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.listeners.ChatListener; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.connection.ProxiedPlayer; +@Linked(Command.class) public class LocalCommand extends SWCommand { public LocalCommand() { diff --git a/src/de/steamwar/bungeecore/commands/MsgCommand.java b/src/de/steamwar/bungeecore/commands/MsgCommand.java index 8dd8e50a..7807c432 100644 --- a/src/de/steamwar/bungeecore/commands/MsgCommand.java +++ b/src/de/steamwar/bungeecore/commands/MsgCommand.java @@ -22,6 +22,8 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.listeners.ChatListener; import de.steamwar.bungeecore.sql.IgnoreSystem; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import de.steamwar.messages.ChatSender; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -29,6 +31,7 @@ import java.util.stream.Stream; import static de.steamwar.bungeecore.Storage.lastChats; +@Linked(Command.class) public class MsgCommand extends SWCommand { public MsgCommand() { diff --git a/src/de/steamwar/bungeecore/commands/PingCommand.java b/src/de/steamwar/bungeecore/commands/PingCommand.java index 04c22fa1..700bf045 100644 --- a/src/de/steamwar/bungeecore/commands/PingCommand.java +++ b/src/de/steamwar/bungeecore/commands/PingCommand.java @@ -21,8 +21,11 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.Message; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import net.md_5.bungee.api.connection.ProxiedPlayer; +@Linked(Command.class) public class PingCommand extends SWCommand { public PingCommand() { diff --git a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java index c9c3850d..94d456a9 100644 --- a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java +++ b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java @@ -22,6 +22,8 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.SteamwarUser; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.connection.ProxiedPlayer; import org.apache.commons.lang3.LocaleUtils; @@ -30,6 +32,7 @@ import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.Locale; +@Linked(Command.class) public class PlaytimeCommand extends SWCommand { public PlaytimeCommand() { diff --git a/src/de/steamwar/bungeecore/commands/PollCommand.java b/src/de/steamwar/bungeecore/commands/PollCommand.java index 5e179cda..67ad1feb 100644 --- a/src/de/steamwar/bungeecore/commands/PollCommand.java +++ b/src/de/steamwar/bungeecore/commands/PollCommand.java @@ -25,8 +25,11 @@ import de.steamwar.bungeecore.sql.PollAnswer; import de.steamwar.bungeecore.sql.SteamwarUser; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeValidator; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import net.md_5.bungee.api.connection.ProxiedPlayer; +@Linked(Command.class) public class PollCommand extends SWCommand { public PollCommand() { diff --git a/src/de/steamwar/bungeecore/commands/PollresultCommand.java b/src/de/steamwar/bungeecore/commands/PollresultCommand.java index 554efcce..875e2131 100644 --- a/src/de/steamwar/bungeecore/commands/PollresultCommand.java +++ b/src/de/steamwar/bungeecore/commands/PollresultCommand.java @@ -24,10 +24,13 @@ import de.steamwar.bungeecore.listeners.PollSystem; import de.steamwar.bungeecore.sql.PollAnswer; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeValidator; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import net.md_5.bungee.api.connection.ProxiedPlayer; import java.util.Map; +@Linked(Command.class) public class PollresultCommand extends SWCommand { public PollresultCommand() { diff --git a/src/de/steamwar/bungeecore/commands/RCommand.java b/src/de/steamwar/bungeecore/commands/RCommand.java index c7d3d3f5..e15f841f 100644 --- a/src/de/steamwar/bungeecore/commands/RCommand.java +++ b/src/de/steamwar/bungeecore/commands/RCommand.java @@ -20,10 +20,13 @@ package de.steamwar.bungeecore.commands; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import net.md_5.bungee.api.connection.ProxiedPlayer; import static de.steamwar.bungeecore.Storage.lastChats; +@Linked(Command.class) public class RCommand extends SWCommand { public RCommand() { diff --git a/src/de/steamwar/bungeecore/commands/RankCommand.java b/src/de/steamwar/bungeecore/commands/RankCommand.java index eca55186..951fdf09 100644 --- a/src/de/steamwar/bungeecore/commands/RankCommand.java +++ b/src/de/steamwar/bungeecore/commands/RankCommand.java @@ -26,6 +26,8 @@ import de.steamwar.bungeecore.sql.UserElo; import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommandUtils; import de.steamwar.command.TypeMapper; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import net.md_5.bungee.BungeeCord; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -33,6 +35,7 @@ import net.md_5.bungee.api.connection.ProxiedPlayer; import java.util.Optional; import java.util.stream.Collectors; +@Linked(Command.class) public class RankCommand extends SWCommand { public RankCommand() { diff --git a/src/de/steamwar/bungeecore/commands/RegelnCommand.java b/src/de/steamwar/bungeecore/commands/RegelnCommand.java index 63731a53..cadc54ca 100644 --- a/src/de/steamwar/bungeecore/commands/RegelnCommand.java +++ b/src/de/steamwar/bungeecore/commands/RegelnCommand.java @@ -21,9 +21,12 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.Message; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.connection.ProxiedPlayer; +@Linked(Command.class) public class RegelnCommand extends SWCommand { public RegelnCommand() { super("regeln", null, "rules"); diff --git a/src/de/steamwar/bungeecore/commands/ReplayCommand.java b/src/de/steamwar/bungeecore/commands/ReplayCommand.java index 1130108a..8f1b7879 100644 --- a/src/de/steamwar/bungeecore/commands/ReplayCommand.java +++ b/src/de/steamwar/bungeecore/commands/ReplayCommand.java @@ -28,6 +28,9 @@ import de.steamwar.bungeecore.sql.Punishment; import de.steamwar.bungeecore.sql.SchematicType; import de.steamwar.bungeecore.sql.SteamwarUser; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.EventMode; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import de.steamwar.messages.ChatSender; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -36,6 +39,8 @@ import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; +@Linked(Command.class) +@EventMode(EventMode.Mode.NonEvent) public class ReplayCommand extends SWCommand { public ReplayCommand() { diff --git a/src/de/steamwar/bungeecore/commands/ServerSwitchCommand.java b/src/de/steamwar/bungeecore/commands/ServerSwitchCommand.java index 19974fd0..004a9097 100644 --- a/src/de/steamwar/bungeecore/commands/ServerSwitchCommand.java +++ b/src/de/steamwar/bungeecore/commands/ServerSwitchCommand.java @@ -20,7 +20,6 @@ package de.steamwar.bungeecore.commands; import de.steamwar.command.SWCommand; -import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.config.ServerInfo; import net.md_5.bungee.api.connection.ProxiedPlayer; diff --git a/src/de/steamwar/bungeecore/commands/ServerTeamchatCommand.java b/src/de/steamwar/bungeecore/commands/ServerTeamchatCommand.java index e22c68fd..e8b15227 100644 --- a/src/de/steamwar/bungeecore/commands/ServerTeamchatCommand.java +++ b/src/de/steamwar/bungeecore/commands/ServerTeamchatCommand.java @@ -21,9 +21,12 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.listeners.ChatListener; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import de.steamwar.messages.ChatSender; import net.md_5.bungee.api.CommandSender; +@Linked(Command.class) public class ServerTeamchatCommand extends SWCommand { public ServerTeamchatCommand() { diff --git a/src/de/steamwar/bungeecore/commands/SetLocaleCommand.java b/src/de/steamwar/bungeecore/commands/SetLocaleCommand.java index 798a58cc..d839fd4e 100644 --- a/src/de/steamwar/bungeecore/commands/SetLocaleCommand.java +++ b/src/de/steamwar/bungeecore/commands/SetLocaleCommand.java @@ -20,11 +20,14 @@ package de.steamwar.bungeecore.commands; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import de.steamwar.messages.ChatSender; import net.md_5.bungee.api.connection.ProxiedPlayer; import java.util.Objects; +@Linked(Command.class) public class SetLocaleCommand extends SWCommand { public SetLocaleCommand() { diff --git a/src/de/steamwar/bungeecore/commands/StatCommand.java b/src/de/steamwar/bungeecore/commands/StatCommand.java index 33c3653e..cde4cacf 100644 --- a/src/de/steamwar/bungeecore/commands/StatCommand.java +++ b/src/de/steamwar/bungeecore/commands/StatCommand.java @@ -22,6 +22,8 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.Node; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import net.md_5.bungee.api.CommandSender; import java.io.BufferedReader; @@ -29,6 +31,7 @@ import java.io.InputStreamReader; import java.util.HashMap; import java.util.Map; +@Linked(Command.class) public class StatCommand extends SWCommand { public StatCommand() { diff --git a/src/de/steamwar/bungeecore/commands/TeamchatCommand.java b/src/de/steamwar/bungeecore/commands/TeamchatCommand.java index 60e57dcb..2420bd61 100644 --- a/src/de/steamwar/bungeecore/commands/TeamchatCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamchatCommand.java @@ -21,9 +21,12 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.listeners.ChatListener; import de.steamwar.bungeecore.sql.SteamwarUser; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import de.steamwar.messages.ChatSender; import net.md_5.bungee.api.CommandSender; +@Linked(Command.class) public class TeamchatCommand extends BasicCommand { public TeamchatCommand() { diff --git a/src/de/steamwar/bungeecore/commands/TutorialCommand.java b/src/de/steamwar/bungeecore/commands/TutorialCommand.java index 30cc2961..6e10d60e 100644 --- a/src/de/steamwar/bungeecore/commands/TutorialCommand.java +++ b/src/de/steamwar/bungeecore/commands/TutorialCommand.java @@ -28,6 +28,9 @@ import de.steamwar.bungeecore.sql.SteamwarUser; import de.steamwar.bungeecore.sql.Tutorial; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeValidator; +import de.steamwar.linkage.EventMode; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -39,6 +42,8 @@ import java.util.concurrent.TimeUnit; import java.util.logging.Level; import java.util.stream.Collectors; +@Linked(Command.class) +@EventMode(EventMode.Mode.NonEvent) public class TutorialCommand extends SWCommand { public TutorialCommand() { diff --git a/src/de/steamwar/bungeecore/commands/UnIgnoreCommand.java b/src/de/steamwar/bungeecore/commands/UnIgnoreCommand.java index d0755bdb..d2385407 100644 --- a/src/de/steamwar/bungeecore/commands/UnIgnoreCommand.java +++ b/src/de/steamwar/bungeecore/commands/UnIgnoreCommand.java @@ -23,8 +23,11 @@ import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.IgnoreSystem; import de.steamwar.bungeecore.sql.SteamwarUser; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import net.md_5.bungee.api.connection.ProxiedPlayer; +@Linked(Command.class) public class UnIgnoreCommand extends SWCommand { public UnIgnoreCommand() { diff --git a/src/de/steamwar/bungeecore/commands/VerifyCommand.java b/src/de/steamwar/bungeecore/commands/VerifyCommand.java index 08aee06b..858a67fe 100644 --- a/src/de/steamwar/bungeecore/commands/VerifyCommand.java +++ b/src/de/steamwar/bungeecore/commands/VerifyCommand.java @@ -24,11 +24,14 @@ import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.bot.AuthManager; import de.steamwar.bungeecore.sql.SteamwarUser; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import net.dv8tion.jda.api.entities.Member; import net.md_5.bungee.api.connection.ProxiedPlayer; import java.util.Base64; +@Linked(Command.class) public class VerifyCommand extends SWCommand { public VerifyCommand() { diff --git a/src/de/steamwar/bungeecore/commands/WebpasswordCommand.java b/src/de/steamwar/bungeecore/commands/WebpasswordCommand.java index 2e45c274..645812ab 100644 --- a/src/de/steamwar/bungeecore/commands/WebpasswordCommand.java +++ b/src/de/steamwar/bungeecore/commands/WebpasswordCommand.java @@ -20,6 +20,9 @@ package de.steamwar.bungeecore.commands; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.EventMode; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import de.steamwar.messages.ChatSender; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -27,6 +30,8 @@ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; +@Linked(Command.class) +@EventMode(EventMode.Mode.NonEvent) public class WebpasswordCommand extends SWCommand { public WebpasswordCommand() { diff --git a/src/de/steamwar/bungeecore/commands/WhoisCommand.java b/src/de/steamwar/bungeecore/commands/WhoisCommand.java index bf016c3a..4f7e41db 100644 --- a/src/de/steamwar/bungeecore/commands/WhoisCommand.java +++ b/src/de/steamwar/bungeecore/commands/WhoisCommand.java @@ -27,6 +27,8 @@ import de.steamwar.bungeecore.sql.Team; import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommandUtils; import de.steamwar.command.TypeMapper; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.Command; import net.md_5.bungee.BungeeCord; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.chat.ClickEvent; @@ -41,6 +43,7 @@ import java.util.List; import java.util.Set; import java.util.stream.Collectors; +@Linked(Command.class) public class WhoisCommand extends SWCommand { public WhoisCommand() { super("whois", "bungeecore.teamchat"); diff --git a/src/de/steamwar/bungeecore/listeners/BanListener.java b/src/de/steamwar/bungeecore/listeners/BanListener.java index a868ba30..7554fa98 100644 --- a/src/de/steamwar/bungeecore/listeners/BanListener.java +++ b/src/de/steamwar/bungeecore/listeners/BanListener.java @@ -25,6 +25,8 @@ import de.steamwar.bungeecore.listeners.mods.Forge; import de.steamwar.bungeecore.sql.BannedUserIPs; import de.steamwar.bungeecore.sql.Punishment; import de.steamwar.bungeecore.sql.SteamwarUser; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.ListenerLink; import de.steamwar.messages.ChatSender; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.chat.ClickEvent; @@ -33,13 +35,15 @@ import net.md_5.bungee.api.chat.HoverEvent; import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.event.LoginEvent; +import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.event.EventHandler; import java.sql.Timestamp; import java.time.format.DateTimeFormatter; import java.util.List; -public class BanListener extends BasicListener { +@Linked(ListenerLink.class) +public class BanListener implements Listener { @EventHandler public void onLogin(LoginEvent event) { diff --git a/src/de/steamwar/bungeecore/listeners/BasicListener.java b/src/de/steamwar/bungeecore/listeners/BasicListener.java deleted file mode 100644 index 5c20d179..00000000 --- a/src/de/steamwar/bungeecore/listeners/BasicListener.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - This file is a part of the SteamWar software. - - Copyright (C) 2020 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.bungeecore.listeners; - -import de.steamwar.bungeecore.BungeeCore; -import net.md_5.bungee.api.ProxyServer; -import net.md_5.bungee.api.plugin.Listener; - -public abstract class BasicListener implements Listener { - - public BasicListener(){ - ProxyServer.getInstance().getPluginManager().registerListener(BungeeCore.get(), this); - } -} diff --git a/src/de/steamwar/bungeecore/listeners/BrandListener.java b/src/de/steamwar/bungeecore/listeners/BrandListener.java index db3bcf26..4ad4a810 100644 --- a/src/de/steamwar/bungeecore/listeners/BrandListener.java +++ b/src/de/steamwar/bungeecore/listeners/BrandListener.java @@ -19,12 +19,16 @@ package de.steamwar.bungeecore.listeners; +import de.steamwar.linkage.LinkageType; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.ListenerLink; import de.steamwar.messages.ChatSender; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.event.PluginMessageEvent; +import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.event.EventHandler; import net.md_5.bungee.protocol.DefinedPacket; @@ -32,7 +36,8 @@ import java.net.InetAddress; import java.net.NetworkInterface; import java.net.SocketException; -public class BrandListener extends BasicListener { +@Linked(ListenerLink.class) +public class BrandListener implements Listener { private static boolean isLocalHost(InetAddress addr) { if (addr.isAnyLocalAddress() || addr.isLoopbackAddress()) { diff --git a/src/de/steamwar/bungeecore/listeners/ChatListener.java b/src/de/steamwar/bungeecore/listeners/ChatListener.java index 827fe3eb..0e5a3c8c 100644 --- a/src/de/steamwar/bungeecore/listeners/ChatListener.java +++ b/src/de/steamwar/bungeecore/listeners/ChatListener.java @@ -19,28 +19,40 @@ package de.steamwar.bungeecore.listeners; -import de.steamwar.bungeecore.*; +import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; +import de.steamwar.bungeecore.Servertype; +import de.steamwar.bungeecore.Subserver; import de.steamwar.bungeecore.bot.SteamwarDiscordBot; import de.steamwar.bungeecore.network.NetworkSender; import de.steamwar.bungeecore.sql.*; import de.steamwar.bungeecore.util.Chat19; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.ListenerLink; import de.steamwar.messages.ChatSender; import de.steamwar.network.packets.server.PingPacket; -import net.md_5.bungee.api.*; +import net.md_5.bungee.api.ChatColor; +import net.md_5.bungee.api.CommandSender; +import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.event.ChatEvent; import net.md_5.bungee.api.event.TabCompleteEvent; import net.md_5.bungee.api.event.TabCompleteResponseEvent; +import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.api.scheduler.TaskScheduler; import net.md_5.bungee.event.EventHandler; -import java.util.*; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Collectors; import java.util.stream.Stream; -public class ChatListener extends BasicListener { +@Linked(ListenerLink.class) +public class ChatListener implements Listener { private static final Set coloredTeams = new HashSet<>(); static { diff --git a/src/de/steamwar/bungeecore/listeners/CheckListener.java b/src/de/steamwar/bungeecore/listeners/CheckListener.java index 1370a0db..251d67a2 100644 --- a/src/de/steamwar/bungeecore/listeners/CheckListener.java +++ b/src/de/steamwar/bungeecore/listeners/CheckListener.java @@ -19,21 +19,28 @@ package de.steamwar.bungeecore.listeners; -import de.steamwar.bungeecore.*; +import de.steamwar.bungeecore.Bauserver; +import de.steamwar.bungeecore.Message; +import de.steamwar.bungeecore.Servertype; +import de.steamwar.bungeecore.Subserver; import de.steamwar.bungeecore.commands.CheckCommand; import de.steamwar.bungeecore.sql.SchematicNode; import de.steamwar.bungeecore.sql.SchematicType; import de.steamwar.bungeecore.sql.SteamwarUser; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.ListenerLink; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.event.PlayerDisconnectEvent; import net.md_5.bungee.api.event.PostLoginEvent; import net.md_5.bungee.api.event.ServerSwitchEvent; +import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.event.EventHandler; import java.util.LinkedList; import java.util.List; -public class CheckListener extends BasicListener { +@Linked(ListenerLink.class) +public class CheckListener implements Listener { @EventHandler public void onPlayerJoin(PostLoginEvent e){ diff --git a/src/de/steamwar/bungeecore/listeners/ConnectionListener.java b/src/de/steamwar/bungeecore/listeners/ConnectionListener.java index 44bba9fe..cdd5c97a 100644 --- a/src/de/steamwar/bungeecore/listeners/ConnectionListener.java +++ b/src/de/steamwar/bungeecore/listeners/ConnectionListener.java @@ -30,6 +30,8 @@ import de.steamwar.bungeecore.commands.CheckCommand; import de.steamwar.bungeecore.commands.MsgCommand; import de.steamwar.bungeecore.sql.SteamwarUser; import de.steamwar.bungeecore.sql.UserGroup; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.ListenerLink; import net.md_5.bungee.api.AbstractReconnectHandler; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.chat.ClickEvent; @@ -39,11 +41,13 @@ import net.md_5.bungee.api.event.PlayerDisconnectEvent; import net.md_5.bungee.api.event.PostLoginEvent; import net.md_5.bungee.api.event.ServerDisconnectEvent; import net.md_5.bungee.api.event.ServerKickEvent; +import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.event.EventHandler; import java.util.*; -public class ConnectionListener extends BasicListener { +@Linked(ListenerLink.class) +public class ConnectionListener implements Listener { private static final String ADMIN_GROUP = "admin"; public static final String TEAM_GROUP = "team"; diff --git a/src/de/steamwar/bungeecore/listeners/EventModeListener.java b/src/de/steamwar/bungeecore/listeners/EventModeListener.java index 852703ce..390f0e5a 100644 --- a/src/de/steamwar/bungeecore/listeners/EventModeListener.java +++ b/src/de/steamwar/bungeecore/listeners/EventModeListener.java @@ -5,11 +5,17 @@ import de.steamwar.bungeecore.sql.Event; import de.steamwar.bungeecore.sql.EventFight; import de.steamwar.bungeecore.sql.SteamwarUser; import de.steamwar.bungeecore.sql.TeamTeilnahme; +import de.steamwar.linkage.EventMode; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.ListenerLink; import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.event.PostLoginEvent; +import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.event.EventHandler; -public class EventModeListener extends BasicListener { +@Linked(ListenerLink.class) +@EventMode(EventMode.Mode.EventOnly) +public class EventModeListener implements Listener { @EventHandler public void onPostLogin(PostLoginEvent e) { diff --git a/src/de/steamwar/bungeecore/listeners/PollSystem.java b/src/de/steamwar/bungeecore/listeners/PollSystem.java index 85ca553b..bd7ee53a 100644 --- a/src/de/steamwar/bungeecore/listeners/PollSystem.java +++ b/src/de/steamwar/bungeecore/listeners/PollSystem.java @@ -19,17 +19,24 @@ package de.steamwar.bungeecore.listeners; +import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.PollAnswer; import de.steamwar.bungeecore.sql.SteamwarUser; +import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.event.PostLoginEvent; +import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.event.EventHandler; import java.util.List; -public class PollSystem extends BasicListener { +public class PollSystem implements Listener { + + { + ProxyServer.getInstance().getPluginManager().registerListener(BungeeCore.get(), this); + } private static String question; private static List answers; diff --git a/src/de/steamwar/bungeecore/listeners/SessionManager.java b/src/de/steamwar/bungeecore/listeners/SessionManager.java index aa3e5c86..a96857ca 100644 --- a/src/de/steamwar/bungeecore/listeners/SessionManager.java +++ b/src/de/steamwar/bungeecore/listeners/SessionManager.java @@ -22,9 +22,12 @@ package de.steamwar.bungeecore.listeners; import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.sql.Session; import de.steamwar.bungeecore.sql.SteamwarUser; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.ListenerLink; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.event.PlayerDisconnectEvent; import net.md_5.bungee.api.event.PostLoginEvent; +import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.event.EventHandler; import java.sql.Timestamp; @@ -32,7 +35,8 @@ import java.time.Instant; import static de.steamwar.bungeecore.Storage.sessions; -public class SessionManager extends BasicListener { +@Linked(ListenerLink.class) +public class SessionManager implements Listener { @EventHandler public void onPostLogin(PostLoginEvent event){ diff --git a/src/de/steamwar/bungeecore/listeners/SettingsChangedListener.java b/src/de/steamwar/bungeecore/listeners/SettingsChangedListener.java index 5affb64a..7d8dfd7a 100644 --- a/src/de/steamwar/bungeecore/listeners/SettingsChangedListener.java +++ b/src/de/steamwar/bungeecore/listeners/SettingsChangedListener.java @@ -21,12 +21,16 @@ package de.steamwar.bungeecore.listeners; import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.sql.SteamwarUser; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.ListenerLink; import net.md_5.bungee.BungeeCord; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.event.SettingsChangedEvent; +import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.event.EventHandler; -public class SettingsChangedListener extends BasicListener { +@Linked(ListenerLink.class) +public class SettingsChangedListener implements Listener { @EventHandler public void onSettingsChanged(SettingsChangedEvent event) { diff --git a/src/de/steamwar/bungeecore/listeners/SubserverProtocolFixer.java b/src/de/steamwar/bungeecore/listeners/SubserverProtocolFixer.java index ff74ed7c..64f37a47 100644 --- a/src/de/steamwar/bungeecore/listeners/SubserverProtocolFixer.java +++ b/src/de/steamwar/bungeecore/listeners/SubserverProtocolFixer.java @@ -19,8 +19,11 @@ package de.steamwar.bungeecore.listeners; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.ListenerLink; import net.md_5.bungee.BungeeCord; import net.md_5.bungee.api.event.LoginEvent; +import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.connection.InitialHandler; import net.md_5.bungee.connection.LoginResult; import net.md_5.bungee.event.EventHandler; @@ -31,7 +34,8 @@ import java.lang.reflect.Field; import java.net.InetSocketAddress; import java.util.logging.Level; -public class SubserverProtocolFixer extends BasicListener { +@Linked(ListenerLink.class) +public class SubserverProtocolFixer implements Listener { private final InetSocketAddress inetSocketAddress = new InetSocketAddress("127.127.127.127", 25565); diff --git a/src/de/steamwar/bungeecore/listeners/mods/Badlion.java b/src/de/steamwar/bungeecore/listeners/mods/Badlion.java index cfc9ab70..3cca9b6e 100644 --- a/src/de/steamwar/bungeecore/listeners/mods/Badlion.java +++ b/src/de/steamwar/bungeecore/listeners/mods/Badlion.java @@ -1,11 +1,14 @@ package de.steamwar.bungeecore.listeners.mods; -import de.steamwar.bungeecore.listeners.BasicListener; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.ListenerLink; import net.md_5.bungee.api.event.PostLoginEvent; +import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.event.EventHandler; import net.md_5.bungee.protocol.packet.PluginMessage; -public class Badlion extends BasicListener { +@Linked(ListenerLink.class) +public class Badlion implements Listener { @EventHandler public void onPostLogin(PostLoginEvent event) { diff --git a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java index c244de2c..ea9085fd 100644 --- a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java +++ b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java @@ -26,14 +26,16 @@ import com.google.gson.JsonSyntaxException; import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.Storage; -import de.steamwar.bungeecore.listeners.BasicListener; import de.steamwar.bungeecore.sql.Mod; import de.steamwar.bungeecore.sql.Punishment; import de.steamwar.bungeecore.sql.SteamwarUser; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.ListenerLink; import net.md_5.bungee.BungeeCord; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.event.PluginMessageEvent; import net.md_5.bungee.api.event.ServerSwitchEvent; +import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.event.EventHandler; import java.nio.charset.StandardCharsets; @@ -42,7 +44,8 @@ import java.util.*; import java.util.concurrent.TimeUnit; import java.util.logging.Level; -public class Fabric extends BasicListener { +@Linked(ListenerLink.class) +public class Fabric implements Listener { private final Set neededMods = new HashSet<>(); diff --git a/src/de/steamwar/bungeecore/listeners/mods/Forge.java b/src/de/steamwar/bungeecore/listeners/mods/Forge.java index 94a0fa28..216bc1ea 100644 --- a/src/de/steamwar/bungeecore/listeners/mods/Forge.java +++ b/src/de/steamwar/bungeecore/listeners/mods/Forge.java @@ -20,15 +20,15 @@ package de.steamwar.bungeecore.listeners.mods; import de.steamwar.bungeecore.BungeeCore; -import de.steamwar.bungeecore.listeners.BasicListener; import de.steamwar.bungeecore.sql.Mod; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.ListenerLink; import io.netty.channel.ChannelPipeline; import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.connection.PendingConnection; import net.md_5.bungee.api.event.LoginEvent; -import net.md_5.bungee.api.event.ProxyPingEvent; +import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.connection.InitialHandler; -import net.md_5.bungee.event.EventHandler; import net.md_5.bungee.netty.ChannelWrapper; import net.md_5.bungee.netty.HandlerBoss; import net.md_5.bungee.netty.PacketHandler; @@ -41,7 +41,8 @@ import java.util.List; import java.util.Locale; import java.util.logging.Level; -public class Forge extends BasicListener { +@Linked(ListenerLink.class) +public class Forge implements Listener { private static final String WRAPPER = "fml:loginwrapper"; diff --git a/src/de/steamwar/bungeecore/listeners/mods/Forge12.java b/src/de/steamwar/bungeecore/listeners/mods/Forge12.java index eb463f40..2c49dc15 100644 --- a/src/de/steamwar/bungeecore/listeners/mods/Forge12.java +++ b/src/de/steamwar/bungeecore/listeners/mods/Forge12.java @@ -20,8 +20,9 @@ package de.steamwar.bungeecore.listeners.mods; import de.steamwar.bungeecore.BungeeCore; -import de.steamwar.bungeecore.listeners.BasicListener; import de.steamwar.bungeecore.sql.Mod; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.ListenerLink; import io.netty.buffer.ByteBuf; import io.netty.buffer.UnpooledByteBufAllocator; import net.md_5.bungee.api.ProxyServer; @@ -29,13 +30,15 @@ import net.md_5.bungee.api.connection.Connection; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.event.PluginMessageEvent; import net.md_5.bungee.api.event.PostLoginEvent; +import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.event.EventHandler; import java.nio.charset.StandardCharsets; import java.util.*; import java.util.concurrent.TimeUnit; -public class Forge12 extends BasicListener { +@Linked(ListenerLink.class) +public class Forge12 implements Listener { private static final String FMLHS = "FML|HS"; private static final byte[] REGISTER; private static final byte[] HELLO = new byte[]{0, 2, 0, 0, 0, 0}; diff --git a/src/de/steamwar/bungeecore/listeners/mods/LabyMod.java b/src/de/steamwar/bungeecore/listeners/mods/LabyMod.java index e659b4d3..d6d7428b 100644 --- a/src/de/steamwar/bungeecore/listeners/mods/LabyMod.java +++ b/src/de/steamwar/bungeecore/listeners/mods/LabyMod.java @@ -22,12 +22,14 @@ package de.steamwar.bungeecore.listeners.mods; import com.google.gson.JsonObject; import com.google.gson.stream.JsonReader; import de.steamwar.bungeecore.BungeeCore; -import de.steamwar.bungeecore.listeners.BasicListener; import de.steamwar.bungeecore.sql.Mod; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.ListenerLink; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.connection.Connection; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.event.PluginMessageEvent; +import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.event.EventHandler; import java.io.IOException; @@ -38,7 +40,8 @@ import java.util.LinkedList; import java.util.List; import java.util.UUID; -public class LabyMod extends BasicListener { +@Linked(ListenerLink.class) +public class LabyMod implements Listener { @EventHandler public void onPluginMessageEvent(PluginMessageEvent event){ diff --git a/src/de/steamwar/bungeecore/listeners/mods/ModLoaderBlocker.java b/src/de/steamwar/bungeecore/listeners/mods/ModLoaderBlocker.java index 71f8220f..f2674b80 100644 --- a/src/de/steamwar/bungeecore/listeners/mods/ModLoaderBlocker.java +++ b/src/de/steamwar/bungeecore/listeners/mods/ModLoaderBlocker.java @@ -20,18 +20,21 @@ package de.steamwar.bungeecore.listeners.mods; import de.steamwar.bungeecore.*; -import de.steamwar.bungeecore.listeners.BasicListener; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.ListenerLink; import net.md_5.bungee.api.connection.Connection; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.event.PlayerDisconnectEvent; import net.md_5.bungee.api.event.PluginMessageEvent; import net.md_5.bungee.api.event.ServerSwitchEvent; +import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.event.EventHandler; import java.util.HashSet; import java.util.Set; -public class ModLoaderBlocker extends BasicListener { +@Linked(ListenerLink.class) +public class ModLoaderBlocker implements Listener { private static final Set BLOCKED_SERVER = new HashSet<>(); diff --git a/src/de/steamwar/bungeecore/listeners/mods/WorldDownloader.java b/src/de/steamwar/bungeecore/listeners/mods/WorldDownloader.java index 44270b61..c09035d4 100644 --- a/src/de/steamwar/bungeecore/listeners/mods/WorldDownloader.java +++ b/src/de/steamwar/bungeecore/listeners/mods/WorldDownloader.java @@ -2,17 +2,20 @@ package de.steamwar.bungeecore.listeners.mods; import com.google.common.collect.Lists; import com.google.common.collect.Sets; -import de.steamwar.bungeecore.listeners.BasicListener; import de.steamwar.bungeecore.sql.Mod; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.ListenerLink; import net.md_5.bungee.api.connection.Connection; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.event.PluginMessageEvent; +import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.event.EventHandler; import java.util.Collections; import java.util.Set; -public class WorldDownloader extends BasicListener { +@Linked(ListenerLink.class) +public class WorldDownloader implements Listener { private static final Set wdlTags = Collections.unmodifiableSet( Sets.newHashSet("WDL|INIT", "wdl:init", "WDL|REQUEST", "wdl:request") diff --git a/src/de/steamwar/bungeecore/listeners/ping/PingListener.java b/src/de/steamwar/bungeecore/listeners/ping/PingListener.java index a7bbf6e0..3a14e80b 100644 --- a/src/de/steamwar/bungeecore/listeners/ping/PingListener.java +++ b/src/de/steamwar/bungeecore/listeners/ping/PingListener.java @@ -19,11 +19,14 @@ package de.steamwar.bungeecore.listeners.ping; -import de.steamwar.bungeecore.listeners.BasicListener; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.ListenerLink; import net.md_5.bungee.api.event.ProxyPingEvent; +import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.event.EventHandler; -public class PingListener extends BasicListener { +@Linked(ListenerLink.class) +public class PingListener implements Listener { @EventHandler public void onPing(ProxyPingEvent event) { diff --git a/src/de/steamwar/bungeecore/network/NetworkReceiver.java b/src/de/steamwar/bungeecore/network/NetworkReceiver.java index f01bf446..4f39bff2 100644 --- a/src/de/steamwar/bungeecore/network/NetworkReceiver.java +++ b/src/de/steamwar/bungeecore/network/NetworkReceiver.java @@ -21,12 +21,14 @@ package de.steamwar.bungeecore.network; import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.commands.TeamCommand; -import de.steamwar.bungeecore.listeners.BasicListener; import de.steamwar.bungeecore.sql.SWException; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.types.ListenerLink; import de.steamwar.network.packets.NetworkPacket; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.connection.Server; import net.md_5.bungee.api.event.PluginMessageEvent; +import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.event.EventHandler; import net.md_5.bungee.event.EventPriority; @@ -35,7 +37,8 @@ import java.util.Arrays; import java.util.Base64; import java.util.List; -public class NetworkReceiver extends BasicListener { +@Linked(ListenerLink.class) +public class NetworkReceiver implements Listener { private static final List blockedTags = Arrays.asList("bungeecord:main", "BungeeCord", "sw:bridge"); diff --git a/src/de/steamwar/bungeecore/tablist/TablistManager.java b/src/de/steamwar/bungeecore/tablist/TablistManager.java index b6e78754..1c6d933b 100644 --- a/src/de/steamwar/bungeecore/tablist/TablistManager.java +++ b/src/de/steamwar/bungeecore/tablist/TablistManager.java @@ -23,7 +23,10 @@ import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.Servertype; import de.steamwar.bungeecore.Storage; import de.steamwar.bungeecore.Subserver; -import de.steamwar.bungeecore.listeners.BasicListener; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.api.Disable; +import de.steamwar.linkage.types.DisableLink; +import de.steamwar.linkage.types.ListenerLink; import de.steamwar.network.packets.common.FightInfoPacket; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.config.ServerInfo; @@ -31,12 +34,18 @@ import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.event.PlayerDisconnectEvent; import net.md_5.bungee.api.event.PostLoginEvent; import net.md_5.bungee.api.event.ServerSwitchEvent; +import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.event.EventHandler; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import java.util.concurrent.TimeUnit; -public class TablistManager extends BasicListener { +@Linked(ListenerLink.class) +@Linked(DisableLink.class) +public class TablistManager implements Listener, Disable { private static final Map fightInfos = new HashMap<>(); @@ -78,6 +87,7 @@ public class TablistManager extends BasicListener { } } + @Override public void disable() { synchronized (tablists) { tablists.forEach((player, tablist) -> tablist.disable());