Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
var mc = require('minecraft-protocol');
var client = mc.createClient({
host: "", // optional
port: 25565, // optional
username: "username",
password: "pass",
client.on('connect', function() {'connected');
client.on('chat', function(packet) {
var jsonMsg = JSON.parse(packet.message);
if (jsonMsg.translate == 'chat.type.announcement' || jsonMsg.translate == 'chat.type.text') {
var username = jsonMsg.with[0];
var msg = jsonMsg.with[1];
if (username === client.username) return;
client.write('chat', {message: msg});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.