mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Rewrote AES stream & Perform "SessionCheck" in advance
This commit is contained in:
parent
a3971f9097
commit
13d1a9856a
28 changed files with 306 additions and 2807 deletions
|
|
@ -14,6 +14,7 @@ using MinecraftClient.Mapping;
|
|||
using MinecraftClient.Inventory;
|
||||
using MinecraftClient.Logger;
|
||||
using MinecraftClient.Protocol.Keys;
|
||||
using MinecraftClient.Protocol.Session;
|
||||
|
||||
namespace MinecraftClient
|
||||
{
|
||||
|
|
@ -71,7 +72,7 @@ namespace MinecraftClient
|
|||
private string username;
|
||||
private string uuid;
|
||||
private string sessionid;
|
||||
private PlayerKeyPair playerKeyPair;
|
||||
private PlayerKeyPair? playerKeyPair;
|
||||
private DateTime lastKeepAlive;
|
||||
private object lastKeepAliveLock = new();
|
||||
private int respawnTicks = 0;
|
||||
|
|
@ -143,9 +144,9 @@ namespace MinecraftClient
|
|||
/// <param name="server_ip">The server IP</param>
|
||||
/// <param name="port">The server port to use</param>
|
||||
/// <param name="protocolversion">Minecraft protocol version to use</param>
|
||||
public McClient(string username, string uuid, string sessionID, PlayerKeyPair playerKeyPair, int protocolversion, ForgeInfo forgeInfo, string server_ip, ushort port)
|
||||
public McClient(SessionToken session, PlayerKeyPair? playerKeyPair, int protocolversion, ForgeInfo forgeInfo, string server_ip, ushort port)
|
||||
{
|
||||
StartClient(username, uuid, sessionID, playerKeyPair, server_ip, port, protocolversion, forgeInfo, false, "");
|
||||
StartClient(session, playerKeyPair, server_ip, port, protocolversion, forgeInfo, false, "");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -158,9 +159,9 @@ namespace MinecraftClient
|
|||
/// <param name="port">The server port to use</param>
|
||||
/// <param name="protocolversion">Minecraft protocol version to use</param>
|
||||
/// <param name="command">The text or command to send.</param>
|
||||
public McClient(string username, string uuid, string sessionID, PlayerKeyPair playerKeyPair, string server_ip, ushort port, int protocolversion, ForgeInfo forgeInfo, string command)
|
||||
public McClient(SessionToken session, PlayerKeyPair? playerKeyPair, string server_ip, ushort port, int protocolversion, ForgeInfo forgeInfo, string command)
|
||||
{
|
||||
StartClient(username, uuid, sessionID, playerKeyPair, server_ip, port, protocolversion, forgeInfo, true, command);
|
||||
StartClient(session, playerKeyPair, server_ip, port, protocolversion, forgeInfo, true, command);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -174,16 +175,16 @@ namespace MinecraftClient
|
|||
/// <param name="uuid">The player's UUID for online-mode authentication</param>
|
||||
/// <param name="singlecommand">If set to true, the client will send a single command and then disconnect from the server</param>
|
||||
/// <param name="command">The text or command to send. Will only be sent if singlecommand is set to true.</param>
|
||||
private void StartClient(string user, string uuid, string sessionID, PlayerKeyPair playerKeyPair, string server_ip, ushort port, int protocolversion, ForgeInfo forgeInfo, bool singlecommand, string command)
|
||||
private void StartClient(SessionToken session, PlayerKeyPair? playerKeyPair, string server_ip, ushort port, int protocolversion, ForgeInfo forgeInfo, bool singlecommand, string command)
|
||||
{
|
||||
terrainAndMovementsEnabled = Settings.TerrainAndMovements;
|
||||
inventoryHandlingEnabled = Settings.InventoryHandling;
|
||||
entityHandlingEnabled = Settings.EntityHandling;
|
||||
|
||||
bool retry = false;
|
||||
this.sessionid = sessionID;
|
||||
this.uuid = uuid;
|
||||
this.username = user;
|
||||
this.sessionid = session.ID;
|
||||
this.uuid = session.PlayerID;
|
||||
this.username = session.PlayerName;
|
||||
this.host = server_ip;
|
||||
this.port = port;
|
||||
this.protocolversion = protocolversion;
|
||||
|
|
@ -244,7 +245,7 @@ namespace MinecraftClient
|
|||
|
||||
try
|
||||
{
|
||||
if (handler.Login(this.playerKeyPair))
|
||||
if (handler.Login(this.playerKeyPair, session))
|
||||
{
|
||||
if (singlecommand)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue