Setting a players suffix

Discussion in 'Plugin Development' started by Buckle_up, Jun 26, 2016.

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

    Buckle_up

    Im working on a title plugin for my server, and i am wondering, how to give a certain player a certain suffix, i cant seem to find an api that will do it, and i player.setdisplayname() doesn't work, any ideas?
     
  2. Offline

    Irantwomiles

    I think you have to do it using the #setFormat on Async chat event
     
  3. Offline

    Buckle_up

    If i set it like that though, how would i save the currently selected player title?, to use in the async chat event?
     
  4. Offline

    567legodude

    @Buckle_up You can either add the suffix yourself in the async chat event. Or put the player on a team and set a team suffix. Both work, but depending on what you want, one might be used over the other.
     
  5. Offline

    Buckle_up

    ok, but i'm setting the suffix in the same plugin, what i am asking is how do i save the title they chose so on the chat event i can assign them the correct one
     
  6. Offline

    ArsenArsen

    HashMap with player as key and title as value. Afterwards if you really need to you can save it into a yml file using players UUID as key and title as value, then load it back into the HashMap in onEnable. Also you might want to just modify the display name of a player to achieve this. So it doesn't conflict with plugins like townychat.
     
  7. Offline

    Buckle_up

    Whats the difference between just setting a format and modifying the players display name?
     
  8. Offline

    567legodude

    @Buckle_up That means any plugin that uses #getDisplayName from the player will also have the suffix you set. Although most plugins just use #getName
     
  9. Offline

    WolfMage1

    I thought teams only set suffix's on the name tag?
     
  10. Offline

    Buckle_up

    Is there any way i could set it with for example groupmanager? i really need some ideas, and i dont know how to save a hashmap to a config file either.
    EDIT: if i add the same player to a hasmap with a different title, will it overwrite the old title?
     
    Last edited: Jun 27, 2016
  11. Offline

    567legodude

    @WolfMage1 If you put yourself on a team with a prefix and then chat (with no plugins that modify chat) you will have the prefix.
     
  12. Offline

    Buckle_up

    @567legodude but what if you dont want the player on a team? and it needs to be a suffix?
     
Thread Status:
Not open for further replies.

Share This Page