I don't know how, but I personally combat this problem with 2 commands:
1. /sector_chmod x y z + protected
Makes so nothing in this sector can take damage. X Y Z is the sector you want to protect, so e.g. "/sector_chmod 2 2 2 + protected" protects sector 2 2 2.
2. /despawn_all MOB all true
This despawns every loaded pirate. Pirates for some reason have a hidden MOB tag in front of their names, so copy pasting that command will delete them.