Changed the logic after realizing I could just use a water block at the top of the shaft to protect against lava issues.