mirror of
https://github.com/minescope/mineping.git
synced 2025-07-14 17:14:40 +03:00
initial commit
This commit is contained in:
41
types/lib/bedrock.d.ts
vendored
Normal file
41
types/lib/bedrock.d.ts
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
import { PingOptions } from "..";
|
||||
|
||||
export type BedrockPingResponse = {
|
||||
version: {
|
||||
name: string;
|
||||
protocol: string;
|
||||
};
|
||||
players: {
|
||||
max: string;
|
||||
online: string;
|
||||
};
|
||||
description: string;
|
||||
gamemode: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Asynchronously ping Minecraft Bedrock server.
|
||||
*
|
||||
* The optional `options` argument can be an object with a `ping` (default is `19132`) or/and `timeout` (default is `5000`) property.
|
||||
*
|
||||
* @param host The Bedrock server address.
|
||||
*
|
||||
* ```js
|
||||
* import { pingBedrock } from 'mineping';
|
||||
*
|
||||
* const data = await pingBedrock('mco.mineplex.com');
|
||||
* console.log(data);
|
||||
* ```
|
||||
*
|
||||
* The resulting output will resemble:
|
||||
* ```console
|
||||
* {
|
||||
* version: { name: 'Mineplex', protocol: '475' },
|
||||
* players: { max: '5207', online: '5206' },
|
||||
* description: ' New Costumes',
|
||||
* gamemode: 'Survival'
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export function pingBedrock(host: string, options?: PingOptions): Promise<BedrockPingResponse>;
|
||||
|
53
types/lib/java.d.ts
vendored
Normal file
53
types/lib/java.d.ts
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
import { PingOptions } from "..";
|
||||
|
||||
export type SampleProp = {
|
||||
name: string,
|
||||
id: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* `JSON Response` field of Response packet.
|
||||
* @see https://wiki.vg/Server_List_Ping#Response
|
||||
*/
|
||||
export type JavaPingResponse = {
|
||||
version: {
|
||||
name: string;
|
||||
protocol: number;
|
||||
};
|
||||
players: {
|
||||
max: number;
|
||||
online: number;
|
||||
sample: SampleProp[];
|
||||
};
|
||||
description: string;
|
||||
favicon: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Asynchronously ping Minecraft Java server.
|
||||
*
|
||||
* The optional `options` argument can be an object with a `ping` (default is `25565`) or/and `timeout` (default is `5000`) property.
|
||||
*
|
||||
* @param host The Java server address.
|
||||
* @param options The configuration for pinging Minecraft Java server.
|
||||
*
|
||||
* ```js
|
||||
* import { pingJava } from 'mineping';
|
||||
*
|
||||
* const data = await pingJava('mc.hypixel.net');
|
||||
* console.log(data);
|
||||
* ```
|
||||
*
|
||||
* The resulting output will resemble:
|
||||
* ```console
|
||||
* {
|
||||
* version: { name: 'Requires MC 1.8 / 1.18', protocol: 47 },
|
||||
* players: { max: 200000, online: 67336, sample: [] },
|
||||
* description: ' §f☃ §aHypixel Network §eTRIPLE COINS & EXP §f☃\n' +
|
||||
* ' §6✰ §f§lHOLIDAY SALE §c§lUP TO 85% OFF §6✰',
|
||||
* favicon: 'data:image/png;base64,iVBORw0KGg...
|
||||
}
|
||||
* ```
|
||||
*/
|
||||
export function pingJava(host: string, options?: PingOptions): Promise<JavaPingResponse>;
|
||||
|
10
types/lib/varint.d.ts
vendored
Normal file
10
types/lib/varint.d.ts
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
export default varint;
|
||||
declare namespace varint {
|
||||
function encodeInt(val: number): Buffer;
|
||||
function encodeString(val: string): Buffer;
|
||||
function encodeUShort(val: number): Buffer;
|
||||
function concat(chunks: Buffer[]): Buffer;
|
||||
function decodeInt(buffer: Buffer, offset: number): number;
|
||||
function decodeString(val: Buffer, offset?: number): string;
|
||||
function decodeLength(val: number): 5 | 7 | 8 | 1 | 2 | 3 | 4 | 6 | 9 | 10;
|
||||
}
|
Reference in New Issue
Block a user