Page 1 of 1

[JAVA][BUKKIT] ChatPagniator

Posted: Mon Oct 29, 2012 4:36 am
by exload
I am trying to make a help menu with pages for my plugin. I found this class in the apidocs. http://jd.bukkit.org/apidocs/org/bukkit ... tPage.html
I was curious how it works and if it would save me some time in the future. So, my question, how exactly would this work for creating a paged help menu ? Would it really save time ?

Re: [JAVA][BUKKIT] ChatPagniator

Posted: Mon Oct 29, 2012 12:50 pm
by jacek
It looks like it returns a portion of the array for the given page number, so it that should be pretty useful for creating pages :P I've not used it personally but you should be able to using it directly with a CommandSender
sender.sendMessage(ChatPaginator.ChatPage(helpLines));
you could also look how it's used in the /help command.

Re: [JAVA][BUKKIT] ChatPagniator

Posted: Wed Oct 31, 2012 12:49 am
by exload
jacek wrote:It looks like it returns a portion of the array for the given page number, so it that should be pretty useful for creating pages :P I've not used it personally but you should be able to using it directly with a CommandSender
sender.sendMessage(ChatPaginator.ChatPage(helpLines));
you could also look how it's used in the /help command.
Yes I have looked at that, however, it seems as though it becomes overly complicated for a simple task that I am going for. This is how I set it up currently:
String[] lines = new String[msg.size()];
ChatPage page = new ChatPage(msg.toArray(lines), 1, 4);
I am unsure how to send a player a specific page though.

As a side note, I ticked "notify me when reply is posted" and I did not receive any email when you replied to this post, assuming that is the purpose of that checkbox.. :P )

Re: [JAVA][BUKKIT] ChatPagniator

Posted: Wed Oct 31, 2012 2:45 am
by jacek
ChatPage has getLines() which should be all of the lines that are meant to appear on that page. There is also getPageNumber() and getTotalPages() which could be useful for a nice header :)
exload wrote:As a side note, I ticked "notify me when reply is posted" and I did not receive any email when you replied to this post, assuming that is the purpose of that checkbox.. :P )
Urg, spam filters usually.

Re: [JAVA][BUKKIT] ChatPagniator

Posted: Wed Oct 31, 2012 3:14 am
by exload
jacek wrote:ChatPage has getLines() which should be all of the lines that are meant to appear on that page. There is also getPageNumber() and getTotalPages() which could be useful for a nice header :)
exload wrote:As a side note, I ticked "notify me when reply is posted" and I did not receive any email when you replied to this post, assuming that is the purpose of that checkbox.. :P )
Urg, spam filters usually.
Oh. I was thinking this class had an entirely different function and ability. My hope was to send it a huge arraylist of messages that I wanted it to display. It would have the amount of lines per page as a parameter. Then once you created an instance of this class you would be able to access methods such as getPage(id), getTotalPages(), and getPageNumber().
Something along those lines.
I have tried creating my own class to do this function but I ran into several issues when sending a page based on permissions a user had.

Also I searched through my spam and could not find any notification from this site.

Re: [JAVA][BUKKIT] ChatPagniator

Posted: Fri Nov 02, 2012 11:49 pm
by jacek
exload wrote:Oh. I was thinking this class had an entirely different function and ability. My hope was to send it a huge arraylist of messages that I wanted it to display. It would have the amount of lines per page as a parameter. Then once you created an instance of this class you would be able to access methods such as getPage(id), getTotalPages(), and getPageNumber().
Something along those lines.
I think it does that, you get the ChatPage for the page you want then the lines on that page are getLines()
exload wrote:Also I searched through my spam and could not find any notification from this site.
@live.com by any chance ? They are often out right rejected too.

Re: [JAVA][BUKKIT] ChatPagniator

Posted: Sun Nov 04, 2012 7:20 am
by exload
jacek wrote:
exload wrote:Oh. I was thinking this class had an entirely different function and ability. My hope was to send it a huge arraylist of messages that I wanted it to display. It would have the amount of lines per page as a parameter. Then once you created an instance of this class you would be able to access methods such as getPage(id), getTotalPages(), and getPageNumber().
Something along those lines.
I think it does that, you get the ChatPage for the page you want then the lines on that page are getLines()
exload wrote:Also I searched through my spam and could not find any notification from this site.
@live.com by any chance ? They are often out right rejected too.
Yes, however, when I send the player the lines in getLines() it sends every line that I have in my ArrayList.

I am still not seeing anything from @live.com.

Re: [JAVA][BUKKIT] ChatPagniator

Posted: Sat Nov 10, 2012 9:52 pm
by jacek
exload wrote:Yes, however, when I send the player the lines in getLines() it sends every line that I have in my ArrayList.
In that case, it seems pretty useless :s
exload wrote:I am still not seeing anything from @live.com.
I'm not planning on doing anything about it, Microsoft need to be less strict :P

Re: [JAVA][BUKKIT] ChatPagniator

Posted: Mon Nov 12, 2012 8:32 pm
by exload
jacek wrote:
exload wrote:Yes, however, when I send the player the lines in getLines() it sends every line that I have in my ArrayList.
In that case, it seems pretty useless :s
exload wrote:I am still not seeing anything from @live.com.
I'm not planning on doing anything about it, Microsoft need to be less strict :P
I think I will just continue with making my own class to do this function then :P Thanks for your help! :D