@srvquery/protocol-minecraft-java 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-java
2
+
3
+ ![npm Version](https://shieldcn.dev/npm/@srvquery/protocol-minecraft-java.svg?variant=secondary) ![npm Weekly Downloads](https://shieldcn.dev/npm/@srvquery/protocol-minecraft-java/downloads.svg)
4
+
5
+ Query Minecraft Java Edition servers using the direct Server List Ping protocol.
6
+
7
+ ## Installation
8
+
9
+ ```sh
10
+ pnpm add @srvquery/core @srvquery/protocol-minecraft-java
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```ts
16
+ import { createMinecraftJavaProtocol } from "@srvquery/protocol-minecraft-java";
17
+
18
+ const minecraft = createMinecraftJavaProtocol({
19
+ host: "org.earthmc.net",
20
+ });
21
+
22
+ const status = await minecraft.query({ opcode: "STATUS" });
23
+ const latency = await minecraft.query({ opcode: "PING" });
24
+
25
+ console.log(`${status.version.name}: ${status.players.online}/${status.players.max}`);
26
+ console.log({ latency });
27
+ ```
28
+
29
+ ## Query types
30
+
31
+ | Opcode | Description |
32
+ | -------- | --------------------------------------------------- |
33
+ | `STATUS` | Version, player counts, description and server icon |
34
+ | `PING` | Round-trip latency in milliseconds |
35
+
36
+ Reference: [Minecraft Protocol: Server List Ping](https://minecraft.wiki/w/Java_Edition_protocol/Server_List_Ping)
37
+
38
+ The `port` defaults to `25565`, Minecraft Java Edition's standard server port. Pass `port` explicitly for servers using a custom port.
@@ -0,0 +1,3 @@
1
+ export { type MinecraftDescription, type MinecraftPlayer, type MinecraftPlayers, type MinecraftServerStatus, type MinecraftVersion, } from "./packet/schema";
2
+ export { createMinecraftJavaProtocol, type CreateMinecraftJavaProtocolParams, type MinecraftJavaProtocol, type MinecraftJavaProtocolRequestOpcode, } from "./protocol";
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,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,2BAA2B,EAC3B,KAAK,iCAAiC,EACtC,KAAK,qBAAqB,EAC1B,KAAK,kCAAkC,GACxC,MAAM,YAAY,CAAC"}