@Override public void deleteLightSource(Location fromPlayerLocation, Player player) { CraftWorld cWorld = (CraftWorld) fromPlayerLocation.getWorld(); int xPrevious = fromPlayerLocation.getBlockX(); int yPrevious = fromPlayerLocation.getBlockY() + 2; int zPrevious = fromPlayerLocation.getBlockZ(); Location previousSource = new Location(cWorld, xPrevious, yPrevious, zPrevious); Material blockMaterial = previousSource.getBlock().getType(); byte blockData = previousSource.getBlock().getData(); previousSource.getBlock().setType(blockMaterial); previousSource.getBlock().setData(blockData); Chunks.sendClientChanges(); }
@Override public void createLightSource(Location toPlayerLocation, Player player, int level) { CraftWorld cWorld = (CraftWorld) toPlayerLocation.getWorld(); int xNew = toPlayerLocation.getBlockX(); int yNew = toPlayerLocation.getBlockY() + 2; int zNew = toPlayerLocation.getBlockZ(); int lightLevel = level; cWorld.getHandle().b(EnumSkyBlock.BLOCK, xNew, yNew, zNew, lightLevel); Location newSource = new Location(cWorld, xNew, yNew - 1, zNew); Material blockMaterial = newSource.getBlock().getType(); byte blockData = newSource.getBlock().getData(); newSource.getBlock().setType(blockMaterial); newSource.getBlock().setData(blockData); Chunks.sendClientChanges(); }