public void runCommercial(String stream,int length){
  if (stream == null || stream.isEmpty()) {
    commercialResult(stream,"Can't run commercial, not on a channel.",TwitchApi.RequestResult.FAILED);
  }
 else {
    String channel="#" + stream;
    if (isChannelOpen(channel)) {
      g.printLine(channel,"Trying to run " + length + "s commercial..");
    }
 else {
      g.printLine("Trying to run " + length + "s commercial.. ("+ stream+ ")");
    }
    api.runCommercial(stream,settings.getString("token"),length);
  }
}

public void runCommercial ( String stream , int length ) { if ( stream == null || stream . isEmpty ( ) ) { commercialResult ( stream , "Can't run commercial, not on a channel." , TwitchApi . RequestResult . FAILED ) ; } else { String channel = "#" + stream ; if ( isChannelOpen ( channel ) ) { g . printLine ( channel , "Trying to run " + length + "s commercial.." ) ; } else { g . printLine ( "Trying to run " + length + "s commercial.. (" + stream + ")" ) ; } api . runCommercial ( stream , settings . getString ( "token" ) , length ) ; } }
tries to run a commercial on the given stream with the given length . outputs a message about it in the appropriate channel .
