mirror of
https://github.com/taoneill/war.git
synced 2024-11-23 18:55:28 +01:00
Added TeamCommand
This commit is contained in:
parent
135d1856cc
commit
7b838272ae
@ -177,9 +177,7 @@ public class War extends JavaPlugin {
|
||||
return this.commandHandler.handle(sender, cmd, commandLabel, args);
|
||||
|
||||
if (sender instanceof Player) {
|
||||
if (command.equals("leave")) {
|
||||
this.performLeave(player);
|
||||
} else if (command.equals("team")) {
|
||||
if (command.equals("team")) {
|
||||
this.performTeam(player, arguments);
|
||||
} else if (command.equals("warhub")) {
|
||||
this.performWarhub(player);
|
||||
|
@ -45,6 +45,9 @@ public class WarCommandHandler {
|
||||
else if (command.equals("leave")) {
|
||||
commandObj = new LeaveCommand(this, sender, arguments);
|
||||
}
|
||||
else if (command.equals("team")) {
|
||||
commandObj = new TeamCommand(this, sender, arguments);
|
||||
}
|
||||
else {
|
||||
// we are not responsible for this command
|
||||
return true;
|
||||
|
@ -0,0 +1,35 @@
|
||||
package bukkit.tommytony.war.command;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import bukkit.tommytony.war.War;
|
||||
import bukkit.tommytony.war.WarCommandHandler;
|
||||
|
||||
import com.tommytony.war.Team;
|
||||
|
||||
public class TeamCommand extends AbstractWarzoneCommand {
|
||||
public TeamCommand(WarCommandHandler handler, CommandSender sender, String[] args) {
|
||||
super(handler, sender, args);
|
||||
}
|
||||
|
||||
public boolean handle() {
|
||||
if (!(this.sender instanceof Player)) return true;
|
||||
|
||||
Player player = (Player) this.sender;
|
||||
Team playerTeam = War.war.getPlayerTeam(player.getName());
|
||||
if (playerTeam == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ChatColor color = playerTeam.getKind().getColor();
|
||||
String teamMessage = color + player.getName() + ": " + ChatColor.WHITE;
|
||||
for (String part : this.args) {
|
||||
teamMessage += part + " ";
|
||||
}
|
||||
playerTeam.teamcast(teamMessage);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user