예제 #1
0
  @Override
  public void onDisable() {
    ListIterator<GuestPlayer> it = guestPlayers.listIterator();

    while (it.hasNext()) {
      GuestPlayer gp = it.next();
      gp.saveData(getPluginId(this));
    }

    guestPlayers.clear();
    groupManager.saveGroupConfigurations();

    moduleManager.shutDownModules();

    getConfigData().save();
  }
예제 #2
0
  @Override
  public void onEnable() {
    instance = this;

    perms = new PermissionsManager(this.getServer(), "[VoxelGuest]", config);
    groupManager = new GroupManager();
    moduleManager = new ModuleManager(this, commandsManager);
    registerPluginIds();

    // Register system / miscellaneous commands
    commandsManager.registerCommands(MiscellaneousCommands.class);
    commandsManager.registerCommands(ServerAdministrationCommands.class);

    // Load system event listeners
    Bukkit.getPluginManager().registerEvents(listener, this);
    Bukkit.getPluginManager().registerEvents(perms, this);

    // Load permissions system
    perms.registerActiveHandler();

    // Load players
    for (Player player : Bukkit.getOnlinePlayers()) {
      GuestPlayer gp = new GuestPlayer(player);

      if (isPlayerRegistered(gp)) {
        continue;
      }

      groupManager.verifyPlayerGroupExistence(player);
      guestPlayers.add(gp); // KEEP THIS LAST
      ONLINE_MEMBERS++;
    }

    // Load modules
    ModuleManager.setActiveModuleManager(moduleManager);
    moduleManager.loadModules(availableModules);

    // Load module events into the system listener
    listener.registerModuleEvents();

    if (getConfigData().getString("reset") == null
        || getConfigData().getString("reset").equalsIgnoreCase("yes")) {
      loadFactorySettings();
    }
  }