#
Documentation
.lookup():
((options: ServerStatusOptions) => Promise<ServerStatus>)- options: ServerStatusOptions
host:stringAn IP address or hostname of the server. (alias: hostname)
port?:numberdefault: 25565Port of the server. SRV lookup is disabled when using ports other than 25565.
timeout?:numberdefault: 10000The time (in milliseconds) to wait for a response before throwing an error if the transaction isn’t completed. (Default: 10 seconds)
ping?:booleandefault: trueWhether to send a payload at the end to measure the server latency. If false, the
latencyfield will be null.protocolVersion?:numberdefault: 769The protocol version sent to the server to simulate different Minecraft client versions. Refer to the Protocol Version Numbers for details. It is recommended to set this explicitly, as it will be updated periodically through minor version bumps. The default is 769 (Minecraft 1.21.4).
throwOnParseError?:booleandefault: trueIf true, an error will be thrown when the the status field fails to parse. The raw status response is always provided in the
statusRawfield.SRVLookup?:booleandefault: trueWhether to perform a SRV lookup on the provided hostname. Set to
falseto skip the lookup, which is useful when you're only looking for basic DNS records. It is automatically disabled when you define a port different from 25565.JSONParse?:booleandefault: trueWhether to parse the JSON
statusfield. Useful to disable when you only need the raw plaintext response. If false, thestatusfield will be null.
- ServerStatus
latency?:numberThe time it takes to receive back a response after sending a small payload to a server, in milliseconds. Will be null if the
pingoption is false.status?:DynamicObjectParsed status response from the server. This field will be null if parsing fails or if
JSONParseis false. Example of a valid Status Response.statusRaw:stringPlaintext status response in the form of JSON. Useful when
statusfails to parse.
- options: ServerStatusOptions
.setDnsServers():
((serverArray: string[]) => Promise<boolean>)Wraps the
dns.setServersfunction, useful for quicker lookups through different DNS servers.
The first IP in the array will always be used first, others will be tried if the first one is unreachable.
Accepts an array of hostnames or IP addresses of DNS servers. It will either return true, or throw an error, otherwise, it uses the default DNS servers of your computer.
❗ Changing the default DNS servers is recommended, if you're doing tons of lookups at once.Usage:
// For example: mc.setDnsServers(["9.9.9.9", "1.1.1.1", "8.8.8.8"]) // (Quad9, Cloudflare, Google) // Note: Cloudflare is typically the fastest for DNS queries.