com.github.steveice10.packetlib.tcp.TcpSessionFactory Java Examples
The following examples show how to use
com.github.steveice10.packetlib.tcp.TcpSessionFactory.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Bot.java From LambdaAttack with MIT License | 6 votes |
public void connect(String host, int port) { Client client = new Client(host, port, account.getProtocol(), new TcpSessionFactory(proxy)); this.session = client.getSession(); switch (account.getGameVersion()) { case VERSION_1_11: client.getSession().addListener(new SessionListener111(options, this)); break; case VERSION_1_12: client.getSession().addListener(new SessionListener112(options, this)); break; case VERSION_1_14: client.getSession().addListener(new SessionListener114(options, this)); break; case VERSION_1_15: client.getSession().addListener(new SessionListener115(options, this)); break; default: throw new IllegalStateException("Unknown session listener"); } client.getSession().connect(); }
Example #2
Source File: GeyserLegacyPingPassthrough.java From Geyser with MIT License | 5 votes |
@Override public void run() { try { this.client = new Client(connector.getConfig().getRemote().getAddress(), connector.getConfig().getRemote().getPort(), new MinecraftProtocol(SubProtocol.STATUS), new TcpSessionFactory()); this.client.getSession().setFlag(MinecraftConstants.SERVER_INFO_HANDLER_KEY, (ServerInfoHandler) (session, info) -> { this.pingInfo = new GeyserPingInfo(info.getDescription().getFullText(), info.getPlayerInfo().getOnlinePlayers(), info.getPlayerInfo().getMaxPlayers()); this.client.getSession().disconnect(null); }); client.getSession().connect(); } catch (Exception ex) { ex.printStackTrace(); } }