Getting block sign is on.

Discussion in 'Plugin Development' started by Dallas, Mar 15, 2011.

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


    Hey guys im new to plugin development,
    How do i get the block a sign is on when you right click the sign?
    Much appreciated.
  2. Offline

    Edward Hand


    returns the block below the block 'someBlock'
  3. Offline


    That will only work if the sign is of type Material.SIGN_POST, if it's Material.WALL_SIGN however then something along these lines should work:
    Block parent = null;
    if (block.getType() == Material.WALL_SIGN) {
    	if (block.getData() == 0x2) {
    		parent = block.getFace(BlockFace.WEST);
    	} else if (block.getData() == 0x3) {
    		parent = block.getFace(BlockFace.EAST);
    	} else if (block.getData() == 0x4) {
    		parent = block.getFace(BlockFace.SOUTH);
    	} else if (block.getData() == 0x5) {
    		parent = block.getFace(BlockFace.NORTH);
    } else if (block.getType() == Material.SIGN_POST) {
    	parent = block.getFace(BlockFace.DOWN);
    If parent is still null afterwards then it's not a sign that you're checking. This is of course off the top of my head and isn't tested, so may require some adjustments.
  4. Offline


    Had to make a new account. The other one screwed up. :S
    Anyway just wanted to state my thanks. :)
    It was a wall sign i needed.
Thread Status:
Not open for further replies.

Share This Page