Modify online player list

Discussion in 'Plugin Development' started by mcat95, Nov 6, 2012.

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

    mcat95

    Hello, I'm developing a plugin, and i want to show extra data on online player list, for example, their level. Is it possible? How can i do it?

    Thanks,Mcat.
     
  2. Offline

    Njol

    You can change a player's list name, but be aware that it is limited to 16 characters, including colour codes (which are 2 characters each)
     
  3. Offline

    Rprrr

    player.setPlayerListName(namestufzhere);
     
  4. Offline

    mcat95

    I understand you but i want to do something like this:[​IMG]
    In a different column, and allow only 10 players in the server.
     
  5. Offline

    fireblast709

    mcat95 isn't that list quite random? so wouldn't it screw up? Besides if its max 10 players would it not only draw 10 cells
     
  6. Offline

    gamerzap

    Yeah, you'd probably need to screw around with craftbukkit a lot (and possibly even modify it) to get that to work correctly.
     
  7. Offline

    Njol

    If you want to display more information than the default client displays you have to use Spout or a custom client mod. You could alrernatively display one or more fake player name(s) under every player whose names are the information you want to display.

    PS: This is the only data send to the client: http://wiki.vg/Protocol#Player_List_Item_.280xC9.29
     
  8. Offline

    iZanax

    If u just send this packet, u can add Fake players,
    But u cant Edit other online players,
    like making them appear offline or change colour.
    When I had this kind of question, people requested ProticolLib,
    but if u know a method that don't require an external plugin/API, feel free to share.
     
  9. Offline

    fireblast709

    you can hide people from plain sight, and change their colour. Both tested and confirmed for 1.4.2. For offline, you cannot hide them from the playerlist in the serverlist, unless you modify CB to do so.
    besides, achievement got: "hid from plain sight"
    Code:java
    1. Packet29DestroyEntity packet = new Packet29DestroyEntity(p.getEntityId());
    2. ((CraftPlayer)t).getHandle().netServerHandler.sendPacket(packet);
    3. Packet201PlayerInfo packet2 = new Packet201PlayerInfo("Fireblast709", false, 0);
    4. ((CraftPlayer)t).getHandle().netServerHandler.sendPacket(packet2);

    t = target Player
    p = Player
     
  10. Offline

    mcat95

    @iZanaz create fake players sound good, and i don't want to use any external client api, like spout. I will search a way to allow only 10 players and write 20 in the server config.
    @fireblast09 i don't want to modify existing players because if their name is long (15,16 characters), and i add more characters, i will exceed the 16 char. limit

    P.D. I don't know how to create fake players
     
  11. Offline

    fireblast709

    mcat95 use the second packet, just works fine for me (it creates a new 'online' player in the tab list)
    Code:java
    1. Packet201PlayerInfo packet2 = new Packet201PlayerInfo("I am so awesome", true, 0);
    2. ((CraftPlayer)p).getHandle().netServerHandler.sendPacket(packet2);
    3. Packet201PlayerInfo packet3 = new Packet201PlayerInfo("do not exceed", true, 0);
    4. ((CraftPlayer)p).getHandle().netServerHandler.sendPacket(packet3);
    5. Packet201PlayerInfo packet4 = new Packet201PlayerInfo("the name limit", true, 0);
    6. ((CraftPlayer)p).getHandle().netServerHandler.sendPacket(packet4);
    7. Packet201PlayerInfo packet5 = new Packet201PlayerInfo("or"+ChatColor.RED+" IOException", true, 0);
    8. ((CraftPlayer)p).getHandle().netServerHandler.sendPacket(packet5);

    Order can be a bit wrong though xD, though I succeeded to make it look good tablist.png
     
    zThana likes this.
  12. Offline

    mcat95

    Cool, i will test it :D

    Ok, new info xD

    With a for and a timer I send the packets to all the players. May be possible to redraw all the table and make it to be order???

    Thanks a lot [cake]

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 29, 2016
  13. Offline

    ZeusAllMighty11

    There is no way to position columns as far as I know...
     
    fireblast709 likes this.
  14. Offline

    mcat95

    Ok, like it's difficult and i don't know how to do i will do a /info command. Thanks a lot.
     
  15. Offline

    fireblast709

    ZeusAllMighty11 there is an order, its called FIFO (First in, first out). This would actually be FIFI, as it the first packet the gets in, will get in the first slot
     
  16. Offline

    SirTyler

    I have not tried this, but its an interesting thought. What happens if you said more packets then the server has player slots? Does it expand the list or simply not show them?
     
  17. Offline

    fireblast709

    It does not show them (just tested that)
     
  18. Offline

    mcat95

    Ok, so there are no way to redraw all entirely?. For example the xp may change
     
  19. Offline

    fireblast709

    mcat95 not a way that works 100% of the time
     
  20. Offline

    Njol

    You can send a packet with false instead of true for all entires on the list which will clear it and then add them back in in order.
     
  21. Offline

    fireblast709

    Yep, forgot to mention xD
     
  22. Offline

    iZanax

    Modifying online players is not possible with Packet201PlayerInfo,
    When I tried it and asked it on the forums,
    they suggested to use ProticolLib, but if it is possible with
    just sending Packet201, please tell : )
     
  23. Offline

    fireblast709

    It is. Though it can be a bit unstable sometimes, as you will have to send the packets each time someone joins , and on every other change you want.

    Btw, you have a link to that thread ;3?
     
  24. Offline

    iZanax

  25. Offline

    fireblast709

    iZanax lolz
    No just had to place a semi troll post on there
     
  26. Offline

    mcat95

    Ok, i will try to use packet201 to make all players apear offline, and i will send all players to all clients. Sounds good, lets see if it works.

    Thanks to all
     
Thread Status:
Not open for further replies.

Share This Page