Detecting light level of blocks on block break

Discussion in 'Plugin Development' started by darkhelmet, Jun 17, 2012.

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

    darkhelmet

    We use a custom ore alerting plugin after being unsatisfied with existing ones but I can't seem to get the light level to ever work.

    Foundboxx uses the player interact event to get the
    Code:
    Block rela = block.getRelative(event.getBlockFace());
    but we prefer the blockBreak event, which doesn't seem to have a way to get the same data.

    When I used
    Code:
    event.getBlock().getLightLevel();
    for the block break event it always returns 0.

    Is there any way to get the same face data, or the correct light level data, from the block after it's been broken? I'd really rather not use the player interact event.
     
  2. you can do this:
    Code:
    on block break
      saves the current block data and other stats (block = block.getBlockState())
      set the block to air
      gets the light data
      restores the block (block.update())
    return the value top your code
     
  3. Offline

    darkhelmet

    Works perfectly, thanks!
     
Thread Status:
Not open for further replies.

Share This Page