From 34ee276556f1d77755614c16ba0078663b1e7ffa Mon Sep 17 00:00:00 2001 From: MiaoWoo Date: Mon, 11 May 2020 17:24:26 +0800 Subject: [PATCH] feat: support address arg Signed-off-by: MiaoWoo --- packages/client/src/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/client/src/index.ts b/packages/client/src/index.ts index 621e8b30..0d740170 100644 --- a/packages/client/src/index.ts +++ b/packages/client/src/index.ts @@ -6,7 +6,9 @@ import { attachEvents } from './event' let username = process.argv[2] || 'Mr_jtb' let version = process.argv[3] || '1.12.2' -let client = createConnection('192.168.2.5', 25577, username) +let address = process.argv[4] || '192.168.2.5:25577' +let realAddress = address.split(":"); +let client = createConnection(realAddress[0], parseInt(realAddress[1] || "25565"), username) function createConnection(host: string, port: number, username: string) { let client = createClient({