From 03147302d36ebd4033adee7f2f6be1dd35a512db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=9D=8F=E9=BB=91?= Date: Wed, 3 Oct 2018 15:23:25 +0800 Subject: [PATCH] =?UTF-8?q?+=20=E8=B0=83=E6=95=B4=E8=AF=AD=E8=A8=80?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/me/skymc/taboolib/cloud/TCloudCommand.java | 11 ++++++----- src/main/resources/lang/zh_CN.yml | 6 +++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/me/skymc/taboolib/cloud/TCloudCommand.java b/src/main/java/me/skymc/taboolib/cloud/TCloudCommand.java index 4baea78..20f2c78 100644 --- a/src/main/java/me/skymc/taboolib/cloud/TCloudCommand.java +++ b/src/main/java/me/skymc/taboolib/cloud/TCloudCommand.java @@ -218,19 +218,20 @@ public class TCloudCommand extends BaseMainCommand { } Map 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 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"); diff --git a/src/main/resources/lang/zh_CN.yml b/src/main/resources/lang/zh_CN.yml index 7be8925..832d64f 100644 --- a/src/main/resources/lang/zh_CN.yml +++ b/src/main/resources/lang/zh_CN.yml @@ -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[可更新]'