package module.command.character;
import java.util.Map.Entry;
import module.character.Group;
import module.character.api.ICharacter;
import module.command.CommandServer;
import module.command.api.ICommand;
import module.item.api.IEquipment;
import module.utility.HelpUtil;
import module.utility.Search;
public class Remove implements ICommand {
private String[] name;
public Remove() {
name = new String[2];
name[0] = "remove";
name[1] = "rem";
}
@Override
public String[] getName() {
return name;
}
@Override
public boolean action(ICharacter c, String[] command) {
Group g = c.getMyGroup();
synchronized (g.getAtRoom()) {
if (command.length == 2) {
CommandServer.informGroup(g, "�A�Q��" + c.getChiName()
+ "���U����O?\n");
return false;
}
for (Entry<IEquipment.EquipType, IEquipment> entry : c
.getEquipment().entrySet()) {
if (Search
.searchName(entry.getValue().getEngName(), command[2])) {
entry.getValue().onRemove(c);
if (g.getInBattle())
return true;
else
return false;
}
}
CommandServer.informGroup(g, c.getChiName() + "�èS����۳o��˳ơC\n");
return false;
}
}
@Override
public String getHelp() {
String output = HelpUtil.getHelp("resources/help/remove.help");
output += "\n";
output += HelpUtil.getHelp("resources/help/chooseTeammate.help");
return output;
}
}