Skip to content

Instantly share code, notes, and snippets.

@ScruffyRules
Last active August 29, 2015 14:03
Show Gist options
  • Save ScruffyRules/97fc5c40ed4dc1a76966 to your computer and use it in GitHub Desktop.
Save ScruffyRules/97fc5c40ed4dc1a76966 to your computer and use it in GitHub Desktop.
CACTUS!!!
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
Block block = event.getBlock();
byte data = block.getData();
Block blocks = block.getRelative(0, 1, 0);
while (block.getType().equals(blocks.getType()) && data == blocks.getData()) {
if (event.getPlayer().getGameMode().equals(GameMode.CREATIVE)) {
blocks.setType(Material.AIR);
} else {
blocks.breakNaturally();
}
blocks = blocks.getRelative(0, 1, 0);
data = blocks.getData();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment