Player Color Name Change

Discussion in 'Plugin Development' started by sethrem, Oct 19, 2014.

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

    sethrem

    Hello My Fellow Bukkitians,
    I was wondering on how to change a player's name above their head and making them keep their skin.

    Please Do not link me to any plugins I would like this in my own plugin.

    Notice: I have already figured out how to change a players name on the player's list and their chat name.
     
    ChipDev likes this.
  2. Offline

    mine-care

    Try tag api a library made for this purpose but be CAREFULL once in the 1.8 this wont be working
     
  3. Offline

    FerusGrim

    Changing the player's name above their head is a tricky piece of work, because it's the Client's interpretation of the information they receive from the Server about the player. As far as Bukkit goes, their's no built-in way to modify this specific interpretation, meaning you have to manually forge the packets being sent to the Client.

    TagAPI is a great library that can be used for this, as mine-care has already pointed out. If you don't wish to use TagAPI (I understand wanting that independence!), go take a look at the source, and learn from the parts that you would need to use, and then implement it into your plugin!
     
    mine-care likes this.
  4. Offline

    Konato_K

    Your post says you want to change the name, but the title says only the color?

    In the case you only want to change the color you can achieve this by using scoreboards, just put the players in a team that has a colored prefix and BOOOM!
     
  5. Offline

    FerusGrim


    I would say that this is a fairly problematic solution to something as simple as modifying the color of the name tag. :p
     
  6. Offline

    Konato_K

    @FerusGrimWell, It actually depends on what exactly you're trying to do, by example, if I'm going to have the whole server a whole game where all players have the same scoreboard there shouldn't be a problem, of course, if you're going to have a bunch of minigames with different scoreboards then it's fairly complicated.
     
  7. Offline

    sethrem

    I tried looking at the code but couldn't get out what to do could you please help me out a bit.
     
  8. Offline

    TheCodingCat

    I think scoreboards are the simplest way to go. And on top of that, for this scenario you do not need to do per-player-scoreboards you just get bukkits main scoreboard and add the team and there you go :D!
     
  9. Offline

    sethrem


    TheCodingCat I'm not sure on how to do this could you supply me with some code?
     
  10. Offline

    Konato_K

  11. Offline

    TheCodingCat

    no no no Konato_K thats for a tutorial using per-player-scoreboards that is not what I think sethrem wants. Here this might work
    Code:java
    1. public void addScoreboard() { //once the team gets added in /scoreboard team you can delete this method.
    2. Team team = Bukkit.getScoreboardManager().getMainScoreboard().registerNewTeam("ThisIsTheNameThatWillApear in /scoreboard");
    3. team.setPrefix("ThePrefixYouWant. In this case a color");
    4. }
    5. //onJoin
    6. // if team does not contain player
    7. Bukkit.getScoreboardManager().getMainScoreboard().getTeam("TheSameNameYouRegistered").addPlayer((event.getPlayer());
     
  12. Offline

    FabeGabeMC

    sethrem
    You could use my library. You're free to modify code as long as you don't claim it as yours. (Read LICENSE if you don't know what I'm saying)
     
  13. Offline

    FerusGrim

    Why tag me? o.o;
    sethrem
     
  14. Offline

    FabeGabeMC

    FerusGrim
    whoops. meant the OP lool
    EDIT: edited
     
  15. Offline

    sethrem

    Your thing doesn't even work lol. I try to make the player's name colored and it don't work lol
    Code:
            DisguiseAPI.getAPI().disguisePlayer(player, Bukkit.getOnlinePlayers(), ChatColor.YELLOW + player.getName());
    This doesn't work.

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

    FabeGabeMC

    sethrem
    What version are you using? Remember: It's not compatible on versions higher than 1.7.9 (Authentication servers)
     
  17. Offline

    sethrem

    1.7.2
     
  18. Offline

    ChipDev

    +1 for using Bukkitians as a person; people.
     
  19. Offline

    sethrem

    FabeGabeMC To be exact when I log on with my main then log on with my alt my main crashes. GG.
     
  20. Offline

    TheCodingCat

    what errors do you get in console and/or your minecraft paste the errors please
     
  21. Offline

    fireblast709

    sethrem just use scoreboards if you only need a colour. If you change the tag, you will have issues with names that have more than 14 chars.
     
  22. Offline

    sethrem

    TheCodingCat Nvm it works fucked up my jars with my other plugin, but like is it possible to keep my current scoreboard with the team one?
     
  23. Offline

    TheCodingCat

    yes thats what my code does :D
     
Thread Status:
Not open for further replies.

Share This Page