mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-03 15:08:18 +01:00
Auto complete /mail clear indices (#5132)
This commit is contained in:
parent
4aa93a43db
commit
767185ec32
@ -298,9 +298,21 @@ public class Commandmail extends EssentialsCommand {
|
|||||||
if (pages == 0) {
|
if (pages == 0) {
|
||||||
return Lists.newArrayList("0");
|
return Lists.newArrayList("0");
|
||||||
} else {
|
} else {
|
||||||
final List<String> options = Lists.newArrayList("1");
|
final List<String> options = new ArrayList<>();
|
||||||
if (pages > 1) {
|
for (int i = 0; i < pages; i++) {
|
||||||
options.add(String.valueOf(pages));
|
options.add(String.valueOf(i + 1));
|
||||||
|
}
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
} else if (args[0].equalsIgnoreCase("clear")) {
|
||||||
|
final ArrayList<MailMessage> mail = user.getMailMessages();
|
||||||
|
// We show up to 9 mails on a page, we don't need to autocomplete more than that...
|
||||||
|
if (mail.size() >= 9) {
|
||||||
|
return Lists.newArrayList("1", "2", "3", "4", "5", "6", "7", "8", "9");
|
||||||
|
} else {
|
||||||
|
final List<String> options = new ArrayList<>();
|
||||||
|
for (int i = 0; i < mail.size(); i++) {
|
||||||
|
options.add(String.valueOf(i + 1));
|
||||||
}
|
}
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user