From 17ca22abe97bdaa209ff1670646e26f4c9c664bf Mon Sep 17 00:00:00 2001 From: Aaron Alef Date: Tue, 19 Jan 2021 19:26:45 +0100 Subject: [PATCH] fix(testclient): update TestClient to load gameType from ServiceLoader(#367) Co-authored-by: xerus2000 <27jf@pm.me> --- helpers/test-client/src/sc/TestClient.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/helpers/test-client/src/sc/TestClient.java b/helpers/test-client/src/sc/TestClient.java index b596d8585..4960eff75 100644 --- a/helpers/test-client/src/sc/TestClient.java +++ b/helpers/test-client/src/sc/TestClient.java @@ -5,6 +5,7 @@ import jargs.gnu.CmdLineParser; import jargs.gnu.CmdLineParser.Option; import org.slf4j.LoggerFactory; +import sc.api.plugins.IGamePlugin; import sc.framework.plugins.Player; import sc.networking.INetworkInterface; import sc.networking.TcpNetwork; @@ -20,6 +21,7 @@ import java.net.Socket; import java.util.Arrays; import java.util.List; +import java.util.ServiceLoader; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; @@ -42,7 +44,7 @@ public class TestClient extends XStreamClient { private static final Logger logger = (Logger) LoggerFactory.getLogger(TestClient.class); - private static final String gameType = "swc_2020_hive"; + private static final String gameType = ServiceLoader.load(IGamePlugin.class).iterator().next().id(); private static final ClientPlayer[] players = {new ClientPlayer(), new ClientPlayer()}; private static final File logDir = new File("logs").getAbsoluteFile();