Comportement.java 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package bot.irc.comportement;
  2. import java.util.ArrayList;
  3. import java.util.List;
  4. import bot.irc.main.Bot;
  5. import bot.irc.main.IRCBot;
  6. public abstract class Comportement {
  7. private Bot bot;
  8. public Comportement(Bot b) {
  9. this.bot = b;
  10. }
  11. /**
  12. * Crée et renvoie une liste de tous les comprtements présents.
  13. * @param b bot que les actions utiliseront pour répondre.
  14. * @return Liste de tous les comportements.
  15. */
  16. public static List<Comportement> getAllComportements(IRCBot b){
  17. List<Comportement> liste = new ArrayList<>();
  18. liste.add(Cafe.getInstance(b));
  19. liste.add(Philo.getInstance(b));
  20. return liste;
  21. }
  22. public abstract boolean hastoreact(String message);
  23. public abstract List<String> react(String channel, String sender,
  24. String login, String hostname, String message);
  25. /**
  26. * @return the bot
  27. */
  28. public Bot getBot() {
  29. return bot;
  30. }
  31. /**
  32. * @param iRCBot the bot to set
  33. */
  34. public void setBot(Bot bot) {
  35. this.bot = bot;
  36. }
  37. /**
  38. *
  39. * @return le nom actuel du bot placé en minuscules
  40. */
  41. public String getBotNick() {
  42. return bot.getBotName().toLowerCase();
  43. }
  44. }