From 279577a536c5b70b2e94b1e83483d2e4c18296eb Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 16 Jun 2022 11:15:43 +0200 Subject: [PATCH] Update ReplayCommand --- .../bungeecore/commands/ReplayCommand.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/ReplayCommand.java b/src/de/steamwar/bungeecore/commands/ReplayCommand.java index ef6e5c0..1130108 100644 --- a/src/de/steamwar/bungeecore/commands/ReplayCommand.java +++ b/src/de/steamwar/bungeecore/commands/ReplayCommand.java @@ -27,6 +27,7 @@ import de.steamwar.bungeecore.sql.Fight; 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.messages.ChatSender; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -35,18 +36,14 @@ import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; -public class ReplayCommand extends BasicCommand { +public class ReplayCommand extends SWCommand { public ReplayCommand() { - super("replay", null); + super("replay"); } - @Override - public void execute(CommandSender s, String[] args) { - if(!(s instanceof ProxiedPlayer)) - return; - ProxiedPlayer player = (ProxiedPlayer) s; - + @Register + public void genericCommand(ProxiedPlayer player, @OptionalValue("") String optionalMap) { ChatSender sender = ChatSender.of(player); if (sender.user().isPunishedWithMessage(sender, Punishment.PunishmentType.NoFightServer)) return; @@ -57,8 +54,8 @@ public class ReplayCommand extends BasicCommand { ServerStarter starter = new ServerStarter().replay(fight.getFightID()).blueLeader(player); String map = mode.getRandomMap(); - if (args.length > 0) { - String tMap = mode.hasMap(args[0]); + if (!optionalMap.equals("")) { + String tMap = mode.hasMap(optionalMap); if (tMap != null) map = tMap; }