@SuppressWarnings("deprecation") public void play() { playEffect(position, 2001, blockType.getLegacyId()); }
@Override public int getBlockTypeAbs(double x, double y, double z) { return editSession.getBlock(toWorld(x, y, z)).getBlockType().getLegacyId(); }
@Override public int getBlockTypeRel(double x, double y, double z) { return editSession.getBlock(toWorld(x, y, z)).getBlockType().getLegacyId(); }
@Override public int getBlockType(double x, double y, double z) { return editSession.getBlock(toWorld(x, y, z)).getBlockType().getLegacyId(); }
@Override protected BaseBlock getMaterial(int x, int y, int z, BaseBlock defaultMaterial) { final Vector3 current = Vector3.at(x, y, z); environment.setCurrentBlock(current); final Vector3 scaled = current.subtract(zero).divide(unit); try { if (expression.evaluate(scaled.getX(), scaled.getY(), scaled.getZ(), defaultMaterial.getBlockType().getLegacyId(), 0) <= 0) { // TODO data return null; } return LegacyMapper.getInstance().getBlockFromLegacy((int) typeVariable.getValue(), (int) dataVariable.getValue()).toBaseBlock(); } catch (Exception e) { log.log(Level.WARNING, "Failed to create shape", e); return null; } } };
@Override public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) { World world = (World) clicked.getExtent(); BlockVector3 blockPoint = clicked.toVector().toBlockPoint(); final BlockType blockType = world.getBlock(blockPoint).getBlockType(); if (blockType == BlockTypes.BEDROCK && !player.canDestroyBedrock()) { return true; } try (EditSession editSession = session.createEditSession(player)) { editSession.getSurvivalExtent().setToolUse(config.superPickaxeDrop); editSession.setBlock(blockPoint, BlockTypes.AIR.getDefaultState()); } catch (MaxChangedBlocksException e) { player.printError("Max blocks change limit reached."); } world.playEffect(clicked.toVector(), 2001, blockType.getLegacyId()); return true; }
@Override public boolean setBlock(BlockVector3 pos, BlockStateHolder block) throws WorldEditException { if (block.getBlockType().getLegacyId() == 0) { World world = Bukkit.getWorld(event.getWorld().getName()); if (world != null) { Location l = new Location(world, pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()); if (BlockStorage.hasBlockInfo(l)) BlockStorage.clearBlockInfo(l); } } return getExtent().setBlock(pos, block); }