mirror of
https://github.com/PrismarineJS/node-minecraft-protocol.git
synced 2024-12-20 12:32:26 -05:00
25 lines
710 B
JavaScript
25 lines
710 B
JavaScript
var mc = require('minecraft-protocol');
|
|
|
|
if(process.argv.length < 4 || process.argv.length > 6) {
|
|
console.log("Usage : node client_channel.js <host> <port> [<name>] [<password>]");
|
|
process.exit(1);
|
|
}
|
|
|
|
var client = mc.createClient({
|
|
host: process.argv[2],
|
|
port: parseInt(process.argv[3]),
|
|
username: process.argv[4] ? process.argv[4] : "test",
|
|
password: process.argv[5],
|
|
version: '1.10'
|
|
});
|
|
|
|
|
|
client.on('login', onlogin);
|
|
client.on('error', console.log);
|
|
|
|
function onlogin() {
|
|
client.registerChannel('CUSTOM|ChannelOne',['i32',[]],true);
|
|
client.registerChannel('CUSTOM|ChannelTwo',['i32',[]],true);
|
|
client.writeChannel('CUSTOM|ChannelOne', 4);
|
|
client.on('CUSTOM|ChannelTwo',console.log);
|
|
}
|