Color Nameplates

Discussion in 'Plugin Development' started by mcgamer99, May 11, 2012.

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

    mcgamer99

    In a server the player's nameplates are different to white, they are red or blue and that server didn't have spout.
    Someone know how I do it?
     
  2. Offline

    Blairjam

    It sounds like they were using a custom version of Craftbukkit, one that they or someone else modded.
     
  3. This is doable (I have a example plugin flying around. If you want it + the source just ask nicely) but it will change the players skin, too, as the clients pick the skin according to the name from mojangs skin server.
     
  4. Offline

    xGhOsTkiLLeRx

    mcgamer99

    Code:java
    1. public void changePlayerName (final Player player, final String newName) {
    2. final String oldPlayerName = player.getName();
    3. getServer().getScheduler().scheduleAsyncDelayedTask(this, new Runnable() {
    4. public void run() {
    5. EntityPlayer ePlayer = ((CraftPlayer) player).getHandle();
    6. ePlayer.name = newName;
    7. try {
    8. for (Player p : getServer().getOnlinePlayers()){
    9. if (p != player){
    10. ((CraftPlayer) p).getHandle().netServerHandler.sendPacket(new Packet29DestroyEntity(player.getEntityId()));
    11. ((CraftPlayer) p).getHandle().netServerHandler.sendPacket(new Packet20NamedEntitySpawn(ePlayer));
    12. }
    13. }
    14. } catch (Exception ignored) {};
    15. ePlayer.name = oldPlayerName;
    16. }
    17. });

    There you go! But you will loose the current skin!
     
    fromgate likes this.
Thread Status:
Not open for further replies.

Share This Page