fix: #5 add gameVersion field for Bedrock
Add gameVersion field in BedrockPingResponse Closes: #5
This commit is contained in:
parent
afdaa9eb3e
commit
c735604c38
|
@ -40,7 +40,7 @@ const readStringFromBuffer = (buffer, offset) => {
|
||||||
*/
|
*/
|
||||||
const parseAdvertiseString = (advertiseStr) => {
|
const parseAdvertiseString = (advertiseStr) => {
|
||||||
const parts = advertiseStr.split(';');
|
const parts = advertiseStr.split(';');
|
||||||
return {
|
const parsedParts = {
|
||||||
gameId: parts[0],
|
gameId: parts[0],
|
||||||
description: parts[1],
|
description: parts[1],
|
||||||
protocolVersion: parts[2],
|
protocolVersion: parts[2],
|
||||||
|
@ -50,6 +50,8 @@ const parseAdvertiseString = (advertiseStr) => {
|
||||||
name: parts[7],
|
name: parts[7],
|
||||||
mode: parts[8]
|
mode: parts[8]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return parsedParts;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -144,8 +146,9 @@ const ping = (host, port = 19132, cb, timeout = 5000) => {
|
||||||
case 0x1c: {
|
case 0x1c: {
|
||||||
const pong = UNCONNECTED_PONG(msg);
|
const pong = UNCONNECTED_PONG(msg);
|
||||||
const clientData = {
|
const clientData = {
|
||||||
version: {
|
|
||||||
name: pong.name,
|
name: pong.name,
|
||||||
|
version: {
|
||||||
|
gameVersion: pong.gameVersion,
|
||||||
protocol: pong.protocolVersion
|
protocol: pong.protocolVersion
|
||||||
},
|
},
|
||||||
players: {
|
players: {
|
||||||
|
|
|
@ -8,8 +8,9 @@ export type BedrockPingOptions = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export type BedrockPingResponse = {
|
export type BedrockPingResponse = {
|
||||||
version: {
|
|
||||||
name: string;
|
name: string;
|
||||||
|
version: {
|
||||||
|
gameVersion: string;
|
||||||
protocol: string;
|
protocol: string;
|
||||||
};
|
};
|
||||||
players: {
|
players: {
|
||||||
|
|
Loading…
Reference in New Issue