public RefreshBlob(Session session) { AccessToken = session.AccessToken; ClientToken = session.ClientToken; SelectedProfile = session.SelectedProfile; RequestUser = true; }
public MinecraftClient(Session session) { Session = session; PacketQueue = new ConcurrentQueue<IPacket>(); PacketHandlers = new PacketHandler[256]; Handlers.PacketHandlers.Register(this); }
public MinecraftClient(Session session) { Session = session; PacketQueue = new ConcurrentQueue<IPacket>(); PacketHandlers = new Dictionary<Type, PacketHandler>(); Handlers.PacketHandlers.Register(this); }
public static void Main(string[] args) { var endPoint = ParseEndPoint(args[0]); var ping = ServerPing.DoPing(endPoint); Console.WriteLine("{0}/{1} {2} ({3}): {4}", ping.CurrentPlayers, ping.MaxPlayers, ping.ServerVersion, ping.ProtocolVersion, ping.MotD); //var lastLogin = LastLogin.GetLastLogin(); //var session = Session.DoLogin(lastLogin.Username, lastLogin.Password); var session = new Session("TestBot"); // Connect to server var client = new MinecraftClient(session); client.Connect(endPoint); client.ChatMessage += (sender, e) => Console.WriteLine(e.RawMessage); string command; do { command = Console.ReadLine(); if (command.StartsWith("say ")) client.SendChat(command.Substring(4)); } while (command != "quit"); client.Disconnect("Quitting"); }
static void Main(string[] args) { // Set up log providers LogProvider.RegisterProvider(new FileLogWriter("packetLog.txt", LogImportance.Low)); LogProvider.RegisterProvider(new ConsoleLogWriter(LogImportance.High)); // Set up endpoint, ping server var endPoint = ParseEndPoint(args[0]); var ping = ServerPing.DoPing(endPoint); Console.WriteLine("{0}/{1} {2} ({3}): {4}", ping.CurrentPlayers, ping.MaxPlayers, ping.ServerVersion, ping.ProtocolVersion, ping.MotD); //var lastLogin = LastLogin.GetLastLogin(); //var session = Session.DoLogin(lastLogin.Username, lastLogin.Password); var session = new Session("TestBot"); // Connect to server var client = new MinecraftClient(session); client.Connect(endPoint); client.PlayerDied += (s, e) => Console.WriteLine("Player died! Type 'respawn' to respawn."); client.Disconnected += (s, e) => Console.WriteLine("Disconnected: " + e.Reason); string input = ""; while (input != "quit") { input = Console.ReadLine(); if (input.StartsWith("move ")) { var parts = input.Split(' '); var amount = double.Parse(parts[2]); var position = client.Position; if (parts[1] == "x") position.X += amount; else if (parts[1] == "y") position.Y += amount; else position.Z += amount; client.Position = position; } else if (input.StartsWith("look ")) { var parts = input.Split(' '); var amount = float.Parse(parts[2]); if (parts[1] == "yaw") client.Yaw = amount; else client.Pitch = amount; } else if (input.StartsWith("say ")) client.SendChat(input.Substring(4)); else if (input == "respawn") client.Respawn(); } client.Disconnect("Quitting"); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //var lastLogin = LastLogin.GetLastLogin(); var session = new Session("Crafty");//Session.DoLogin(lastLogin.Username, lastLogin.Password); var client = new MinecraftClient(session); using (var window = new MainWindow(client)) { window.Run(new IPEndPoint(IPAddress.Loopback, 25565)); } }
public static void Main(string[] args) { var endPoint = ParseEndPoint(args[0]); var ping = ServerPing.DoPing(endPoint); Console.WriteLine("{0}/{1} {2} ({3}): {4} [{5}ms latency]", ping.Players.OnlinePlayers, ping.Players.MaxPlayers, ping.Version.Name, ping.Version.ProtocolVersion, ping.Description, (int)ping.Latency.TotalMilliseconds); Console.WriteLine("Player list sample:"); if (ping.Players.Players != null) foreach (var player in ping.Players.Players) Console.WriteLine("{0} ({1})", player.Name, player.Id); if (!string.IsNullOrEmpty(ping.Icon)) Console.WriteLine("Server icon: {0}", ping.Icon); //var lastLogin = LastLogin.GetLastLogin(); //var session = Session.DoLogin(lastLogin.Username, lastLogin.Password); var session = new Session("TestBot"); // Connect to server var client = new MinecraftClient(session); client.Connect(endPoint); client.ChatMessage += (sender, e) => Console.WriteLine(e.RawMessage); string command; do { command = Console.ReadLine(); if (command == null) continue; // MonoDevelop debugger does this sometimes if (command.StartsWith("say ")) client.SendChat(command.Substring(4)); if (command == "detect") { var coordinates = new Coordinates3D((int)client.Position.X, (int)client.Position.Y - 1, (int)client.Position.Z); Console.WriteLine("Looking up " + coordinates); var id = client.World.GetBlockId(coordinates); Console.WriteLine("Block ID: " + id); } } while (command != "quit"); client.Disconnect("Quitting"); }
public MinecraftClient(Session session) { Session = session; SendQueue = new ConcurrentQueue<IPacket>(); }
static void Main(string[] args) { // Set up log providers LogProvider.RegisterProvider(new FileLogWriter("packetLog.txt", LogImportance.Low)); LogProvider.RegisterProvider(new ConsoleLogWriter(LogImportance.High)); // Set up endpoint, ping server var ping = ServerPing.DoPing(args[0]); Console.WriteLine("{0}/{1} {2} ({3}): {4}", ping.CurrentPlayers, ping.MaxPlayers, ping.ServerVersion, ping.ProtocolVersion, ping.MotD); //var lastLogin = LastLogin.GetLastLogin(); //var session = Session.DoLogin(lastLogin.Username, lastLogin.Password); var session = new Session("TestBot"); // Connect to server var client = new MinecraftClient(session); client.Connect(args[0]); client.PlayerDied += (s, e) => Console.WriteLine("Player died! Type 'respawn' to respawn."); client.Disconnected += (s, e) => Console.WriteLine("Disconnected: " + e.Reason); string input = ""; while (input != "quit") { input = Console.ReadLine(); if (input == null) continue; if (input.StartsWith("move ")) { var parts = input.Split(' '); var amountX = int.Parse(parts[1]); var amountZ = int.Parse(parts[2]); client.Move(amountX, amountZ); } else if (input.StartsWith("look ")) { var parts = input.Split(' '); var amount = float.Parse(parts[2]); if (parts[1] == "yaw") client.Yaw = amount; else client.Pitch = amount; } else if (input.StartsWith("lookat ")) { var parts = input.Split(' '); var pos = new Vector3 { X = double.Parse(parts[1]), Y = double.Parse(parts[2]), Z = double.Parse(parts[3]) }; client.LookAt(pos); } else if (input.StartsWith("say ")) client.SendChat(input.Substring(4)); else if (input == "respawn") client.Respawn(); else if (input == "save") client.World.Save("testWorld", true); else if (input == "under") Console.WriteLine(client.World.GetBlock(client.Position + Vector3.Down).GetType().Name); } client.Disconnect("Quitting"); }