Refactored masks, patterns and WorldEdit.getBlock.

Just a PR for reference.

@sk89q take a look at this and tell me if that's roughly what you meant.