(Solved) Sign Break

Discussion in 'Plugin Development' started by cococow123, Nov 28, 2015.

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

    cococow123

    Hi!!

    How could I protect the block that supports a sign so I can't break the supporter block? Only of the Sign has '[mVote]' as the 1st line (0 in Java)?

    Thanks in advance,
    Coco Cow
     
  2. Offline

    mythbusterma

    @cococow123

    Pretty sure the lines of a sign in Bukkit are one-indexed, but I could be wrong.

    Create an event listener for the BlockBreakEvent, then check if the block above is a sign, then check if the sign has the contents you're looking for.
     
  3. Offline

    cococow123

    @mythbusterma Thanks again for replying quickly! I mean if the block that is used to hold up the sign is broken, cancel block break event. How would I get the supported block?
     
  4. Offline

    Xerox262

    And the sides, could be a wall sign.

    Block break event, the block broken would/could(check first) be the supporting block.
     
    mythbusterma likes this.
  5. Offline

    mythbusterma

    @cococow123

    If the supporting block is being broken, it is the subject of the BlockBreakEvent.

    @cococow123

    You can use Block#getBlockRelative(BlockFace) to figure out what nearby Blocks are. For example, BlockFace.UP to get the one above it, then check it's type.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Aug 27, 2018
  6. Offline

    cococow123

    Last edited by a moderator: Nov 28, 2015
  7. Offline

    Scimiguy

    @cococow123
    Get the blocks around it and check if it's a sign.
    It's probably more efficient to just store the blocks you want to protect somewhere in your plugin though
     
  8. Offline

    cococow123

    @Scimiguy

    1) how would I know it's the supporting block and not just a block next to the sign?

    2) I could probably make it so the sign can only be on like a barrier block

    Thanks @mythbusterma. I almost missed ur post

    <please use the edit button instead of making multiple consecutive posts. ~Eya>
     
  9. Offline

    Scimiguy

    @cococow123
    Just store the block in a collection somewhere and check if that block is in your collection

    Don't double post, use the edit button
     
Thread Status:
Not open for further replies.

Share This Page