44import ch .qos .logback .classic .Logger ;
55import jargs .gnu .CmdLineParser ;
66import jargs .gnu .CmdLineParser .Option ;
7+ import org .jetbrains .annotations .NotNull ;
78import org .slf4j .LoggerFactory ;
89import sc .api .plugins .IGamePlugin ;
910import sc .framework .plugins .Player ;
10- import sc .networking .INetworkInterface ;
11- import sc .networking .TcpNetwork ;
1211import sc .networking .clients .XStreamClient ;
1312import sc .protocol .requests .*;
1413import sc .protocol .responses .*;
1716
1817import java .io .File ;
1918import java .io .IOException ;
20- import java .net .Socket ;
2119import java .util .Arrays ;
2220import java .util .List ;
2321import java .util .ServiceLoader ;
@@ -145,7 +143,7 @@ public static void main(String[] args) {
145143 }
146144
147145 private static File findInClasspath (File location ) {
148- if (!location .exists ()) {
146+ if (!location .exists ()) {
149147 final StringTokenizer strTokenizer = new StringTokenizer (classpath , File .pathSeparator );
150148 while (strTokenizer .hasMoreTokens ()) {
151149 final File item = new File (strTokenizer .nextToken ());
@@ -188,7 +186,7 @@ public TestClient(String host, int port, int totalTests) throws IOException {
188186 private boolean gameProgressing = false ;
189187
190188 @ Override
191- protected void onObject (ProtocolMessage message ) {
189+ protected void onObject (@ NotNull ProtocolMessage message ) {
192190 if (message == null ) {
193191 logger .warn ("Received null message" );
194192 return ;
@@ -210,7 +208,7 @@ protected void onObject(ProtocolMessage message) {
210208 if (!result .isRegular ())
211209 irregularGames ++;
212210 StringBuilder log = new StringBuilder ("Game {} ended " +
213- (result .isRegular () ? "regularly -" : "abnormally!" ) + " Winner: " );
211+ (result .isRegular () ? "regularly -" : "abnormally!" ) + " Winner: " );
214212 if (result .getWinners () != null )
215213 for (Player winner : result .getWinners ())
216214 log .append (winner .getDisplayName ()).append (", " );
@@ -257,7 +255,7 @@ protected void onObject(ProtocolMessage message) {
257255
258256 List <ScoreValue > values = score .getScoreValues ();
259257 logger .info (String .format ("New score for %s: Siegpunkte %s, \u2205 Wert 1 %5.2f after %s of %s tests" ,
260- score .getDisplayName (), values .get (0 ).getValue (), values .get (1 ).getValue (), finishedTests , totalTests ));
258+ score .getDisplayName (), values .get (0 ).getValue (), values .get (1 ).getValue (), finishedTests , totalTests ));
261259
262260 if (playerScores == 2 && (isSignificant () || terminateWhenPossible )) {
263261 printScores ();
@@ -339,7 +337,7 @@ private void prepareNewClients() {
339337
340338 private static void exit (int status ) {
341339 if (testclient != null ) {
342- if (!testclient .isClosed ())
340+ if (!testclient .isClosed ())
343341 testclient .send (new CloseConnection ());
344342 testclient .waiter .shutdownNow ();
345343 }
@@ -353,25 +351,20 @@ private static void exit(int status) {
353351 System .exit (status );
354352 }
355353
356- private static INetworkInterface createTcpNetwork (String host , int port ) throws IOException {
357- logger .info ("Creating TCP Network for {}:{}" , host , port );
358- return new TcpNetwork (new Socket (host , port ));
359- }
360-
361354 private boolean scoresPrinted = false ;
362355
363356 private void printScores () {
364357 if (scoresPrinted ) return ;
365358 try {
366359 logger .warn (String .format ("\n " +
367- "=============== SCORES ================\n " +
368- "%s: %.0f\n " +
369- "%s: %.0f\n " +
370- "=======================================\n " +
371- "{} of {} games ended abnormally!" ,
372- players [0 ].name , players [0 ].score .getScoreValues ().get (0 ).getValue (),
373- players [1 ].name , players [1 ].score .getScoreValues ().get (0 ).getValue ()),
374- irregularGames , finishedTests );
360+ "=============== SCORES ================\n " +
361+ "%s: %.0f\n " +
362+ "%s: %.0f\n " +
363+ "=======================================\n " +
364+ "{} of {} games ended abnormally!" ,
365+ players [0 ].name , players [0 ].score .getScoreValues ().get (0 ).getValue (),
366+ players [1 ].name , players [1 ].score .getScoreValues ().get (0 ).getValue ()),
367+ irregularGames , finishedTests );
375368 scoresPrinted = true ;
376369 } catch (Exception ignored ) {
377370 }
0 commit comments