File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
starter-bot/src/main/java/ru/croccode/hypernull/bot Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ package ru .croccode .hypernull .bot ;
2+
3+ import java .io .IOException ;
4+ import java .net .InetSocketAddress ;
5+ import java .net .Socket ;
6+ import java .nio .file .Paths ;
7+
8+ import ru .croccode .hypernull .io .SocketSession ;
9+
10+ public class DeathmatchLoop {
11+
12+ public static void main (String [] args ) throws IOException {
13+ String configPath = args .length > 0
14+ ? args [0 ]
15+ : "bot.properties" ;
16+ BotConfig botConfig = BotConfig .load (Paths .get (configPath ));
17+
18+ while (true ) {
19+ try {
20+ Socket socket = new Socket ();
21+ socket .setTcpNoDelay (true );
22+ socket .setSoTimeout (300_000 );
23+ socket .connect (new InetSocketAddress (
24+ botConfig .getServerHost (),
25+ botConfig .getServerPort ()));
26+
27+ SocketSession session = new SocketSession (socket );
28+ StarterBot bot = new StarterBot (botConfig .getBotName (), botConfig .getMode ());
29+ new BotMatchRunner (bot , session ).run ();
30+ } catch (Exception e ) {
31+ e .printStackTrace ();
32+ }
33+ }
34+ }
35+ }
You can’t perform that action at this time.
0 commit comments