get signs that "pop off" when the attached block breaks?

Discussion in 'Plugin Development' started by janka102, Aug 21, 2012.

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

    janka102

    So i want to be able to do something with the location of where signs break. It's easy enough to do when a player breaks the sign, but how would i get the location if it's broken when the block behind/under it breaks and the sign pops off?
    I tried to use the BlockPhysicsEvent and check if
    Code:
    event.getBlock().getState() instanceof Sign
    but then found out that if a block is placed next to a sign, it triggers then too :(
    i'v tried to search for how to do this, but couldn't seem to find it. Is this even possible?
    Any help will be appreciated
     
  2. Offline

    kyle1320

    You could check all around the broken block for a sign on each BlockBreakEvent, then check if the sign was attached to that block
     
  3. Offline

    janka102

    That would work, thank you! But would it be costly to the server to do that check every time a block is broken? like on a big server
     
  4. Offline

    kyle1320

    Probably, there may be a better way for it..
     
  5. Offline

    stelar7

    You could check the relative blocks (NORTH, SOUTH, EAST, WEST)
    if the block material is a WALL_SIGN, it will pop off
     
  6. Offline

    skore87

    Don't forget that signs can also be placed on TOP of the block.

    You may want to hook into these events though possible that not all are needed: BlockPhysicsEvent, BlockPistonRetractEvent , BlockPistonExtendEvent, EntityExplodeEvent, and BlockBreakEvent.
     
  7. Offline

    janka102

    Maybe if I explain what i'm going to do with the locations, there might be a better way to do what i'm trying.

    For my plugin, Bullseye, I want to be able to have the Bullseye sings to be placed on any block, and when hit with an arrow, turn into a redstone torch. This works with most but not all, like Glass. So to do this, currently, I record the location of the new signs to a file and on a BlockPhysicsEvent I check if the location of the event is in the file. If it is, cancel it so the redstone torch doesn't pop off. And when the signs are broken, take them off the list. That last part is why I need the locations of the broken signs.
    But i'm up to suggestions if there is a better way than what i'm doing now.
     
Thread Status:
Not open for further replies.

Share This Page