Solved Signs refusing to update

Discussion in 'Plugin Development' started by Jobi, Jul 3, 2014.

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

    Jobi

    As the title says I'm currently having issues with Signs which refuse to update
    Here is my code:
    Code:java
    1.  
    2. public void setCustomText(String... lines) {
    3. clearSign();
    4. for(int i = 0; i < lines.length && i < 4; i++) {
    5. sign.setLine(i, lines[I]);[/I]
    6. }
    7. sign.update(); //Tried this
    8. sign.getBlock().getState().update(); //This
    9. sign.update(true); //And this
    10. }
    11.  
    12. private void clearSign() {
    13. sign.setLine(0, "");
    14. sign.setLine(1, "");
    15. sign.setLine(2, "");
    16. sign.setLine(3, "");
    17. }
     
  2. Offline

    fireblast709

    Jobi have you debugged your code? As in: does the method get called in the first place.
     
  3. Offline

    desht

    Are you calling that code from a SignChangeEvent handler?
     
  4. Offline

    Jobi

    The code definitely gets called and it's not called from a SignChangeEvent handler.
     
  5. Offline

    XLordalX

    Your sign can't be updated within the same tick. Use a timer.
     
  6. Offline

    Jobi

    Ok, I solved the problem now, but my solution is different (no, the solution of XLoardalX did not work.). Instead of saving the sign in my object I'm now saving the sign location and do signLocation.getBlock().getState().update() every time I need to update the sign.
     
Thread Status:
Not open for further replies.

Share This Page