Пример #1
0
  public void onEnable(File dir) {
    Command.addCommands(this, cmd = new CmdRSS());

    ArrayList<String> lines = FileLine.read(new File(dir, "rss.cfg"));
    int n = 4;
    for (int i = 0; i < lines.size(); i += n) {
      try {
        URL url = new URL(lines.get(i));
        long time = Long.parseLong(lines.get(i + 1));
        Date date = time <= 0 ? null : new Date(time);
        long interval;
        String[] channels;
        try {
          interval = Long.parseLong(lines.get(i + 2));
          channels = lines.get(i + 3).split(" ");
        } catch (NumberFormatException e) {
          n = 3;
          interval = (5 * 60 * 1000);
          channels = lines.get(i + 2).split(" ");
        }
        feeds.add(new Feed(url, interval, date, channels));
      } catch (MalformedURLException e) {
        continue;
      }
    }
    startUpdater();
  }
Пример #2
0
  public void onEnable() {
    File dir = new File("data", "quotes");
    dir.mkdir();
    File[] files = dir.listFiles();
    for (File f : files) {
      if (f.isDirectory()) return;

      String channel = f.getName();
      BinBuffer binb = new BinFile(f).read();
      binb.setPos(0);
      quotes.put(channel, new ArrayList<Quote>());
      while (binb.bytesLeft() > 0) {
        String[] nicks = binb.readUString().split(" ");
        String quote = binb.readUString();
        quotes.get(channel).add(new Quote(nicks, quote));
      }
    }

    Command.addCommands(
        this, cmd = new CmdQuote(), cmdAdd = new CmdQuoteAdd(), cmdRemove = new CmdQuoteRemove());
    Command.addCommand(this, "q", cmd);
    Command.addCommand(this, "qadd", cmdAdd);
    Command.addCommand(this, "qdel", cmdRemove);
  }
Пример #3
0
 public void onEnable(File dir) {
   Command.addCommands(this, cmd = new CmdQuestionParty());
   Command.addCommand(this, "qparty", cmd);
 }
Пример #4
0
 @Override
 public void onEnable() {
   Command.addCommands(cmd = new CmdUrban());
 }