Checking if player has building perms?

Hi, i need a help from you... 

I would like to ask how to detect somehow in plugin that you have building privilage?
I want to use it for turning off lights in building. Any help appreciated. Thanks

If you have a BasePlayer reference you can just do

if(player.CanBuild()) {
    // do stuff
}​