Is there a way to run custom GCode at a layer or Z

What would be the easiest way to to tell Octoprint to run a custom GCode when the printer reaches a specific layer or Z height? I would like to do it in octoprint rather than the slicer. I searched but couldn't find any plugins that do this.

It looks like, although the name suggests it is just for colours, the 'Multi Colors' plugin would be able to run custom gcode at the layer, matched by a regex for the layer indicator.

I have no idea if it works.