summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandwarp.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java
index 94e63b7e7..4a739149f 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java
@@ -95,12 +95,19 @@ public class Commandwarp extends EssentialsCommand
page = Integer.parseInt(args[0]);
}
+ final int maxPages = (int)Math.ceil(warpNameList.size() / (double)WARPS_PER_PAGE);
+
+ if (page > maxPages)
+ {
+ page = maxPages;
+ }
+
final int warpPage = (page - 1) * WARPS_PER_PAGE;
final String warpList = StringUtil.joinList(warpNameList.subList(warpPage, warpPage + Math.min(warpNameList.size() - warpPage, WARPS_PER_PAGE)));
if (warpNameList.size() > WARPS_PER_PAGE)
{
- sender.sendMessage(_("warpsCount", warpNameList.size(), page, (int)Math.ceil(warpNameList.size() / (double)WARPS_PER_PAGE)));
+ sender.sendMessage(_("warpsCount", warpNameList.size(), page, maxPages));
sender.sendMessage(_("warpList", warpList));
}
else