fix for /f list command throwing an error if an invalid page number was specified (ex. 5 pages available and they run /f list 6)

This commit is contained in:
Brettflan 2012-11-30 19:43:01 -06:00
parent 066ec5cadb
commit 9e4cc676ea

View File

@ -94,6 +94,10 @@ public class CmdList extends FCommand
final int pageheight = 9; final int pageheight = 9;
int pagenumber = this.argAsInt(0, 1); int pagenumber = this.argAsInt(0, 1);
int pagecount = (factionList.size() / pageheight) + 1; int pagecount = (factionList.size() / pageheight) + 1;
if (pagenumber > pagecount)
pagenumber = pagecount;
else if (pagenumber < 1)
pagenumber = 1;
int start = (pagenumber - 1) * pageheight; int start = (pagenumber - 1) * pageheight;
int end = start + pageheight; int end = start + pageheight;
if (end > factionList.size()) if (end > factionList.size())