Example #1
0
  @Override
  public void setupConfigs() {
    new MessagesConfig().load();

    configuration = new DefaultConfig();
    configuration.load();

    consoleConfig = new ConsoleConfig();
    consoleConfig.load();

    schedulesConfig = new SchedulesConfig();
    schedulesConfig.load();

    exemptionsConfig = new ExemptionsConfig();
    exemptionsConfig.load();

    reasonsConfig = new ReasonsConfig();
    reasonsConfig.load();

    geoIpConfig = new GeoIpConfig();
    geoIpConfig.load();
  }
Example #2
0
  @Override
  public void setupRunnables() {
    if (externalConn == null) {
      syncRunner =
          new Runner(
              new BanSync(),
              new MuteSync(),
              new IpSync(),
              new IpRangeSync(),
              new ExpiresSync(),
              new WarningSync());
    } else {
      syncRunner =
          new Runner(
              new BanSync(),
              new MuteSync(),
              new IpSync(),
              new IpRangeSync(),
              new ExpiresSync(),
              new WarningSync(),
              new ExternalBanSync(),
              new ExternalMuteSync(),
              new ExternalIpSync(),
              new ExternalNoteSync());
    }

    setupAsyncRunnable(10L, syncRunner);

    /*
     * This task should be ran last with a 1L offset as it gets modified
     * above.
     */
    setupAsyncRunnable(
        (schedulesConfig.getSchedule("saveLastChecked") * 20L) + 1L, new SaveLastChecked());

    // Purge
    getServer().getScheduler().runTaskAsynchronously(plugin, new Purge());

    // TODO Refactor
    if (!getConfiguration().isCheckForUpdates()) return;

    getServer()
        .getScheduler()
        .runTaskAsynchronously(
            plugin,
            new Runnable() {

              @Override
              public void run() {
                if (UpdateUtils.isUpdateAvailable(getFile())) {
                  getServer()
                      .getScheduler()
                      .runTask(
                          plugin,
                          new Runnable() {

                            @Override
                            public void run() {
                              new UpdateListener().register();
                            }
                          });
                }
              }
            });
  }