Arriving by private yacht is no different to arriving by any other means in a country. There are entry procedures and the same penalties apply as would apply arriving by other modes.
In addition as a yacht skipper I require that all crew disclose to me and agree before departure about matters like firearms, drugs etc. In my case both of those classes of material are totally banned on my vessel. Other skippers may obviously have alternative views.
As an example of what countries in Europe might think about you arriving with a firearm I suggest you go here for France's view:
To quote from that site:
"France has stringent regulations on firearms and ammunition. As a rule, firearms which have no legitimate sporting or recreational use are not permitted entry into France. Under French legislation, weapons and their ammunition fall under eight categories. Firearms and their ammunition are listed under categories I, IV, V, VII and VIII."
You should do your own research by going to the websites of foreign governments. You should also ensure that you disclose completely to your skipper (if you are not the owner/skipper) and that you comply with their requirements.