예제 #1
0
  public void onEnable() {
    if (Common.VERSION < 139) {
      getLogger().info("BKCommonLib outdated!");
      getServer().getPluginManager().disablePlugin(this);
      return;
    } else if (Common.VERSION > 139)
      getLogger().info("WARNING: BKCommonLib to new. Things may be broken!");

    config = new Config(this);

    // Register events
    Server s = getServer();
    PluginManager pm = s.getPluginManager();
    pm.registerEvents(new PortalStickPlayerListener(this), this);
    pm.registerEvents(new PortalStickBlockListener(this), this);
    pm.registerEvents(new PortalStickVehicleListener(this), this);
    pm.registerEvents(eL, this);

    worldGuard = (WorldGuardPlugin) pm.getPlugin("WorldGuard");

    config.load();
    i18n = new I18n(this, getFile());

    // Teleport all entities.
    s.getScheduler().scheduleSyncRepeatingTask(this, entityManager, 1L, 1L);
    // Garbage-collect the users drop lists.
    s.getScheduler().scheduleSyncRepeatingTask(this, userManager, 600L, 600L);

    // Register commands
    ArrayList<BaseCommand> tmpList = new ArrayList<BaseCommand>();
    tmpList.add(new RegionToolCommand(this));
    tmpList.add(new SetRegionCommand(this));
    tmpList.add(new ReloadCommand(this));
    tmpList.add(new DeleteAllCommand(this));
    tmpList.add(new DeleteCommand(this));
    tmpList.add(new HelpCommand(this));
    tmpList.add(new RegionListCommand(this));
    tmpList.add(new DeleteRegionCommand(this));
    tmpList.add(new FlagCommand(this));
    tmpList.add(new RegionInfoCommand(this));
    tmpList.add(new LanguageCommand(this));
    commands = tmpList.toArray(new BaseCommand[0]);
  }
예제 #2
0
 public void onDisable() {
   // config.unLoad() handles cleanup, so let's call it
   config.unLoad();
   getServer().getScheduler().cancelTasks(this);
 }