/// <summary> /// Authecate the user to join /// </summary> private static bool Auth(string _Username, string _Password) { WebClient Client = new WebClient(); string returns; try { Debug("Connecting to minecraft.net...\n"); PostData post = new PostData("http://minecraft.net/game/getversion.jsp"); post.Add("user", _Username); post.Add("password", _Password); post.Add("version", "12"); returns = post.GetResult(true); } catch { SMPInterface.LastError = "Could not connect to minecraft.net"; return false; } SMPInterface.Debug("Authecation: " + returns + "\n"); if (returns != "Bad login" && returns != "Old version" && returns != "Error") { string[] Bits = returns.Split(":".ToCharArray()); SessionHash = Bits[1]; CaseUsername = Bits[2]; SessionID = Bits[3]; return true; } else { SMPInterface.LastError = returns; return false; } }
public static bool AuthConnect(string _Username, string _ServerID) { string returns = ""; try { PostData post = new PostData("http://www.minecraft.net/game/joinserver.jsp"); post.Add("user", _Username); post.Add("sessionId", SessionID); post.Add("serverId", _ServerID); returns = post.GetResult(true); } catch { SMPInterface.LastError = "Could not connect to minecraft.net"; return false; } SMPInterface.Debug("Connect Authecation: " + returns + "\n"); if (returns == "OK") return true; else return false; }