Ejemplo n.º 1
0
  public void onEnable() {
    bl = this;
    pdf = this.getDescription();
    vers = pdf.getVersion();
    servervs = Bukkit.getServer().getClass().getPackage().getName();
    servervs = servervs.substring(servervs.lastIndexOf(".") + 1);
    file = new File(this.getDataFolder(), "config.yml");

    registerEvents(
        this,
        new MOTD(),
        new JoinLeaveListener(),
        new AdminChat(),
        new God(),
        new AFK(),
        new ConfigListener(),
        new WeatherListener(),
        new Mute(),
        new Jail(),
        new NewPlayerListener(),
        new Plugins(),
        new Version(),
        new Freeze(),
        new BanJoinListener(),
        new Open(),
        new Item(),
        new ClicksPerSecondListener(),
        new CommandSpy(),
        new PowerTool(),
        new DeathListener(),
        new ChatEventManager(),
        new FeedSign(),
        new HealSign(),
        new RespawnListener(),
        new QuickGM(),
        new FormatSigns(),
        new KitSign(),
        new QuickTime(),
        new QuickWeather());
    setup();

    Bukkit.getScheduler()
        .scheduleSyncRepeatingTask(this, new TicksPerSecond(), 100L, 1L); // updates the tps
    Bukkit.getScheduler()
        .scheduleSyncRepeatingTask(
            this, new ClicksPerSecond(), 0L, 20L); // Updating the rates for CPS

    debug("Enabled Bottom Line (" + pdf.getDescription() + ") v" + vers + ".");

    Bukkit.getScheduler()
        .runTaskTimerAsynchronously(
            this,
            new Runnable() {
              public void run() {
                if (Bukkit.getServer().getPluginManager().getPlugin("Vault") != null) {
                  try {
                    setupChat();
                  } catch (Exception e) {
                    debug("No chat dependency found!");
                  }

                  try {
                    setupPermissions();
                  } catch (Exception e) {
                    debug("No permissions dependency found!");
                  }

                  try {
                    Updater u = new Updater(15348, bl);
                    u.start();
                  } catch (Exception e) {
                    error("Could not check for update (no connection?)");
                  }
                }
              }
            },
            0,
            432020);
  }