CommandBook.inst().checkPermission(sender, "commandbook.kit.list");
Map<String, Kit> kits = getKitManager().getKits();
if (kits.size() == 0) {
throw new CommandException("No kits are configured.");
}
StringBuilder str = new StringBuilder();
int count = 0;
for (String id : kits.keySet()) {
if (!CommandBook.inst().hasPermission(sender,
"commandbook.kit.kits." + id.replace(".", ""))) {
continue;
}
if (str.length() != 0) {
str.append(", ");
}
str.append(id);
count++;
}
if (count == 0) {
throw new CommandException("You have access to no kits.");
}
sender.sendMessage(ChatColor.YELLOW + "Kits (" + count + "): "
+ ChatColor.WHITE + str.toString());
sender.sendMessage(ChatColor.YELLOW + "Use /kit kitname to get a kit.");
// Give a kit
} else {
Iterable<Player> targets;
String id = args.getString(0).toLowerCase();
boolean included = false;
if (args.argsLength() == 2) {
targets = InputUtil.PlayerParser.matchPlayers(sender, args.getString(1));
} else {
targets = Lists.newArrayList(PlayerUtil.checkPlayer(sender));
}
for (Player player : targets) {
if (player != sender) {
// Check permissions!
CommandBook.inst().checkPermission(sender, "commandbook.kit.other");
}
}
Kit kit = getKitManager().getKit(id);
if (kit == null) {
throw new CommandException("No kit by that name exists.");
}
CommandBook.inst().checkPermission(sender, "commandbook.kit.kits." + id.replace(".", ""));
for (Player player : targets) {