private void removePressurePlates(Beacon beacon) { for (int x = -2; x <= 2; x++) { Block block = beacon.getWorld().getBlockAt(beacon.getLocation().add(x, -1.0D, 3.0D)); if (block.getType() == Material.WOOD_PLATE) { block.setType(Material.AIR); } block = beacon.getWorld().getBlockAt(beacon.getLocation().add(x, -1.0D, -3.0D)); if (block.getType() == Material.WOOD_PLATE) { block.setType(Material.AIR); } } for (int z = -2; z <= 2; z++) { Block block = beacon.getWorld().getBlockAt(beacon.getLocation().add(3.0D, -1.0D, z)); if (block.getType() == Material.WOOD_PLATE) { block.setType(Material.AIR); } block = beacon.getWorld().getBlockAt(beacon.getLocation().add(-3.0D, -1.0D, z)); if (block.getType() == Material.WOOD_PLATE) { block.setType(Material.AIR); } } }
private void runPhaseOne(final Beacon beacon, final int repeat) { if (repeat > this.config.getRepeat()) { this.plugin .getServer() .getScheduler() .runTaskLaterAsynchronously( this.plugin, new Runnable() { public void run() { BeaconDrops.this .plugin .getServer() .broadcastMessage(BeaconDrops.this.config.getMessage("charged")); BeaconDrops.this.canRun = true; } }, this.config.getWaitTime() * 20L * 60L); return; } final Block belowBlock = beacon.getWorld().getBlockAt(beacon.getLocation().add(0.0D, -1.0D, 0.0D)); final Random rnd = new Random(); final int blockSwitchTask = this.plugin .getServer() .getScheduler() .scheduleSyncRepeatingTask( this.plugin, new Runnable() { @SuppressWarnings("deprecation") public void run() { switch (belowBlock.getType()) { case COOKED_CHICKEN: belowBlock.setType(Material.GOLD_BLOCK); break; default: belowBlock.setType(Material.DIAMOND_BLOCK); } beacon .getWorld() .dropItemNaturally( beacon.getLocation().add(0.0D, 1.0D, 0.0D), new ItemStack( BeaconDrops.this.config.getItemId(), rnd.nextInt(64) + 1)); } }, 10L, 10L); this.plugin .getServer() .getScheduler() .scheduleSyncDelayedTask( this.plugin, new Runnable() { public void run() { BeaconDrops.this.plugin.getServer().getScheduler().cancelTask(blockSwitchTask); belowBlock.setType(Material.DIAMOND_BLOCK); BeaconDrops.this .plugin .getServer() .getScheduler() .scheduleSyncDelayedTask( BeaconDrops.this.plugin, new Runnable() { public void run() { runPhaseTwo(beacon, repeat); } }, 60L); } }, this.config.getPhaseOne() * 20L); }