2
2
3
3
import org .geysermc .mcprotocollib .auth .GameProfile ;
4
4
import org .geysermc .mcprotocollib .auth .SessionService ;
5
+ import org .geysermc .mcprotocollib .network .ClientSession ;
5
6
import org .geysermc .mcprotocollib .network .ProxyInfo ;
6
7
import org .geysermc .mcprotocollib .network .Session ;
7
8
import org .geysermc .mcprotocollib .network .event .session .DisconnectedEvent ;
8
9
import org .geysermc .mcprotocollib .network .event .session .SessionAdapter ;
10
+ import org .geysermc .mcprotocollib .network .factory .ClientNetworkSessionFactory ;
9
11
import org .geysermc .mcprotocollib .network .packet .Packet ;
10
- import org .geysermc .mcprotocollib .network .tcp . TcpClientSession ;
12
+ import org .geysermc .mcprotocollib .network .session . ClientNetworkSession ;
11
13
import org .geysermc .mcprotocollib .protocol .MinecraftConstants ;
12
14
import org .geysermc .mcprotocollib .protocol .MinecraftProtocol ;
13
15
import org .geysermc .mcprotocollib .protocol .data .UnexpectedEncryptionException ;
@@ -34,7 +36,7 @@ public class Bot extends Thread {
34
36
private String nickname ;
35
37
private ProxyInfo proxy ;
36
38
private InetSocketAddress address ;
37
- private Session client ;
39
+ private ClientSession client ;
38
40
private boolean hasMainListener ;
39
41
40
42
private double lastX , lastY , lastZ = -1 ;
@@ -50,7 +52,11 @@ public Bot(String nickname, InetSocketAddress address, ProxyInfo proxy) {
50
52
51
53
Log .info ("Creating bot" , nickname );
52
54
protocol = new MinecraftProtocol (nickname );
53
- client = new TcpClientSession (address .getHostString (), address .getPort (), protocol , proxy );
55
+ client = ClientNetworkSessionFactory .factory ()
56
+ .setAddress (address .getHostString (), address .getPort ())
57
+ .setProtocol (protocol )
58
+ .setProxy (proxy )
59
+ .create ();
54
60
}
55
61
56
62
public Bot (MinecraftProtocol protocol , InetSocketAddress address , ProxyInfo proxy ) {
@@ -60,7 +66,11 @@ public Bot(MinecraftProtocol protocol, InetSocketAddress address, ProxyInfo prox
60
66
61
67
Log .info ("Creating bot" , nickname );
62
68
63
- client = new TcpClientSession (address .getHostString (), address .getPort (), protocol , proxy );
69
+ client = ClientNetworkSessionFactory .factory ()
70
+ .setAddress (address .getHostString (), address .getPort ())
71
+ .setProtocol (protocol )
72
+ .setProxy (proxy )
73
+ .create ();
64
74
65
75
SessionService sessionService = new SessionService ();
66
76
client .setFlag (MinecraftConstants .SESSION_SERVICE_KEY , sessionService );
0 commit comments