@Override public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block, boolean notifyAndLight) throws WorldEditException { BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); if (adapter != null) { try { return adapter.setBlock(BukkitAdapter.adapt(getWorld(), position), block, notifyAndLight); } catch (Exception e) { if (block instanceof BaseBlock && ((BaseBlock) block).getNbtData() != null) { logger.warning("Tried to set a corrupt tile entity at " + position.toString()); logger.warning(((BaseBlock) block).getNbtData().toString()); } e.printStackTrace(); Block bukkitBlock = getWorld().getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ()); bukkitBlock.setBlockData(BukkitAdapter.adapt(block), notifyAndLight); return true; } } else { Block bukkitBlock = getWorld().getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ()); bukkitBlock.setBlockData(BukkitAdapter.adapt(block), notifyAndLight); return true; } }
@Override public void run() { b1.setBlockData(air); b2.setBlockData(air); b3.setBlockData(air); b4.setBlockData(air); } }
/** * Repairs the block by setting the type and data */ public void repair() { world.getBlockAt(x,y,z).setBlockData(data); }
@Override public void setTypeAndData(int type, byte data, boolean physics) { b.setBlockData(BukkitMCLegacyMaterial.getBlockData(type, data), physics); }
private void setAir(int jx, int jy, int jz, World jw, int plusy) { for (int yy = jy; yy < (jy + plusy); yy++) { for (int xx = jx; xx < (jx + 16); xx++) { for (int zz = jz; zz < (jz + 16); zz++) { Block b = jw.getBlockAt(xx, yy, zz); b.setBlockData(TARDISConstants.AIR); } } } }
private void setAir(int jx, int jy, int jz, World jw, int plusy) { for (int yy = jy; yy < (jy + plusy); yy++) { for (int xx = jx; xx < (jx + 16); xx++) { for (int zz = jz; zz < (jz + 16); zz++) { Block b = jw.getBlockAt(xx, yy, zz); b.setBlockData(TARDISConstants.AIR); } } } }
@Override public void setBlockData(MCBlockData data, boolean physics) { b.setBlockData((BlockData) data.getHandle(), physics); }
private void extend(Block b, Block l) { l.setBlockData(Material.PISTON_HEAD.createBlockData()); Piston piston = (Piston) b.getBlockData(); piston.setExtended(true); b.setBlockData(piston, true); }
private void setBlock(Island island, Block block, ConfigurationSection config, String blockData) { // Set the block data block.setBlockData(Bukkit.createBlockData(blockData)); // Set the block state for chests, signs and mob spawners setBlockState(island, block, config); }
public void placeSigns() { List<Block> blocks = getSignBlocks(false); for (Block block : blocks) { block.setType(Material.WALL_SIGN); Directional d = (Directional) block.getBlockData(); d.setFacing(facing); block.setBlockData(d); } }
@Override public final void setBlock(int x, int y, int z, Material material, Type type) { Block block = getActualBlock(x, y, z); block.setType(material, false); BlockData data = block.getBlockData(); try { if (data instanceof Slab) ((Slab) data).setType(type); } finally { block.setBlockData(data, getDoPhysics(x, z)); } }
public static void toggleBeacon(String str, boolean on) { String[] beaconData = str.split(":"); World w = Bukkit.getServer().getWorld(beaconData[0]); int bx = TARDISNumberParsers.parseInt(beaconData[1]); int by = TARDISNumberParsers.parseInt(beaconData[2]); int bz = TARDISNumberParsers.parseInt(beaconData[3]); Location bl = new Location(w, bx, by, bz); Block b = bl.getBlock(); b.setBlockData((on) ? TARDISConstants.GLASS : TARDISConstants.POWER); }
public final Block setBlock(int x, int y, int z, Material material, Half half) { Block block = getActualBlock(x, y, z); block.setType(material, false); BlockData data = block.getBlockData(); try { if (data instanceof Bisected) ((Bisected) data).setHalf(half); } finally { block.setBlockData(data, getDoPhysics(x, z)); } return block; }
private void toggleBeacon(String str) { String[] beaconData = str.split(":"); World w = plugin.getServer().getWorld(beaconData[0]); int bx = TARDISNumberParsers.parseInt(beaconData[1]); int by = TARDISNumberParsers.parseInt(beaconData[2]); int bz = TARDISNumberParsers.parseInt(beaconData[3]); Location bl = new Location(w, bx, by, bz); Block b = bl.getBlock(); b.setBlockData(TARDISConstants.GLASS); } }
public void destroyLampTrapdoors(Location l, COMPASS d) { Block lamp = l.getBlock().getRelative(BlockFace.UP, 3).getRelative(getOppositeFace(d)); plugin.getGeneralKeeper().getFaces().forEach((f) -> lamp.getRelative(f).setBlockData(TARDISConstants.AIR)); }
@Override public void run() { final Block block = component.getBlock(); if (block.getBlockData() instanceof Switch) { final Switch button = (Switch) block.getBlockData(); button.setPowered(false); block.setBlockData(button); MathUtil.forceUpdate(block.getRelative(button.getFacing().getOppositeFace())); } ActivatedButtonMap.remove(block.getLocation()); } }
private void buildStructure(Chunk chunk, int x, int y, int z) { plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> { chunks.add(chunk); // remove STRUCTURE_BLOCK so we don't get this chunk again Block structure = chunk.getBlock(x, y, z); structure.setBlockData(Material.RED_SAND.createBlockData()); // create structure new TARDISBuildGallifreyanStructure(plugin).buildCity(chunk.getX() * 16 + x, y, chunk.getZ() * 16 + z); }, 1L); } }
public final Block setBlock(int x, int y, int z, Material material, Shape shape, boolean powered) { Block block = getActualBlock(x, y, z); block.setType(material, false); BlockData data = block.getBlockData(); try { if (data instanceof Rail) ((Rail) data).setShape(shape); if (data instanceof Powerable) ((Powerable) data).setPowered(powered); } finally { block.setBlockData(data, getDoPhysics(x, z)); } return block; }
public void repair() { if (getWorld().getBlockAt(getX(), getY(), getZ()).getState().getData() instanceof Bed) return; super.repair(); other.getBlock().setBlockData(other.getBlockData()); } }
public void repair() { if (getWorld().getBlockAt(getX(), getY(), getZ()).getState().getData() instanceof Door) return; Block b = getWorld().getBlockAt(x,y,z); if (b.getType() == Material.AIR) b.setType(Material.STONE); super.repair(); other.getBlock().setBlockData(other.getBlockData()); } }