@srvquery/protocol-minecraft-bedrock 0.0.1-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # @srvquery/protocol-minecraft-bedrock
2
+
3
+ ![npm Version](https://shieldcn.dev/npm/@srvquery/protocol-minecraft-bedrock.svg?variant=secondary) ![npm Weekly Downloads](https://shieldcn.dev/npm/@srvquery/protocol-minecraft-bedrock/downloads.svg)
4
+
5
+ Query Minecraft Bedrock servers directly using RakNet's unconnected ping protocol.
6
+
7
+ ## Installation
8
+
9
+ ```sh
10
+ pnpm add @srvquery/core @srvquery/protocol-minecraft-bedrock
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```ts
16
+ import { createMinecraftBedrockProtocol } from "@srvquery/protocol-minecraft-bedrock";
17
+
18
+ const minecraft = createMinecraftBedrockProtocol({
19
+ host: "play.example.net",
20
+ });
21
+
22
+ const status = await minecraft.query({ opcode: "STATUS" });
23
+ const latency = await minecraft.query({ opcode: "PING" });
24
+
25
+ console.log(`${status.motd}: ${status.onlinePlayers}/${status.maxPlayers}`);
26
+ console.log({ latency });
27
+ ```
28
+
29
+ ## Query types
30
+
31
+ | Opcode | Description |
32
+ | -------- | -------------------------------------------------- |
33
+ | `STATUS` | Edition, version, player counts, map and game mode |
34
+ | `PING` | Round-trip latency in milliseconds |
35
+
36
+ The UDP port defaults to `19132`. Pass `port` explicitly for servers using a custom port.
37
+
38
+ Reference: [Bedrock Edition protocol](https://wiki.bedrock.dev/servers/server-listping.html)
@@ -0,0 +1,3 @@
1
+ export { createMinecraftBedrockProtocol, defaultMinecraftBedrockPort, type CreateMinecraftBedrockProtocolParams, type MinecraftBedrockProtocol, type MinecraftBedrockProtocolRequestOpcode, } from "./protocol";
2
+ export { type MinecraftBedrockServerStatus } from "./packet/schema";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,8BAA8B,EAC9B,2BAA2B,EAC3B,KAAK,oCAAoC,EACzC,KAAK,wBAAwB,EAC7B,KAAK,qCAAqC,GAC3C,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,KAAK,4BAA4B,EAAE,MAAM,iBAAiB,CAAC"}