Ejemplo n.º 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();
  }
Ejemplo n.º 2
0
  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());
        }
      }
    }
  }
Ejemplo n.º 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);
  }
Ejemplo n.º 4
0
 public void onDisable() {
   Command.removeCommands(cmd);
   stopUpdater();
 }
Ejemplo n.º 5
0
 public void onDisable() {
   Command.removeCommands(cmd);
 }
Ejemplo n.º 6
0
 public void onEnable(File dir) {
   Command.addCommands(this, cmd = new CmdQuestionParty());
   Command.addCommand(this, "qparty", cmd);
 }
Ejemplo n.º 7
0
 public void onDisable() {
   Command.removeCommands(cmd, cmdAdd, cmdRemove);
 }
Ejemplo n.º 8
0
 @Override
 public void onEnable() {
   Command.addCommands(cmd = new CmdUrban());
 }