Why can't I build above 15 blocks high in minecraft?

I'm building my first ever 'good' castle in minecraft on a flat world but as I was building a part of the building up, it wouldn't let me place any more blocks. I've had this happen before but nothing like this. Is there a setting that is making this happen?

In superflat mode there's a ceiling cap, if you want to create a castle, do it on a creative world or use world edit to clear space.