Recolor the name above players head

Discussion in 'Plugin Development' started by orange451, Aug 2, 2012.

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

    orange451

    Code:
        public void perform() {
            String name = ChatColor.RED + player.getName() + ChatColor.WHITE;
            CraftPlayer pl = (CraftPlayer)sender;
            pl.setDisplayName(name);
            setPlayerName(pl.getHandle(), pl.getName(), name);
        }
     
        public void setPlayerName(EntityPlayer pl, String oldname, String newname) {
            WorldServer world = (WorldServer)pl.world;
            EntityTracker tracker = world.tracker;
            tracker.untrackPlayer(pl);
            pl.name = newname;
            tracker.track(pl);
        }
    What this did (in CraftBukkit for 1.2.5) is it recolored the name above my head to red (it worked really well, except it would remove my skin, for I actually became "&corange451")

    However, since the 1.3.1 update this no longer works. I am not saying the craftbukkit broke it, no, because this method always seemed very dodgy to me in the first place :)

    My question is this, what is a better way to take the name above my head, and add "ChatColor.red" to the front of it?
     
  2. Offline

    chaseoes

    TagAPI
     
Thread Status:
Not open for further replies.

Share This Page