Example #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();
  }
  public void run() {
    Console c = System.console();
    if (c == null) return;

    String line;
    while (true) {
      line = c.readLine();
      if (line != null) {
        Command cmd = Command.getCommand(null, Command.EType.Console, line);
        if (cmd != null) {
          CommandCallback callback = new CommandCallback();
          cmd.doCommand(null, Command.EType.Console, callback, null, null, line);
          Shocky.send(null, Command.EType.Console, null, null, callback.toString());
        }
      }
    }
  }
Example #3
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);
  }
Example #4
0
 public void onDisable() {
   Command.removeCommands(cmd);
   stopUpdater();
 }
Example #5
0
 public void onDisable() {
   Command.removeCommands(cmd);
 }
Example #6
0
 public void onEnable(File dir) {
   Command.addCommands(this, cmd = new CmdQuestionParty());
   Command.addCommand(this, "qparty", cmd);
 }
Example #7
0
 public void onDisable() {
   Command.removeCommands(cmd, cmdAdd, cmdRemove);
 }
Example #8
0
 @Override
 public void onEnable() {
   Command.addCommands(cmd = new CmdUrban());
 }