Solved Detect Which Blocks will be Broken by a BlockBreakEvent

Discussion in 'Plugin Development' started by icomputertinker, Feb 16, 2014.

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

    icomputertinker

    I'm trying to detect if someone is indirectly breaking a sign (either a SignPost or a WallSign) by breaking a block that supports it. Normally I'd just loop through all adjacent blocks and check if there's a sign nearby that depends on the existence of that block, and cancel the event if the sign is in a specific HashMap. I was wondering though if there's an easier way, because all that looping is tedious and I'd be more likely to write a bug there. Is there any method that I'm missing?

    Thanks.
     
  2. Offline

    JoTyler

    If you are adding signs that you don't want being broken and don't want them being broken indirectly then just add the block that you don't want broken to a hashmap . This way the supporting block can never be broken . Easier than looping
     
    icomputertinker likes this.
  3. Offline

    icomputertinker

    JoTyler

    Jesus rollerblading Christ. You just blew my mind.

    (In all seriousness, thanks. This'll work.)
     
  4. Offline

    JoTyler



    No problem :) Glad i could help.
     
Thread Status:
Not open for further replies.

Share This Page