SteamWar/BungeeCore
Archiviert
13
2

Merge pull request 'Update ReplayCommand' (#398) from CommandReplay into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Reviewed-on: #398
Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Lixfel 2022-06-16 13:24:08 +02:00
Commit 60ca6fde85

Datei anzeigen

@ -27,6 +27,7 @@ import de.steamwar.bungeecore.sql.Fight;
import de.steamwar.bungeecore.sql.Punishment; import de.steamwar.bungeecore.sql.Punishment;
import de.steamwar.bungeecore.sql.SchematicType; import de.steamwar.bungeecore.sql.SchematicType;
import de.steamwar.bungeecore.sql.SteamwarUser; import de.steamwar.bungeecore.sql.SteamwarUser;
import de.steamwar.command.SWCommand;
import de.steamwar.messages.ChatSender; import de.steamwar.messages.ChatSender;
import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
@ -35,18 +36,14 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class ReplayCommand extends BasicCommand { public class ReplayCommand extends SWCommand {
public ReplayCommand() { public ReplayCommand() {
super("replay", null); super("replay");
} }
@Override @Register
public void execute(CommandSender s, String[] args) { public void genericCommand(ProxiedPlayer player, @OptionalValue("") String optionalMap) {
if(!(s instanceof ProxiedPlayer))
return;
ProxiedPlayer player = (ProxiedPlayer) s;
ChatSender sender = ChatSender.of(player); ChatSender sender = ChatSender.of(player);
if (sender.user().isPunishedWithMessage(sender, Punishment.PunishmentType.NoFightServer)) if (sender.user().isPunishedWithMessage(sender, Punishment.PunishmentType.NoFightServer))
return; return;
@ -57,8 +54,8 @@ public class ReplayCommand extends BasicCommand {
ServerStarter starter = new ServerStarter().replay(fight.getFightID()).blueLeader(player); ServerStarter starter = new ServerStarter().replay(fight.getFightID()).blueLeader(player);
String map = mode.getRandomMap(); String map = mode.getRandomMap();
if (args.length > 0) { if (!optionalMap.equals("")) {
String tMap = mode.hasMap(args[0]); String tMap = mode.hasMap(optionalMap);
if (tMap != null) map = tMap; if (tMap != null) map = tMap;
} }