From 160136833e5a36d7074077c9678d7b26d2a2798e Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 16 Jun 2022 11:16:47 +0200 Subject: [PATCH] Update ServerSwitchCommand --- .../bungeecore/commands/ServerSwitchCommand.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/ServerSwitchCommand.java b/src/de/steamwar/bungeecore/commands/ServerSwitchCommand.java index 7fef900..19974fd 100644 --- a/src/de/steamwar/bungeecore/commands/ServerSwitchCommand.java +++ b/src/de/steamwar/bungeecore/commands/ServerSwitchCommand.java @@ -19,12 +19,13 @@ 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; -public class ServerSwitchCommand extends BasicCommand { +public class ServerSwitchCommand extends SWCommand { private String serverName; @@ -33,12 +34,9 @@ public class ServerSwitchCommand extends BasicCommand { serverName = name; } - @Override - public void execute(CommandSender sender, String[] strings) { - if(sender instanceof ProxiedPlayer){ - ProxiedPlayer player = (ProxiedPlayer) sender; - ServerInfo target = ProxyServer.getInstance().getServerInfo(serverName); - player.connect(target); - } + @Register + public void genericCommand(ProxiedPlayer player) { + ServerInfo target = ProxyServer.getInstance().getServerInfo(serverName); + player.connect(target); } }