In order to run a server, you have to open a port and, naturally, opening a port opens you to certain dangers. You can do several things to prevent unwanted traffic: set up a firewall to drop connections from IP's that ping you repeatedly, blacklist offending IP's, limit the maximum number of connections on the port, set up your server via an external DNS service rather than your own IP address or, if it's really bad, rent a server rather than host yourself. You could also set up a sign-up website for your server so that your IP is propagated only to actual players on a whitelist.