SteamWar/FightSystem
Archiviert
13
1

Kampfleiter /win command

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2021-04-17 18:00:57 +02:00
Ursprung 766aaa3bcb
Commit 2aceb8d475
2 geänderte Dateien mit 50 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -125,6 +125,7 @@ public class FightSystem extends JavaPlugin {
new LockschemCommand(); new LockschemCommand();
new StateCommand(); new StateCommand();
new SkipCommand(); new SkipCommand();
new WinCommand();
new OneShotStateDependent(ArenaMode.All, FightState.PreRunning, () -> Bukkit.broadcastMessage(PREFIX + "§aDer Kampf beginnt!")); new OneShotStateDependent(ArenaMode.All, FightState.PreRunning, () -> Bukkit.broadcastMessage(PREFIX + "§aDer Kampf beginnt!"));
new OneShotStateDependent(ArenaMode.All, FightState.Running, () -> Bukkit.broadcastMessage(PREFIX + "§aArena freigegeben!")); new OneShotStateDependent(ArenaMode.All, FightState.Running, () -> Bukkit.broadcastMessage(PREFIX + "§aArena freigegeben!"));

Datei anzeigen

@ -0,0 +1,49 @@
package de.steamwar.fightsystem.commands;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCommand;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class WinCommand implements CommandExecutor {
public WinCommand() {
new StateDependentCommand(ArenaMode.Event, FightState.Ingame, "win", this);
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(!(sender instanceof Player)) {
return false;
}
Player p = (Player) sender;
if (p != FightSystem.getEventLeiter()) {
p.sendMessage(FightSystem.PREFIX + "§cDu bist kein Kampfleiter!");
return false;
}
if(args.length == 0){
p.sendMessage(FightSystem.PREFIX + "/win [Team or Tie]");
return false;
}
if(args[0].equalsIgnoreCase(Fight.getBlueTeam().getName())){
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Kampfleiter hat den Kampf entschieden!");
FightSystem.setSpectateState(Fight.getBlueTeam(), "Referee");
}else if(args[0].equalsIgnoreCase(Fight.getRedTeam().getName())){
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Kampfleiter hat den Kampf entschieden!");
FightSystem.setSpectateState(Fight.getRedTeam(), "Referee");
}else if(args[0].equalsIgnoreCase("tie")){
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Kampfleiter hat den Kampf entschieden!");
FightSystem.setSpectateState(null, "Referee");
}
return false;
}
}