Prefix changes not working

Discussion in 'Plugin Development' started by bkleinman1, Sep 4, 2014.

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

    bkleinman1

    I have tried to get this working a few different ways, and am not sure why it is not working.

    What I am trying to do, is get a players name (With prefix's that have been previously set in PEX) and add a new prefix to the start of this, depending on a rank, that I have coded.

    This is my most recent attempt, that did not work:
    Code:java
    1. String name = ranks.get(rank) + " >> " + player.getDisplayName();
    2. player.setDisplayName(name);

    ('ranks' is a List, and 'rank' is an int that lets me get a specific string in the list.)

    It did not display any errors in console, and from what I can see, it did change the display name, as when I outputted the display name, it was how I had set it. Does this mean that the name displayed in chat, is not the DisplayName? I have Essentials Chat, and I presume that this is formatting the chat, does this change anything?
     
  2. i think you need to do, player.setCustomDisplayName(name); and setCustomNameVisible(true);
    but this does remove the skin (I think, unless it has been moved to uuid), or you use a api/plugin like nametagedit (this uses some scoreboard packets to create the prefixes).
     
  3. Offline

    cakemasher

    Hey bkleinman1,

    Where do you have your code placed under?

    I'm also using a prefix system on my server, and placed about the same code under the function that is executed when the player joins.

    I'm using setDisplayName aswell.
    Code:java
    1.  
    2. player.setDisplayName (getPrefix (player, ChatColor.GRAY));
    3.  

    Where 'getPrefix' returns something like:
    Code:java
    1.  
    2. (String) ChatColor.RED + "[Admin]" + ChatColor.GRAY + " " + player.getname ();
    3.  
     
Thread Status:
Not open for further replies.

Share This Page