Interface TestDedicatedServerContext

All Superinterfaces:
AutoCloseable, TestServerContext

@NonExtendable public interface TestDedicatedServerContext extends TestServerContext, AutoCloseable
Context for a client gametest containing various helpful functions while an in-process dedicated server is running. This class implements AutoCloseable and is intended to be used in a try-with-resources statement. When closed, the dedicated server will be stopped.

Dedicated servers will only run if the EULA has been accepted in eula.txt. If you have read and accepted the Minecraft EULA, you can write the file at build-time by setting fabricApi.configureTests { eula = true } in your build.gradle.

Functions in this class can only be called on the client gametest thread.

  • Method Details

    • connect

      Connects the client to the dedicated server. The resulting connection is intended to be used in a try-with-resources statement.
      Returns:
      The connection handle to the dedicated server
    • close

      void close()
      Stops the dedicated server.
      Specified by:
      close in interface AutoCloseable