Help with breaking blocks in an area

Discussion in 'Spigot Plugin Development' started by Alpoids, May 21, 2016.

  1. How do I stop this from breaking bedrock, or is there another approach I should be taking, if so could you help me out with that? :)

    Code (Text):
    for( int xOff = -1 ; xOff <= 1 ; ++xOff ) {
                            for( int yOff = -1 ; yOff <= 1 ; ++yOff ) {  // NOTE this goes from -2 to 0, not -1 to +1
                                for( int zOff = -1 ; zOff <= 1 ; ++zOff ) {
                                    if(block.getType() == Material.BEDROCK)
                                    {
                                        player.sendMessage("no");
                                    } else {
                                        currentBlock = block.getRelative( xOff, yOff, zOff );
                                        currentBlock.breakNaturally( player.getItemInHand() );
                                    }

                                }
                            }
                        }
     
  2. What exactly are you trying to do? what you are trying to ask is either very vague or does not make sense? could you explain it in a better context?

    Thx Pixl
     
  3. I'm working on a plugin that breaks an area of block (3x3x2). Which it does that perfectly. although i dont want bedrock in to be included in tha,or any region that is protected by worldguard/factions.