Solved How is this possible?

Discussion in 'Plugin Development' started by GriffinPvP, Feb 16, 2014.

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

    GriffinPvP

    I just want to know how I can achieve this:

    [​IMG]

    A name on the TAB list was greater than 16 characters. As you can see, it has 16 chars plus a color code, making it 18 chars. How can I do that?
     
  2. Offline

    Arcoz

    Using scoreboards
     
  3. Offline

    Da_Co0k1eZ

    Code:java
    1. player.setPlayerListName(Color.ORANGE + "cammyanderson765");

    Like That.
     
  4. Offline

    MrInspector

    nono, I'm pretty sure characters don't show up if they're longer than 16 char.
     
  5. Offline

    SuperOmegaCow

    MrInspector GriffinPvP you can give them a prefix and suffix to get their name well over 16 characters.
     
  6. Offline

    GriffinPvP

    Arcoz Sorry to tag you, but can you please be more specific?

    SuperOmegaCow A color code takes two chars, and changing their PlayerListName only supports names that are smaller than 16 chars.

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

    Arcoz

  8. Offline

    GriffinPvP

    I've tried this code:
    Code:
            Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
     
            Objective tab = board.registerNewObjective("lel2", "dummy");
     
            tab.setDisplaySlot(DisplaySlot.PLAYER_LIST);
            for(Player online : Bukkit.getOnlinePlayers()) {
                Score name = tab.getScore(Bukkit.getOfflinePlayer(online.getDisplayName()));
            }
    The only thing is I get this result: [​IMG]

    How can I remove the score? I don't even know if that's how I should do it..
     
  9. Offline

    ItsLeandro

    Last line of code, it says: getScore(), thats why it shows the 0.
    Get rid of the getScore() :p
     
  10. Offline

    GriffinPvP

    But without using a score, how will i set their name on the scoreboard? Is there another way?

    Edit: I also tested it with tab.setDisplayName(), but the 0 doesn't disappear.

    I derp. Solved.

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

Share This Page