feat: support address arg

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
MiaoWoo 2020-05-11 17:24:26 +08:00
parent 695a490296
commit 2bd8f0c5ff

View File

@ -6,7 +6,9 @@ import { attachEvents } from './event'
let username = process.argv[2] || 'Mr_jtb' let username = process.argv[2] || 'Mr_jtb'
let version = process.argv[3] || '1.12.2' 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) { function createConnection(host: string, port: number, username: string) {
let client = createClient({ let client = createClient({