Interface TestDedicatedServerContext
- All Superinterfaces:
AutoCloseable,TestServerContext
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 Summary
Methods inherited from interface net.fabricmc.fabric.api.client.gametest.v1.context.TestServerContext
computeOnServer, runCommand, runOnServer
-
Method Details
-
connect
TestServerConnection 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:
closein interfaceAutoCloseable
-