Solved Player NameTag edit without loosing skin

Discussion in 'Plugin Development' started by Petersoj, Sep 9, 2015.

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

    Petersoj

    I have looked everywhere and can't seem to find an API or even code to change the nametag above the player. I have tried doing it with plugins like "TagAPI" and "iTag", but those are completely broken or make the player l0se their skin.

    I know of a way to do this with packets, but it won't work for some reason. There is a way to do this with scoreboards, but I believe you can only have one display slot for all scoreboards (You can't have a teams scoreboard under the player name, then have a scoreboard in the Sidebar... Correct me if i'm wrong).

    I KNOW that this is possible because Mineplex and Hypixel both do it. And Im sure other servers do it as well.

    Thanks in advance for the help.
     
  2. Offline

    Konato_K

    For 1.7 and below this is not possible.

    For 1.8 and above I have seen that changing skins is possible, and so is changing names, considering this I'd say that it's possible to do both at the same time, however, I don't know how, probably looking into both things separatelly and then trying to merge them.
     
  3. Offline

    Petersoj

    Ok thanks.

    Bump
     
  4. Offline

    rbrick

    @Petersoj https://github.com/sgtcaze/NametagEdit
    NameTagEdit uses scoreboard team packets to accomplish this. "iTag" and "TagAPI" all spawn a "new" player with a changed GameProfile. NameTagEdit (or at least the method the plugin uses) allows for more customization in that it can allow for "longer" nametags through the use of team prefixes and suffixes

    Edit: Mineplex and Hypixel use the NameTagEdit method.
     
  5. Offline

    Petersoj

    @rbrick

    I get this error whenever I load the plugin.
    Code:
    [21:39:42] [Server thread/INFO]: Failed to send packet for player (Packet209SetScoreboardTeam) :
    [21:39:42] [Server thread/WARN]: java.lang.IllegalArgumentException: Can not set java.util.Collection field net.minecraft.server.v1_8_R3.PacketPlayOutScoreboardTeam.g to java.lang.Integer
    [21:39:42] [Server thread/WARN]:     at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167)
    [21:39:42] [Server thread/WARN]:     at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171)
    [21:39:42] [Server thread/WARN]:     at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:81)
    [21:39:42] [Server thread/WARN]:     at java.lang.reflect.Field.set(Field.java:764)
    [21:39:42] [Server thread/WARN]:     at ca.wacos.nametagedit.PacketPlayOut.setField(PacketPlayOut.java:110)
    [21:39:42] [Server thread/WARN]:     at ca.wacos.nametagedit.PacketPlayOut.<init>(PacketPlayOut.java:66)
    [21:39:42] [Server thread/WARN]:     at ca.wacos.nametagedit.NametagManager.sendPacketsAddTeam(NametagManager.java:395)
    [21:39:42] [Server thread/WARN]:     at ca.wacos.nametagedit.NametagManager.register(NametagManager.java:48)
    [21:39:42] [Server thread/WARN]:     at ca.wacos.nametagedit.NametagManager.declareTeam(NametagManager.java:280)
    [21:39:42] [Server thread/WARN]:     at ca.wacos.nametagedit.NametagManager.get(NametagManager.java:312)
    [21:39:42] [Server thread/WARN]:     at ca.wacos.nametagedit.NametagManager.overlap(NametagManager.java:193)
    [21:39:42] [Server thread/WARN]:     at ca.wacos.nametagedit.NametagEdit$1.run(NametagEdit.java:148)
    [21:39:42] [Server thread/WARN]:     at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:71)
    [21:39:42] [Server thread/WARN]:     at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:350)
    [21:39:42] [Server thread/WARN]:     at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:726)
    [21:39:42] [Server thread/WARN]:     at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:367)
    [21:39:42] [Server thread/WARN]:     at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:657)
    [21:39:42] [Server thread/WARN]:     at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:560)
    [21:39:42] [Server thread/WARN]:     at java.lang.Thread.run(Thread.java:745)
    
    And I get another error whenever I run the command for setting the prefix.
    Could this be because I already have a scoreboard in the sidebar?
     
  6. Offline

    teej107

    Oh. I thought it was the other way around xD
     
  7. Offline

    rbrick

    @Petersoj do you have the latest version?
     
  8. Offline

    Petersoj

    Ok got it working, but this isn't what I was looking for.
    Do you know of way to change the player name/color? That is what I need.
     
  9. Offline

    rbrick

    @Petersoj What exactly are you looking for?
     
  10. Offline

    Petersoj

    @rbrick A way to change the player Nametag (the one above the player entity) Or even the color. I tried using teams with the scoreboard API with bukkit, but it is not working. I also want a prefix and suffix.

    EDIT: also where I can change it with a player that has a name longer than 16 characters. (I have seen this done before so it IS possible)

    Bump, can anybody help me?

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

    boomboompower

    You can do
    Code:
    player.setDisplayName(ChatColor.RED + "" + player.getName());
    Basically what this does is puts the players name is red, you can change the color to any of the minecraft colors.
     
  12. Offline

    Petersoj

    @boomboompower That is only for mobs dude and Chat

    And the closest thing I got to edit a player name at all was this.
    Code:
    player.setPlayerListName(ChatColor.DARK_RED + p.getDisplayName());
    
    That only changes the player name in the tab list... Im looking for the player name over the player entity.

    So does anybody know how to make a method so that I could set the players prefix and name color?
    I'm not asking to be spoon fed, but I need some references or steps that would allow me to create this method. Again I know this is possible so how do I do it?
     
    Last edited by a moderator: Sep 11, 2015
  13. Offline

    boomboompower

    Make their name obfuscated.
     
  14. Offline

    Petersoj

    What? Do you even know what that does???
     
  15. Offline

    boomboompower

    Yes. Check k.
    [​IMG]
     
  16. Offline

    rbrick

    @Petersoj NameTagEdit changes the Nametag above there head...
     
  17. Offline

    Konato_K

    @Petersoj If you just want to add color to their names then you don't need to change their nametag.

    Using scoreboards is enough, add the player to a team, set the prefix of the team and add the rest of the players you want to see the color to the scoreboard, if they are in a different scoreboard then they won't see it.
     
  18. Offline

    Petersoj

    Solved it thanks though! :D
     
  19. Offline

    Signatured

    How did you accomplish this?
     
  20. Offline

    SyTeck

    :D
     
Thread Status:
Not open for further replies.

Share This Page