Exemplo n.º 1
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);
  }
Exemplo n.º 2
0
 public void writeBinBuffer(BinBuffer binb) {
   writeBinBuffer(binb, binb.bytesLeft());
 }