Example #1
0
 private static void unloadPlugin(String name) {
   loadedPlugins.get(name).unload();
   loadedPlugins.remove(name);
   System.gc();
   System.gc();
   System.gc();
 }
Example #2
0
  public static void main(String[] args) {
    b.setVerbose(true);
    try {
      loadSettings();
    } catch (Exception e) {
      System.err.println("Failed to process config file: " + e.getMessage());
      System.exit(0);
    }

    try {
      b.setName(nick);
      b.connect(server);
      for (String s : channels) b.joinChannel(s);
    } catch (Exception e) {
      System.err.println("Could not connect to server: " + e.getMessage());
      System.exit(0);
    }
  }
Example #3
0
 public void onDisable(String sender, String reason) {
   // while (1 != 0) {
   // boolean partlyParted = onPartAll(sender, reason);
   // if (partlyParted) {
   System.out.println("=============\tBot disabled by " + sender + "\t=============");
   this.disconnect();
   System.exit(0);
   //  }
   // }
 }
Example #4
0
 private void setTick(Info info, String time) {
   int addon = 0;
   try {
     addon = Integer.parseInt(time);
   } catch (NumberFormatException e) {
     info.sendMessage(
         "Format exception.  Command should be !setTick # where # is the number of minutes till the next tick.");
   }
   tickSetter = info.getSender();
   tickTime = System.currentTimeMillis();
   OFFSET = (Utils.getRealMinutes(info) + addon) % 15;
   info.sendMessage("Tick set to " + OFFSET + " minutes off.");
 }
Example #5
0
  public Arisu() {
    try {
      config.load(new FileInputStream("config.properties"));
    } catch (IOException ex) {
      System.err.println("Error loading config.properties.\n" + ex);
      System.exit(0);
    }

    try {
      Startup.onStartup(admins, this, mods);
      this.setName(config.getProperty("nick", "Arisu"));
      this.setLogin(config.getProperty("realname", "Arisu"));
    } catch (Exception ex) {
      System.out.println("Startup failed.\n" + ex);
      System.exit(0);
    }

    cmds = new ArrayList<Commands>();

    cmds.add(new AdminsCommand());
    cmds.add(new ModsCommand());
    cmds.add(new BanCommand());
    cmds.add(new HelloCommand());
    // cmds.add(new BanCommand());
    cmds.add(new InviteCommand());
    cmds.add(new JoinCommand());
    cmds.add(new LeaveCommand());
    cmds.add(new ShutdownCommand());
    cmds.add(new SayCommand());
    cmds.add(new ActCommand());
    cmds.add(new OpCommand());
    cmds.add(new ShellCommand());
    cmds.add(new AuthCommand());
    cmds.add(new GitHubCommand());
    cmds.add(new IgnoreCommand());
    cmds.add(new UnIgnoreCommand());
    cmds.add(new YamlCommand());
  }
Example #6
0
 private void tick(Info info) {
   if (Utils.shouldDefer(info)) return;
   // else
   if (OFFSET == -1) {
     info.sendMessage(
         "Tick not sychronized yet. Wait for the next tick and execute /msg "
             + info.getBot().getName()
             + " !setTickor find out how long until the next tick and execute /msg "
             + info.getBot().getName()
             + " !setTick <mins>");
     return;
   }
   int timeRemaining = 15 - ((15 + Utils.getRealMinutes(info) - OFFSET) % 15);
   long daysSinceSet = (System.currentTimeMillis() - tickTime) / (1000 * 60 * 60 * 24);
   info.sendMessage(
       timeRemaining + " minutes until the next tick (last set " + daysSinceSet + " days ago)");
 }
Example #7
0
 private void setTick(Info info) {
   tickSetter = info.getSender();
   tickTime = System.currentTimeMillis();
   OFFSET = Utils.getRealMinutes(info) % 15;
   info.sendMessage("Tick set to " + OFFSET + " minutes off.");
 }