2021-03-24 11:32:41 +01:00
|
|
|
/*
|
|
|
|
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 <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2021-03-23 16:42:45 +01:00
|
|
|
package de.steamwar.fightsystem.commands;
|
|
|
|
|
|
|
|
import de.steamwar.fightsystem.ArenaMode;
|
2022-03-03 18:08:01 +01:00
|
|
|
import de.steamwar.fightsystem.Config;
|
2022-04-09 16:33:57 +02:00
|
|
|
import de.steamwar.fightsystem.fight.Fight;
|
2022-03-03 14:46:34 +01:00
|
|
|
import de.steamwar.fightsystem.record.PacketProcessor;
|
2021-03-23 16:42:45 +01:00
|
|
|
import de.steamwar.fightsystem.states.FightState;
|
|
|
|
import de.steamwar.fightsystem.states.StateDependentCommand;
|
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.command.CommandExecutor;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
2022-03-03 18:08:01 +01:00
|
|
|
public class SkipCommand implements CommandExecutor {
|
2021-03-23 16:42:45 +01:00
|
|
|
|
|
|
|
public SkipCommand() {
|
2022-03-03 18:08:01 +01:00
|
|
|
new StateDependentCommand(ArenaMode.AntiPrepare, ArenaMode.Replay.contains(Config.mode) ? FightState.All : FightState.TeamFix, "skip", this);
|
2021-03-23 16:42:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
|
|
|
if(!(sender instanceof Player)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
Player player = (Player) sender;
|
|
|
|
|
2022-04-10 21:16:49 +02:00
|
|
|
if(PacketProcessor.isReplaying() && player.getUniqueId().equals(Fight.getBlueTeam().getDesignatedLeader())) {
|
2022-03-03 14:46:34 +01:00
|
|
|
PacketProcessor.currentReplay().skipToSubtitle();
|
|
|
|
} else {
|
|
|
|
Commands.toggleSkip(player);
|
|
|
|
}
|
2021-03-23 16:42:45 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|