/**
   * Setup the CraftBukkit server for all the tests.
   *
   * @throws IOException Unable to setup server.
   * @throws InterruptedException Thread interrupted.
   */
  @BeforeClass
  public static void setupCraftBukkit() throws Exception {
    setupPlugins();

    try {
      org.bukkit.craftbukkit.Main.main(new String[0]);
    } finally {
      System.out.println("Current class loader: " + Thread.currentThread().getContextClassLoader());
      System.out.println("Loader of SimpleLogger: " + SimpleLogger.class.getClassLoader());
      System.out.println("Loader of Logger: " + Logger.class.getClassLoader());
    }

    // We need to wait until the server object is ready
    while (Bukkit.getServer() == null) Thread.sleep(1);

    // Make it clear this plugin doesn't exist
    FAKE_PLUGIN = createPlugin("FakeTestPluginIntegration");

    // No need to look for updates
    FieldUtils.writeStaticField(ProtocolLibrary.class, "UPDATES_DISABLED", Boolean.TRUE, true);

    // Wait until the server and all the plugins have loaded
    Bukkit.getScheduler()
        .callSyncMethod(
            FAKE_PLUGIN,
            new Callable<Object>() {
              @Override
              public Object call() throws Exception {
                initializePlugin(FAKE_PLUGIN);
                return null;
              }
            })
        .get(TIMEOUT_MS, TimeUnit.MILLISECONDS);

    // Plugins are now ready
    ProtocolLibrary.getConfiguration().setDebug(true);
  }