Changing the new player List(Where the names of players is shown in the ServerPing)

Discussion in 'Plugin Development' started by nuno1212sss, Feb 28, 2014.

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

    nuno1212sss

    Hi boys n girlz,
    Does anyone know what is the event or whatever it is that it takes to change the player List.
    Please help :D

    Bump. Any1?

    werter318 Not the MOTD, The new player list of 1.7.2.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  2. Offline

    Wolvereness Bukkit Team Member

  3. Offline

    nuno1212sss

    Wolvereness Do you know the server mcpvp.com, well when you hover over their player number it shows something, that is what I am looking for :D!
     
  4. Offline

    connor stone

    Thats what he just gave you
     
  5. Offline

    nuno1212sss

    connor stone Well I know I read it but, I have no idea how to use it.
     
  6. Offline

    alex123099

    nuno1212sss
    Im guessing
    @EventHandler
    public void blabla(ServerListPingEvent e){
    //do stuff
    }
     
  7. Offline

    nuno1212sss

    alex123099 -,-" if you are here to kid arround you can go away, I don't know how to change the number of players displayed and what they display.
     
  8. Offline

    alex123099

    nuno1212sss
    I'm not kidding in any way o.o
    You asked on how to use this class he provided you with, and that's how you use it. Then use the e variable and do what you need
     
  9. Offline

    connor stone

    I have not used it , but I assume to add a message instead you could clear the list and add some new player vars you create with the text as the names
     
  10. Offline

    nuno1212sss

    alex123099 my problem is in the variable, I do not know how to change Iterator's, just know how to use them with a while, so I was thinking like
    Code:java
    1. while(itr.hasNext()){
    2. String s = irt.toString();
    3. s = "===========" + ChatColor.RED + "LusoCraft" + "============";
    4. itr.??????//Do not know what to put :D!
    5. }


    Code:java
    1. List<String> list = new ArrayList<String> ();
    2. @SuppressWarnings("unchecked")
    3. @EventHandler
    4. public void ServerList(ServerListPingEvent e) {
    5. int max = e.getNumPlayers();
    6. max = 5;
    7. e.setMaxPlayers(max);
    8. Iterator<Player> a = e.iterator();
    9. while(a.hasNext()){
    10.  
    11. String s =a.toString();
    12. s = "==========" + ChatColor.RED + "LusoCraft" + "==========";
    13. list.add(s);
    14. a = (Iterator<Player>) list;
    15. list.clear();
    16. }

    I don't know I just made this ;(

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  11. Offline

    connor stone

    Try something like this

    Itr.clear or whatever
    Itr.add(bukkit.getPlayer("texthere"));
     
  12. Offline

    nuno1212sss

    connor stone No can do... Never heard of Iterator's ? you can't .add(), .clear() anything, that's why I hate them -,-"
     
  13. Offline

    connor stone

    Ahh, didnt realise.

    Use a = list.Iiterator()?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  14. Offline

    ZeusAllMighty11

    I think the OP was referring to the new feature in 1.7, where hovering over the player count will list the players. Most servers that take advantage of this feature change the player names to be special messages, like this:

    [​IMG]



    You can achieve this through Protocollib, and I believe there are a few posts in the resource section telling how to do so.
     
  15. Offline

    nuno1212sss

    ZeusAllMighty11 YES THANK YOU THAT'S EXACLY IT!z

    ZeusAllMighty11 But where is it in the resource, I can't seem to find it :(

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
Thread Status:
Not open for further replies.

Share This Page