Checking if a block is a sign and getting its lines

Discussion in 'Plugin Development' started by RightLegRed, Jan 20, 2011.

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

    Archelaus

    How would I check if a block is a sign and then get it's lines?

    I tried getType() == Material.SIGN but it doesn't solve how to get the signs lines.


    Thanks.
     
  2. Offline

    Fifteen

  3. Offline

    Archelaus

  4. Offline

    Fifteen

    There used to be an onSignPlacedEvent() or something like that, which I think was the only event you could use to get the lines.
     
  5. Offline

    blaatz0r

    I'm new to bukkit, but you might try casting the block to a Sign?

    Code:
    Block block = event.getBlockClicked(); // or whatever event method
    
    if (block.getType() == Material.SIGN) {
        Sign s = (Sign) block;
        String[] lines = s.getLines();
    }
    
    No clue if it works like that.
     
  6. Offline

    Fifteen

    Oh yeah, that should work.
    Code:
    Block block = event.getBlock();
    though.
     
  7. Offline

    Affecting_Nelas

    if (block.getType() == Material.SIGN) {
    Sign s = (Sign) block.getState()
    String[] lines = s.getLines();
    }
     
  8. Offline

    Archelaus

    Thanks guys :)
     
Thread Status:
Not open for further replies.

Share This Page