Files
craftinc-gates/src/org/mcteam/ancientgates/commands/CommandList.java
T
Olof Larsson b7aa648e03 first commit
2011-04-06 21:43:57 +02:00

38 lines
734 B
Java

package org.mcteam.ancientgates.commands;
import java.util.ArrayList;
import java.util.List;
import org.mcteam.ancientgates.Conf;
import org.mcteam.ancientgates.Gate;
import org.mcteam.ancientgates.util.TextUtil;
public class CommandList extends BaseCommand {
public CommandList() {
aliases.add("list");
aliases.add("ls");
hasGateParam = false;
helpDescription = "Display a list of the gates";
}
public void perform() {
List<String> ids = new ArrayList<String>();
for (Gate gate : Gate.getAll()) {
ids.add(Conf.colorAlly + gate.getId());
}
if (ids.size() == 0) {
sendMessage("There are no gates yet.");
return;
}
sendMessage(TextUtil.implode(ids, Conf.colorSystem+", "));
}
}