public void preInitialize() {
    try {
      Sponge.getLogger().info("Loading Sponge...");

      File gameDir = Sponge.getGameDirectory();
      File pluginsDir = Sponge.getPluginsDirectory();

      if (!gameDir.isDirectory() || !pluginsDir.isDirectory()) {
        if (!pluginsDir.mkdirs()) {
          throw new IOException("Failed to create plugins folder");
        }
      }

      SpongeBootstrap.initializeServices();
      SpongeBootstrap.preInitializeRegistry();

      this.game.getEventManager().register(this, this);
      this.game.getEventManager().register(this, this.game.getRegistry());

      Sponge.getLogger().info("Loading plugins...");
      ((VanillaPluginManager) this.game.getPluginManager()).loadPlugins();
      postState(ConstructionEvent.class);
      Sponge.getLogger().info("Initializing plugins...");
      postState(PreInitializationEvent.class);

      this.game
          .getServiceManager()
          .potentiallyProvide(PermissionService.class)
          .executeWhenPresent(
              new Predicate<PermissionService>() {

                @Override
                public boolean apply(PermissionService input) {
                  input.registerContextCalculator(new SpongeContextCalculator());
                  return true;
                }
              });

      SpongeHooks.enableThreadContentionMonitoring();
    } catch (IOException e) {
      throw Throwables.propagate(e);
    }
  }