sendMessage() - scrolling text one "page" at a time

Discussion in 'Plugin Development' started by Etsijä, Apr 15, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Etsijä

    I'm writing an admin plugin, which needs to show from time to time a lot of info (about the players on server) through chat. I'm trying to do this in a proper, user-friendly way, but cannot figure out how to implement a "print the info page by page" sort of thing. I mean, print it the way very large helpfiles print out.

    Let's say I have this command:

    /stats newest 200

    which shows some basic info about the 200 players latest logged in to the server. Now, implementing all this stuff straight away with sendMessage() is useless, since the chat scrolls so that the oldest info is left in the buffer only. I'm looking for a way to control my output so that the plugin first shows me, say, 50 lines of text and then tells me to do "/stats 2" or something along that line - to bring me the next batch of info.

    Now, I'm sure this can be done, since that is almost exactly how the help texts work. I just can't figure out what Bukkit classes/interfaces/methods to use.
     
  2. Offline

    RainoBoy97

    This is what I use, works brilliantly :)
     
  3. Offline

    Etsijä

    That seems very useful to adapt to my purposes. Thanks, RainoBoy!

    Could you just give an easy example of how to use that code?
     
Thread Status:
Not open for further replies.

Share This Page