@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void BlockBreakEvent(BlockBreakEvent e) { if (e.getBlock().hasMetadata("ce.Ice")) e.setCancelled(true); CEventHandler.handleEvent(e.getPlayer(), e, blockBroken); if (e.getBlock().hasMetadata("ce.mine")) { Block b = e.getBlock(); b.removeMetadata("ce.mine", Main.plugin); Block[] blocks = { b.getRelative(0, 1, 0), b.getRelative(1, 0, 0), b.getRelative(-1, 0, 0), b.getRelative(0, 0, 1), b.getRelative(0, 0, -1) }; for (Block block : blocks) { if (block.hasMetadata("ce.mine.secondary")) { String[] s = block.getMetadata("ce.mine.secondary").get(0).asString().split(" "); Location loc = new Location( e.getPlayer().getWorld(), Integer.parseInt(s[0]), Integer.parseInt(s[1]), Integer.parseInt(s[2])); Location blockLoc = b.getLocation(); if (loc.getBlockX() == blockLoc.getBlockX() && loc.getBlockY() == blockLoc.getBlockY() && loc.getBlockZ() == blockLoc.getBlockZ()) block.removeMetadata("ce.mine.secondary", Main.plugin); } } } }
@EventHandler public void onInteract(PlayerInteractEvent event) { if (event.isCancelled()) return; Block b = event.getClickedBlock(); if (event.getAction() == Action.PHYSICAL && b != null && b.hasMetadata("Placer") && b.getType() == Material.STONE_PLATE && b.getRelative(BlockFace.DOWN).getType() == Material.GRAVEL) { b.removeMetadata("Placer", HungergamesApi.getHungergames()); b.setType(Material.AIR); b.getWorld().createExplosion(b.getLocation().clone().add(0.5, 0.5, 0.5), 4F); } }