Rcon Ping
v1.0.1
Minecraft ServerのRCONがライブであるかどうかを確認するためのnode.jsクライアント。 Mehran1022によって開発されました
NPM / YARN / PNPMでインストール:
npm install rcon-ping
yarn add rcon-ping
pnpm add rcon-pingRCONPINGクラスの使用方法の例は次のとおりです。
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 (string):Minecraftサーバーのホスト名。port (番号):Minecraftサーバーのポート。password (文字列):MinecraftサーバーのRCONパスワード。 connect() 、Minecraftサーバーに接続し、提供されたホスト名、ポート、パスワードを使用して認証します。成功メッセージで解決する約束を返したり、エラーメッセージで拒否したりします。
Connectメソッドは、誤ったパスワード、接続タイムアウト、サーバーからの無効な応答など、さまざまなシナリオの詳細なエラーメッセージを提供します。
貢献は大歓迎です!問題を開くか、変更を受けてプルリクエストを送信してください。