String[] words = line.split(" +");
if (words[0].equalsIgnoreCase("search")) {
lastResult.clear();
- for (Bot bot : core.bots()) {
- for (Pack pack : bot) {
+ for (Bot bot : Lists.newArrayList(core.bots())) {
+ for (Pack pack : Lists.newArrayList(bot)) {
boolean found = true;
for (int wordIndex = 1; wordIndex < words.length; ++wordIndex) {
if (words[wordIndex].startsWith("-") && pack.name().toLowerCase().contains(words[wordIndex].toLowerCase().substring(1))) {
}
writeLine("End of connections.");
} else if (words[0].equalsIgnoreCase("disconnect")) {
- Integer index = Ints.tryParse(words[1]);
- if ((index != null) && (index < lastConnections.size())) {
- core.closeConnection(lastConnections.get(index));
+ if ((words.length == 1) || ("all".equals(words[1]))) {
+ for (Connection connection : lastConnections) {
+ core.closeConnection(connection);
+ }
+ } else {
+ Integer index = Ints.tryParse(words[1]);
+ if ((index != null) && (index < lastConnections.size())) {
+ core.closeConnection(lastConnections.get(index));
+ }
}
}