Updating sign text in 1.0.0 (CB1493)

Discussion in 'Plugin Development' started by desht, Nov 23, 2011.

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

    desht

    Looks like sign text updating in 1.0.0 builds might not be working, but I'd appreciate if anyone else could do some tests before I start following up...

    I've tried two plugins so far (my own ScrollingMenuSign, and also CelticMinstrel's SimpleSignEdit) which change the text of existing signs using the BlockState & Sign API, e.g. code like this:

    PHP:
    Sign sign = (Signblock.getState();
    String[] lines buildSignText();
    for (
    int i 0lines.lengthi++) {
        
    sign.setLine(ilines[i]);
    }
    sign.update();
    Worked fine in 1337, but in 1493 (MC 1.0.0) the sign text doesn't update until I log out and in again, or force a chunk unload/reload by going far away and coming back.
     
  2. Offline

    chipxsd

    Yes, I have a feeling it doesn't work. I've tried the SignCodePad plugin, and I'm experiencing the same problem.

    I'm not a plugin developer, but could you look if there's any update() method with a boolean argument. I read somewhere sign.update(true); works.

    --edit
    Apparently there Is an overridden method:

    @Override
    public boolean update(boolean force) {
    boolean result = super.update(force);

    if (result) {
    sign.update();
    }

    return result;
    }
     
  3. Offline

    desht

    Thanks for the confirmation. I don't think the force parameter is relevant here - it's for forcing a BlockState back into a Block even if the block has changed in the meantime. Not the case here.
     
  4. Offline

    chipxsd

    SignCodePad author (davboecki) plugin suspects the CraftBukkit server for Minecraft v1.0.0 has issues.
     
  5. Offline

    desht

    Yep, verified and fixed in CB 1494.
     
  6. Offline

    WizzleDonker

    I can confirm that this works:

    Code:
    Sign sign = (Sign) block.getState();
    sign.setLine(1, "Test");
    sign.update(true);
    But this doesn't:

    Code:
    Sign sign = (Sign) block.getState();
    
    sign.setLine(1, "Test");
    
    sign.update();
     
  7. Offline

    desht

    Hmm, I haven't seen that problem in my plugins - I don't need to pass true to update(). That should only be necessary if the underlying Block has changed its type ID since you created the BlockState (which it obviously hasn't).
     
Thread Status:
Not open for further replies.

Share This Page