Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void onBlockPlaceEvent(PlayerInteractEvent event) {
- if (event.getAction() != Action.RIGHT_CLICK_BLOCK) {
- return;
- } else if (event.getItem().getType() != Material.GOLD_ORE) {
- event.getClickedBlock().setType(Material.SIGN_POST);
- return;
- }
- Block block = event.getClickedBlock();
- Player player = event.getPlayer();
- Location loc = block.getLocation();
- World world = loc.getWorld();
- int x = loc.getBlockX() - 1;
- int z = loc.getBlockZ();
- int y = loc.getBlockY();
- int x2 = x + 2;
- int y2 = y + 4;
- int z2 = z + 3;
- for (int xPoint = x; xPoint <= x2; xPoint++) {
- for (int yPoint = y; yPoint <= y2; yPoint++) {
- for (int zPoint = z; zPoint <= z2; zPoint++) {
- Block curBlock = world.getBlockAt(xPoint, yPoint, zPoint);
- if (yPoint == y && xPoint == x + 1
- && (zPoint == z + 1 || zPoint == z + 2)) {
- curBlock.setType(Material.GOLD_ORE);
- } else if (yPoint == y + 1 && xPoint == x + 1
- && zPoint == z) {
- curBlock.setType(Material.GOLD_ORE);
- } else if (yPoint == y + 1 && xPoint == x + 1
- && zPoint == z + 1) {
- curBlock.setType(Material.AIR);
- } else if (yPoint == y + 1 && xPoint != x + 1 && zPoint > z) {
- curBlock.setType(Material.WOOD);
- } else if (yPoint == y + 1 && xPoint == x + 1
- && zPoint == z + 3) {
- curBlock.setType(Material.WOOD);
- } else if ((yPoint > y && yPoint < y + 4)
- && xPoint == x + 1 && zPoint != z + 3) {
- curBlock.setType(Material.AIR);
- } else if (yPoint < y + 4 && zPoint > z) {
- curBlock.setType(Material.WOOD);
- } else if (yPoint == y + 2 && xPoint != x + 1
- && zPoint == z) {
- curBlock.setType(Material.LOG);
- } else if (yPoint == y + 3 && xPoint != x + 1
- && zPoint == z) {
- curBlock.setType(Material.FENCE);
- } else if (yPoint == y + 4 && xPoint != x + 1
- && zPoint == z) {
- curBlock.setType(Material.AIR);
- } else if (yPoint == y + 4 && xPoint == x + 1
- && zPoint == z) {
- curBlock.setType(Material.WOOD_STEP);
- } else if (yPoint == y + 4 && xPoint != x + 1) {
- curBlock.setType(Material.WOOD_STAIRS);
- } else if (yPoint == y + 4 && xPoint == x + 1
- && zPoint == z2) {
- curBlock.setType(Material.WOOD_STAIRS);
- } else if (yPoint == y2 && xPoint == x + 1) {
- curBlock.setType(Material.WOOD_STEP);
- }
- else {
- curBlock.setType(Material.DIRT);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement