Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const mc = require('minecraft-protocol')
const options = {
motd: 'Vox Industries',
'max-players': 127,
port: 25565,
'online-mode': false
}
const server = mc.createServer(options)
server.on('login', function (client) {
broadcast(client.username + ' joined the game.')
const addr = client.socket.remoteAddress + ':' + client.socket.remotePort
console.log(client.username + ' connected', '(' + addr + ')')
client.on('end', function () {
broadcast(client.username + ' left the game.', client)
console.log(client.username + ' disconnected', '(' + addr + ')')
})
// send init data so client will start rendering world
client.write('login', {
entityId: client.id,
levelType: 'default',
gameMode: 1,
// item settings
const item_server = 3;
const item_category = 4;
const item_functional = 2;
// messages
const message_loading = '\u00a7aLoading... ';
const menu_title = "\u00a70Choose a server";
const message_error_exit = "You didn't select a server to join! ";
const message_bye = "Bye! ";
/* == END OF SETTINGS AREA == */
const type = require("type-detect");
const mc = require('minecraft-protocol');
const server = mc.createServer({
'online-mode': false, // optional
encryption: true, // optional
host: listen_host, // optional
port: listen_port, // optional
});
console.log("Server is now started! ");
server.on('login', function(client) {
modifyClient(client);
client.write('login', {
entityId: 0,
levelType: 'default',
gameMode: 3,
dimension: 0,
difficulty: 2,
}
stop();
// setTimeout(startQueuing, 100); // reconnect after 100 ms
});
client.on('error', (err) => {
if (proxyClient) {
proxyClient.end(`Connection error by 2b2t server.\n Error message: ${err}\nReconnecting...`);
proxyClient = null
}
console.log('err', err);
stop();
// setTimeout(startQueuing, 100); // reconnect after 100 ms
});
server = mc.createServer({ // create a server for us to connect to
'online-mode': false,
encryption: true,
host: '0.0.0.0',
port: config.ports.minecraft,
version: config.MCversion,
'max-players': maxPlayers = 1
});
server.on('login', (newProxyClient) => { // handle login
newProxyClient.write('login', {
entityId: newProxyClient.id,
levelType: 'default',
gameMode: 0,
dimension: 0,
difficulty: 2,
maxPlayers: server.maxPlayers,
const mc = require('minecraft-protocol')
const server = mc.createServer({
'online-mode': false, // optional
encryption: false, // optional
host: '0.0.0.0', // optional
port: 25565, // optional
version: '1.10'
})
server.on('login', function (client) {
client.registerChannel('MC|Brand', ['string', []])
client.on('MC|Brand', console.log)
client.write('login', {
entityId: client.id,
levelType: 'default',
gameMode: 0,
dimension: 0,
difficulty: 2,
var mc = require('minecraft-protocol');
var states = mc.protocol.states;
var options = {
motd: 'Bushido Studios',
'max-players': 127,
port: 25565,
'online-mode': true,
};
var server = mc.createServer(options);
server.on('login', function(client) {
broadcast(client.username+' joined the game.');
var addr = client.socket.remoteAddress + ':' + client.socket.remotePort;
console.log(client.username+' connected', '('+addr+')');
client.on('end', function() {
broadcast(client.username+' left the game.', client);
console.log(client.username+' disconnected', '('+addr+')');
});
// send init data so client will start rendering world
client.write('login', {
entityId: client.id,
levelType: 'default',
gameMode: 1,
const mc = require('minecraft-protocol')
const options = {
'online-mode': true
}
const server = mc.createServer(options)
server.on('login', function (client) {
const addr = client.socket.remoteAddress
console.log('Incoming connection', '(' + addr + ')')
client.on('end', function () {
console.log('Connection closed', '(' + addr + ')')
})
client.on('error', function (error) {
console.log('Error:', error)
})
// send init data so client will start rendering world
client.write('login', {
entityId: client.id,
const mc = require('minecraft-protocol')
const server = mc.createServer({
'online-mode': false, // optional
encryption: false, // optional
host: '0.0.0.0', // optional
port: 25565, // optional
version: '1.10'
})
server.on('login', function (client) {
client.write('login', {
entityId: client.id,
levelType: 'default',
gameMode: 0,
dimension: 0,
difficulty: 2,
maxPlayers: server.maxPlayers,
reducedDebugInfo: false
connect (options) {
const plugins = requireIndex(path.join(__dirname, 'lib', 'plugins'))
this._server = mc.createServer(options)
Object.keys(plugins)
.filter(pluginName => plugins[pluginName].server !== undefined)
.forEach(pluginName => plugins[pluginName].server(this, options))
if (options.logging === true) this.createLog()
this._server.on('error', error => this.emit('error', error))
this._server.on('listening', () => this.emit('listening', this._server.socketServer.address().port))
this.emit('asap')
}
}
const request = require('sync-request');
const merge = require('merge');
const sleep = require('system-sleep');
const mc = require('minecraft-protocol');
const id = server_id();
var cache = server_doc(id);
const origin_port = 25565;
const port = 25555;
const server = mc.createServer({
host: '0.0.0.0',
port: port,
'online-mode': false
});
server.on('login', function(client) {
let start = new Date();
let username = client.username
let response = server_request(username);
client.end(response.message);
let end = new Date();
let success = response.success;
console.log('- ' + username + ' was ' + (success ? 'accepted' : (success == null ? 'deferred' : 'rejected')) + ' after ' + ((end - start) / 1000) + ' seconds');
if(success) {
server_transfer();
}
const mc = require('minecraft-protocol')
const Chunk = require('prismarine-chunk')('1.12.1')
const Vec3 = require('vec3')
var server = mc.createServer({
'online-mode': true,
encryption: true,
host: '0.0.0.0',
port: 25565,
version: '1.12.1'
})
var chunk = new Chunk()
for (var x = 0; x < 16; x++) {
for (var z = 0; z < 16; z++) {
chunk.setBlockType(new Vec3(x, 100, z), 2)
for (var y = 0; y < 256; y++) {
chunk.setSkyLight(new Vec3(x, y, z), 15)
}
}
}