2012-02-18 21:09:18 +00:00
|
|
|
package com.earth2me.essentials.textreader;
|
|
|
|
|
2013-10-16 20:59:39 +01:00
|
|
|
import com.earth2me.essentials.CommandSource;
|
2015-04-14 23:06:16 -05:00
|
|
|
|
2012-09-22 21:15:04 +01:00
|
|
|
import java.util.List;
|
2012-02-18 21:09:18 +00:00
|
|
|
|
2015-04-14 23:06:16 -05:00
|
|
|
public class SimpleTextPager {
|
|
|
|
private final transient IText text;
|
2012-02-18 21:09:18 +00:00
|
|
|
|
2015-04-14 23:06:16 -05:00
|
|
|
public SimpleTextPager(final IText text) {
|
|
|
|
this.text = text;
|
|
|
|
}
|
2012-02-18 21:09:18 +00:00
|
|
|
|
2015-04-14 23:06:16 -05:00
|
|
|
public void showPage(final CommandSource sender) {
|
|
|
|
for (String line : text.getLines()) {
|
|
|
|
sender.sendMessage(line);
|
|
|
|
}
|
|
|
|
}
|
2012-02-18 21:09:18 +00:00
|
|
|
|
2015-04-14 23:06:16 -05:00
|
|
|
public List<String> getLines() {
|
|
|
|
return text.getLines();
|
|
|
|
}
|
2012-09-22 21:15:04 +01:00
|
|
|
|
2015-04-14 23:06:16 -05:00
|
|
|
public String getLine(int line) {
|
|
|
|
if (text.getLines().size() < line) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
return text.getLines().get(line);
|
|
|
|
}
|
2012-02-18 21:09:18 +00:00
|
|
|
}
|