+ 调整语言提示

This commit is contained in:
坏黑 2018-10-03 15:23:25 +08:00
parent c23f33526a
commit 03147302d3
2 changed files with 9 additions and 8 deletions

View File

@ -218,19 +218,20 @@ public class TCloudCommand extends BaseMainCommand {
}
Map<String, Expansion> expansions = type == ExpansionType.PLUGIN ? TCloudLoader.getExpansionPlugins() : TCloudLoader.getExpansionInternal();
int page = args.length < 2 ? 1 : NumberConversions.toInt(args[1]);
if (page < 1 || page > (expansions.size() / 5) + 1) {
int pageMax = (expansions.size() / 5) + ((expansions.size() % 5) == 0 ? 0 : 1);
if (page < 1 || page > pageMax) {
TLocale.sendTo(sender, "COMMANDS.TCLOUD.LIST.INVALID-TYPE.1");
return;
}
TLocale.sendTo(sender, "COMMANDS.TCLOUD.LIST.LIST-HEAD", type.name(), String.valueOf(page), String.valueOf((expansions.size() / 5) + 1));
TLocale.sendTo(sender, "COMMANDS.TCLOUD.LIST.LIST-HEAD", type.name(), String.valueOf(page), String.valueOf(pageMax));
int i = (page - 1) * 5;
for (Map.Entry<String, Expansion> entry : new SimpleIterator(expansions).mapIterator((page - 1) * 5, page * 5)) {
if (!TCloudLoader.isExpansionExists(entry.getValue())) {
TLocale.sendTo(sender, "COMMANDS.TCLOUD.LIST.LIST-EXPANSION.0", String.valueOf(++i), entry.getValue().getName(), entry.getValue().getDescription());
TLocale.sendTo(sender, "COMMANDS.TCLOUD.LIST.LIST-EXPANSION.0", String.valueOf(++i), entry.getValue().getName(), Arrays.toString(entry.getValue().getAuthor()));
} else if (entry.getValue().canUpdate()) {
TLocale.sendTo(sender, "COMMANDS.TCLOUD.LIST.LIST-EXPANSION.1", String.valueOf(++i), entry.getValue().getName(), entry.getValue().getDescription());
TLocale.sendTo(sender, "COMMANDS.TCLOUD.LIST.LIST-EXPANSION.1", String.valueOf(++i), entry.getValue().getName(), Arrays.toString(entry.getValue().getAuthor()));
} else {
TLocale.sendTo(sender, "COMMANDS.TCLOUD.LIST.LIST-EXPANSION.2", String.valueOf(++i), entry.getValue().getName(), entry.getValue().getDescription());
TLocale.sendTo(sender, "COMMANDS.TCLOUD.LIST.LIST-EXPANSION.2", String.valueOf(++i), entry.getValue().getName(), Arrays.toString(entry.getValue().getAuthor()));
}
}
TLocale.sendTo(sender, "COMMANDS.TCLOUD.LIST.LIST-BOTTOM");

View File

@ -622,9 +622,9 @@ COMMANDS:
- '&e&l----- &6&lTabooLibCloud Expansions : &f{0} &6&l: &f{1}/{2} &e&l-----'
- ''
LIST-EXPANSION:
0: ' &f{0}. &8{1} &f- &7{2}'
1: ' &f{0}. &c{1} &f- &7{2}'
2: ' &f{0}. &a{1} &f- &7{2}'
0: ' &f{0}. &8{1} &7{2}'
1: ' &f{0}. &c{1} &7{2}'
2: ' &f{0}. &a{1} &7{2}'
LIST-BOTTOM:
- ''
- ' &f> &8[未安装] &a[已安装] &c[可更新]'