Sign not updating

Discussion in 'Plugin Development' started by Jonathan Danek, Nov 14, 2013.

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

    Jonathan Danek

    I'm trying to store a sign so I can change the text on it later on. So I save the block it's in. But once I try and get its state and change a line it doesn't update the sign.
    This code is in the SignChangeEvent Method
    1. lobby.setSignBlock(event.getBlock());

    and it calls on this event:

    1. public void setSignBlock(Block b){
    2. signBlock = b;
    3. Sign s = (Sign) signBlock.getState();
    4. s.setLine(3, "Test");
    5. s.update();
    6. }

    When I place a sign to call the SignChangeEvent, It goes through just fine without errors but the sign never updates. Any input would be greatly appreciated
  2. Offline


    You are updating the sign block directly in the world, during the event, which changes the sign text after it is finished.. It therefore overwrites your text after the event is done.

    Use the setLine(s) methods of SignChangeEvent instead, to set the text it shall update the sign after the event is done.
  3. Offline

    Jonathan Danek

    That would work but I still need to alter the sign's text later on after another method is triggered and the event isn't there anymore.

    The second code snippets above are in a different classes.
Thread Status:
Not open for further replies.

Share This Page