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服務器,並使用提供的主機名,端口和密碼進行身份驗證。返回承諾,通過成功消息解決或拒絕錯誤消息。
連接方法為各種方案提供了詳細的錯誤消息,例如不正確的密碼,連接超時和服務器中的無效響應。
歡迎捐款!請打開問題或提交您的更改請求。