Advertisement
Corosus

Untitled

Mar 3rd, 2013
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. package net.brojo.plugins;
  2.  
  3. import java.util.Random;
  4.  
  5. public class DancePlugin extends BrojoPlugin {
  6.  
  7. @Override
  8. public String getName() {
  9. return "Test";
  10. }
  11.  
  12. @Override
  13. public String getVersion() {
  14. return "0.01";
  15. }
  16.  
  17. @Override
  18. public String getDescription() {
  19. return "Test Plugin for BrojoBot, outputs 'Doop' when the user types ',hello'";
  20. }
  21. /**
  22. * @param m Message received
  23. * @return whether this plugin should be loaded
  24. */
  25. public static boolean accepts(Message m) {
  26. return m.getContents().toLowerCase().equals(":D") && m.getContents().toLowerCase().length() > 2;
  27. }
  28.  
  29. @Override
  30. public boolean onActivated(IConnector impl, Message message) {
  31. String msg = "";
  32. Random rand = new Random();
  33. int choice = rand.nextInt(4);
  34. if (choice == 0) msg = ":D]-<";
  35. if (choice == 1) msg = ":D[-<";
  36. if (choice == 2) msg = ":D/-<";
  37. if (choice == 3) msg = ":D\-<";
  38. impl.send(message.getRecipient(), msg);
  39. return false;
  40. }
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement