Rcon Ping
v1.0.1
Node.js客户端,用于检查Minecraft Server的RCON是否实时,并使用给定的主机名,端口和密码存在。由Mehran1022开发
使用NPM / YARN / PNPM安装:
npm install rcon-ping
yarn add rcon-ping
pnpm add rcon-ping这是如何使用RConping类的示例:
const RconPing = require ( 'rcon-ping' ) ;
const hostname = '0.0.0.0' ; // Should be enable-rcon=true in server.properties
const port = 25575 ; // rcon.port in server.properties
const password = 'yourpassword' ; // rcon.password in server.properties
async function main ( ) {
const client = new RconPing ( hostname , port , password )
try {
const result = await client . connect ( )
console . log ( result )
} catch ( error ) {
console . log ( error . message )
}
}
main ( ) RconPing constructor(hostname, port, password)
创建RConping类的新实例。
hostname (字符串):Minecraft服务器的主机名。port (编号):Minecraft服务器的端口。password (字符串):Minecraft服务器的RCON密码。 connect()连接到Minecraft服务器,并使用提供的主机名,端口和密码进行身份验证。返回承诺,通过成功消息解决或拒绝错误消息。
连接方法为各种方案提供了详细的错误消息,例如不正确的密码,连接超时和服务器中的无效响应。
欢迎捐款!请打开问题或提交您的更改请求。