Changing Sign Text Color?

Discussion in 'Plugin Development' started by goldencreeper, Sep 21, 2012.

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

    goldencreeper

    Hello
    I am developing a huge plugin that has an economy, permission system, protection, etc
    What i need help with is trying to change the text color on sign?

    When a player types [Buy] onto a sign
    How would i change this: [Buy]
    Into this: [Buy]

    Thx
     
  2. Offline

    chasechocolate

    Does
    Code:
    ChatColor.RED + "[Buy]"
    work?
     
  3. Offline

    goldencreeper

    Nope that does not work i tried that

    anything else?
     
  4. Offline

    javoris767

    I think its like you get the line and if the line equals the text, you set it to ChatColor.Red + "[Buy]"
     
  5. Offline

    chasechocolate

  6. Offline

    Kodfod

    you have to get the sign, get the block state, get the line that's on, change the [Buy] to ChatColor.Red+"[Buy]", then update sign text...

    Haven't tested that, on me phone but will test if for ya if i get the chance if you don't before i do =P
     
    goldencreeper likes this.
  7. Offline

    chasechocolate

    Idk javoris767 's idea might work... I have never really experimented with sign colors.
     
  8. Offline

    goldencreeper

    Thank you so much. I didnt know there was a sign update method. so yea chatcolor.red does work

    ThxThxThxThx
     
  9. Offline

    Kodfod

  10. Offline

    goldencreeper

  11. Offline

    V10lator

    No need to get the sign - just work with the SignChangeEvent:
    Code:java
    1. @EventHandler
    2. public void signCreation(SignChangeEvent event)
    3. {
    4. if(event.getLine(0).equalsIgnoreCase("[Buy]")
    5. event.setLine(0, ChatColor.RED+"[Buy]");
    6. }
     
    Kodfod likes this.
  12. Offline

    Kodfod

Thread Status:
Not open for further replies.

Share This Page