Advertisement
Guest User

Untitled

a guest
Nov 12th, 2015
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.69 KB | None | 0 0
  1. import org.tbot.bot.TBot;
  2. import org.tbot.internal.AbstractScript;
  3. import org.tbot.internal.Manifest;
  4. import sun.audio.AudioPlayer;
  5. import sun.audio.AudioStream;
  6.  
  7. import javax.mail.*;
  8. import javax.mail.internet.InternetAddress;
  9. import javax.mail.internet.MimeMessage;
  10. import java.io.FileInputStream;
  11. import java.io.FileNotFoundException;
  12. import java.io.IOException;
  13. import java.io.InputStream;
  14. import java.util.Properties;
  15.  
  16. /**
  17.  * Created by Brian on 11/12/2015.
  18.  */
  19. @Manifest(name = "tester", authors = "Brian_Dev", version = 1.0, description = "Kills cows")
  20. public class hoh extends AbstractScript {
  21.     @Override
  22.     public int loop() {
  23.         log("test");
  24.         TBot.getBot().getScriptHandler().pauseScript(true);
  25.  
  26.         return 1000;
  27.     }
  28.  
  29.     public void onPause() {
  30.         // open the sound file as a Java input stream
  31.         String gongFile = "C:\\Users\\Brian\\Downloads\\air.wav";
  32.         InputStream in = null;
  33.         try {
  34.             in = new FileInputStream(gongFile);
  35.         } catch (FileNotFoundException e) {
  36.             e.printStackTrace();
  37.         }
  38.  
  39.         // create an audiostream from the inputstream
  40.         AudioStream audioStream = null;
  41.         try {
  42.             audioStream = new AudioStream(in);
  43.         } catch (IOException e) {
  44.             e.printStackTrace();
  45.         }
  46.  
  47.         // play the audio clip with the audioplayer class
  48.         AudioPlayer.player.start(audioStream);
  49.         sleep(4000);
  50.  
  51.         final String username = "xx@gmail.com";
  52.         final String password = "xx";
  53.  
  54.         Properties props = new Properties();
  55.         props.put("mail.smtp.auth", "true");
  56.         props.put("mail.smtp.starttls.enable", "true");
  57.         props.put("mail.smtp.host", "smtp.gmail.com");
  58.         props.put("mail.smtp.port", "587");
  59.  
  60.         Session session = Session.getInstance(props,
  61.                 new javax.mail.Authenticator() {
  62.                     protected PasswordAuthentication getPasswordAuthentication() {
  63.                         return new PasswordAuthentication(username, password);
  64.                     }
  65.                 });
  66.  
  67.         try {
  68.  
  69.             Message message = new MimeMessage(session);
  70.             message.setFrom(new InternetAddress("xx@gmail.com"));
  71.             message.setRecipients(Message.RecipientType.TO,
  72.                     InternetAddress.parse("xx@vtext.com"));
  73.             message.setSubject("");
  74.             message.setText("test1");
  75.  
  76.             Transport.send(message);
  77.             log("sent msg");
  78.         } catch (MessagingException e) {
  79.             throw new RuntimeException(e);
  80.         }
  81.         log("Paused.");
  82.         TBot.getBot().getScriptHandler().pauseScript(false);
  83.         ;
  84.     }
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement