Skip to content

Commit 70fe4d9

Browse files
committed
update package.json, send handshake and status request separately
1 parent 15c0708 commit 70fe4d9

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
22
"name": "craftping",
33
"type": "module",
4-
"version": "1.0.2",
4+
"version": "1.0.3",
55
"main": "index.js",
66
"repository": "github:aternosorg/craftping",
77
"scripts": {
88
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --rootDir ./test"
99
},
1010
"keywords": ["minecraft", "ping", "query", "status", "protocol"],
11-
"author": "",
11+
"author": "Kurt Thiemann <[email protected]>",
1212
"license": "MIT",
13-
"description": "",
13+
"description": "A universal ping/query library for Minecraft servers.",
1414
"devDependencies": {
1515
"@jest/globals": "^29.7.0",
1616
"jest": "^29.7.0"

src/JavaPing/JavaPing.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@ export default class JavaPing extends TCPSocket {
1818
*/
1919
async ping(options = {}) {
2020
let time = BigInt(Date.now());
21-
await this.write(Buffer.concat([
22-
new Handshake()
23-
.setProtocolVersion(options.protocolVersion ?? null)
24-
.setHostname(options.hostname ?? this.address)
25-
.setPort(options.port ?? this.port).write(),
26-
new StatusRequest().write()
27-
]));
21+
await this.write(new Handshake()
22+
.setProtocolVersion(options.protocolVersion ?? null)
23+
.setHostname(options.hostname ?? this.address)
24+
.setPort(options.port ?? this.port).write());
25+
this.signal?.throwIfAborted();
26+
await this.write(new StatusRequest().write());
2827
this.signal?.throwIfAborted();
2928

3029
let response = await this.readPacket(StatusResponse);

0 commit comments

Comments
 (0)