Skip to content

MCQueryLib guide

Maxim Liven edited this page Feb 19, 2021 · 1 revision

If you wanna use this lib for your own projects this is guide about how to use one.

First of all, you have to create an instance of McQuery class for your server and init new socket. And then you can try to get some info from your server.

For example

public static async Token<ServerFullState> GetState() {
    var mcQuery = new McQuery(Dns.GetHostAddresses("localhost")[0], 25565);
    mcQuery.InitSocket();
    await mcQuery.GetHandshake();
    return await mcQuery.GetFullStatus();
}

It doesn't manage your ChallengeToken and you have to call GetHandshake() manually as well as have to manage broken connections and recreate socket with InitSocket() call.

Clone this wiki locally