boolean foundValid = false; char[] nameChars = hd.name.toCharArray(); for ( int loop = 0; !foundValid && loop < nameChars.length; loop++ ) { if ( !Character.isWhitespace( nameChars[loop] ) ) { foundValid = true; } } if ( !foundValid ) { new AlertDialog( frame, "Host a Game", "Error: enter a player name." ).show(); return; }
    public void host() {        HostDialog hd;        hd = new HostDialog(frame);        hd.show();        // verify dialog data        if(hd.name == null || hd.serverPass == null || hd.port == 0) {            return;        }        // kick off a RNG check        megamek.common.Compute.d6();        // start server        server = new Server(hd.serverPass, hd.port);        // initialize client        client = new Client(hd.name, "localhost", hd.port);		launch(client.getFrame());        server.getGame().getOptions().loadOptions(client, hd.serverPass);        optdlg = null;    }