Convert Player to String

Discussion in 'Resources' started by picklednerd, Aug 17, 2011.

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


    Hey im brand new to java and bukkit. Im trying to convert a Player type variable to a String. I'm trying to put a player's username on a sign when they place it
  2. Offline


    getName() or getDisplayName() is what you're looking for.
  3. Offline


  4. Offline


    just curious, is there a difference? I've always just used getName().
  5. Offline


    getName() is always going to return a static name for the player. Display name will end up retrieving information from things such as nick-name plugins, so it can vary.
  6. Offline


        public void onSignChange(SignChangeEvent event) {
            Player p = event.getPlayer();
                event.setLine(0, "&4"+p.getName());
    Thats what you're looking for.
    On setLine, change 0 to 1,2,3 for the 2nd 3rd and 4th line, and change &4 to another number to change colour. 4 is Red, just remove the number and & to remove colour changes.
Thread Status:
Not open for further replies.

Share This Page