Well, all that raiding went on for awhile, yeah? Eventually some of the Chinese officials got fed up with it and recruited some monks from a few different areas and sent them into battle against the pirates. Apparently they were pretty ruthless and not only won a couple of times, but also chased the pirates up and down the coast while they fought. They lost really badly in their last battle against the pirates though, and after that they sorta stopped cooperating with the government to fight for them.
[video]
I kinda think I would've done the same thing.