the commonwealth , though , ignored that agreement and attacked spanish shipping , which so angered william mckinley that he finally had congress pass an act in 1899 making it unlawful to capture shipping or distribute any proceeds taken as a prize . ''