Solved [HELP] Tablists???

Discussion in 'Plugin Development' started by kevinspl2000, Oct 20, 2013.

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

    kevinspl2000

    So I want to add a function to my plugin where if you have a permission you can change the TabList color for the player name. But how would I do this? Does Bukkit already have a method for it? I heard people are using vault for it, and if they are how do I use it?

    help?

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

    tommykins20

    player.setPlayerListName()?
     
  3. Offline

    kevinspl2000

    Getting errors when I try to add color.
    CODE:
    Code:java
    1. public static String getTablist (Player player) {
    2. if(player.getName().equals("KevPvP")){
    3. return player.setPlayerListName(ChatColor.DARK_RED "");
    4. }
    5. }

    The error is in Eclipse saying
    Code:
    The method setPlayerListName(String) in the type Player is not applicable for the arguments (ChatColor)
    highlighted under the setPlayerListName
    EDIT: I need it to be a string because on one of the strings I will tell it to be more than just one color

    Hm I've been thinking by getting the color by a char. I'll do some research

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
  4. kevinspl2000
    You forgot the "+" that's why it's giving that error.
    So it should be:
    Code:
    return player.setPlayerListName(ChatColor.DARK_RED +  "");
     
  5. Offline

    kevinspl2000

    I did some research and I have to implement it to the tablist somehow. I know I can do player.setPlayerListName(ChatColor.DARK_RED + player.getName())
    but how would I apply it to the tablist. I know for chat the string to change the player name is %1$s but what is it for the tablist???

    legostarwarszach
    So I don't need the +?
    Anyways I am still getting an error

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
  6. kevinspl2000
    You DO need the +

    Try this:
    Code:
    Player p = Bukkit.getOfflinePlayer(player);
    //Has to be offline player, not online
    ((CraftPlayer)p).getHandle().netServerHandler.sendPacket(new Packet201PlayerInfo(p, true, 10));
    // Name(String) , Show(boolean) , Conenction(int)
     
  7. Offline

    kevinspl2000

    One sec I you posted your code without it and then edited it....

    legostarwarszach
    Where should I paste this?
    And would I have to do something with @EventHandler?

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

    macguy8

    I honestly have no clue what legostarwarszach is doing.

    kevinspl2000 Just use player.setPlayerListName(thisIsAString);

    Example:

    player.setPlayerListName(ChatColor.BLUE + player.getName());

    The example above would make my tab name blue.
     
  9. Offline

    kevinspl2000

    Thanks guys for all help I found a solution. You have to put the code in the PlayerLoginEvent then you have to set it to a public boolean
     
Thread Status:
Not open for further replies.

Share This Page