Bitbucket server plugin to block merges if branch build is in progress

I need a plugin to block merges if the master branch build is in progress. If there is a plugin that already does this, could you point me in that direction? This is my first attempt at bitbucket development and so far I’ve gotten it to block merges if it’s the master branch with an appropriate message, I just need to add a condition to check if the build status is in progress. Any suggestions? Thanks