Different PlayerList and DisplayName (mchat)

Discussion in 'Plugin Development' started by Terradominik, Jul 11, 2012.

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

    Terradominik

    Hey, i use the plugin mchat to format my chat with prefix etc, so as an example in chat (DisplayName) is "[Admin] Terradominik" in red but the playerlistName is only "Terradominik" in red, that works fine, but i want to change only the Display name with one of my own plugins, but this only works till the player writes something in the chat, than the playerlist name updates again to the (from mchat modified) display name.

    (in my example i want to add a yellow "[HC]" in front of the name in the playerlist)

    How do i mange this to not happen ?
     
  2. Offline

    gjossep

    Do a command for list, get the online players loop thro it, get the display name and add that to a stringbuilder the show that list to the sender.
     
  3. Offline

    Terradominik

    i dont mean a list in the chat i mean the PlayerList (when you click [TAB])
     
  4. Offline

    gjossep

    I don't think you can edit that without spout or something really hard in the plugin. But i dont think its posible as that list is client side, i believe!

    Gjosse
     
  5. Offline

    Terradominik

    the thing is, it worksif i change the displayname too, (this would be no problem), but then i have the problem, when i want to remove the "[HC]" etc. the plugin can't change the color to its mchat value
     
  6. Offline

    gjossep

    So you want to get the Display Name, but also remove the [HC] part? Well if so,

    You say "works if i change the displayname" how did you change the display name? Or what did you mean?
     
  7. Offline

    Terradominik

    lets forget abaut that [HC] part, the thing i want specific in my plugin is that when somebody is listed in my hardcore plugin he should get something in the playerlist, that is different from the otheplayers, so that the hc players can simply click TAB to see whos in the game and ho is not but when they leave i want to change those names to their previous ones.

    Soryy for the bad english
     
  8. Offline

    gjossep

    I think i get what u mean,

    Make a hash map with all the players that are "hardcore" and then if they are in the hash map, give them a different Display name, if there not in the hash map then don't.
     
  9. Offline

    Terradominik

    how should this solve my problem ?

    yes i thought about that...but isn't there a easier way ?

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

    gjossep

    Its pretty simple, Do you have a method where you put a player in to the HardCore mode?
    If yes just post it here and all show you how!
     
  11. This was more to gjossep that to you, cause he told it's hard/impossible to change the name in the list. But also for you as you simply could make this:
    Code:java
    1. public void changeDisplayAndListName(Player p, String newName)
    2. {
    3. p.setDisplayName(newName);
    4. if(newName.length() > 16)
    5. newName = newName.substring(0,16);
    6. p.setPlayerListName(newName);
    7. }

    Then remove every setDisplayName() and setPlayerListName() from your code and call your new method instead. Result: Synchronized names in the chat and in the tab list.

    But to be fair I don't really understand what your problem is.
     
  12. Offline

    Terradominik

    the problem is, that i only want to change the list name so that i can set the list name later to what it was before (DisplayName) but when i set the List name and a Player writes something in the chat the list name gets updated
     
  13. Weird... But the author of ColoredTabList may be able to help you... beleg ?
     
  14. Offline

    beleg

    I guess thats because mChat updates the playerlistname on playerchatevent ;) you'd have to disable that somehow (modify mchat or ask for an option in the config if there isnt already one)
     
    Terradominik likes this.
Thread Status:
Not open for further replies.

Share This Page