Solved Sign won't update text

Discussion in 'Plugin Development' started by DirtyStarfish, Feb 4, 2013.

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

    DirtyStarfish

    Hey,

    I'm trying to change the text of a sign, but it doesn't seem to be working.

    Here is the code I am using. The Sign class I have imported is org.bukkit.block.Sign;

    Code:
    BlockState state = event.getBlock().getState();
    if (state instanceof Sign)
    {
        Sign sign = (Sign) state;
        sign.setLine(0, "Test text");
        sign.update();
    }
    
    I have also tried Sign.update(true), which I think is supposed to force the sign to update; but that did not work either.
    This code is currently in an onSignChangeEvent method. If I set the lines using SignChangeEvent.setLine() it works. But I also need to be able to change the text outside of events.

    Am I missing something? Why isn't the text changing?

    Thanks.
     
  2. Offline

    kaZep

    Well, which is the event?
     
  3. the sign chance event is updating the sign after you update it using sign.update
     
    DirtyStarfish likes this.
  4. Offline

    DirtyStarfish

    Oh, well that makes sense. Thank you!
     
Thread Status:
Not open for further replies.

Share This Page