36 Zeilen
1.3 KiB
Java
36 Zeilen
1.3 KiB
Java
package de.steamwar.fightsystem.commands;
|
|
|
|
import de.steamwar.fightsystem.FightSystem;
|
|
import de.steamwar.fightsystem.fight.Fight;
|
|
import org.bukkit.command.Command;
|
|
import org.bukkit.command.CommandExecutor;
|
|
import org.bukkit.command.CommandSender;
|
|
import org.bukkit.entity.Player;
|
|
|
|
public class LeaderCommand implements CommandExecutor {
|
|
@Override
|
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
|
if(!(sender instanceof Player))
|
|
return false;
|
|
Player player = (Player) sender;
|
|
|
|
if(Commands.checkSetup(player))
|
|
return false;
|
|
|
|
if(args.length == 0){
|
|
if(Fight.getFightPlayer(player) == null){
|
|
if(!Fight.getBlueTeam().hasTeamLeader())
|
|
Fight.getBlueTeam().setLeader(Fight.getBlueTeam().addMember(player));
|
|
else if(!Fight.getRedTeam().hasTeamLeader())
|
|
Fight.getRedTeam().setLeader(Fight.getRedTeam().addMember(player));
|
|
else
|
|
player.sendMessage(FightSystem.PREFIX + "§cEs sind bereits 2 Teamleader vorhanden");
|
|
}else
|
|
player.sendMessage(FightSystem.PREFIX + "§cDu bist bereits in einem Team");
|
|
}else
|
|
Commands.sendHelp(player);
|
|
|
|
return false;
|
|
}
|
|
}
|