How to use the minecraft-protocol.Server function in minecraft-protocol

To help you get started, we’ve selected a few minecraft-protocol examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github omegablitz / chunky / chunky_proxy / src / proxy / Proxy.js View on Github external
const mc = require('minecraft-protocol')

const replayPackets = require('./Proxy/packetReplayer')
const addListeners = require('./Proxy/addListeners')

class Proxy extends mc.Server {
  /**
   * Create a minecraft proxy
   * @param {Object} serverSettings Settings for the minecraft-protocol server
   * @param {Object} serverList An object that maps a 'serverName' to the server info
   * @param {Object} proxyOptions Proxy settings
   */
  constructor (serverSettings = {}, serverList = {}, proxyOptions = {}) {
    super(serverSettings.version, serverSettings.customPackets)
    this.serverList = serverList

    this.autoConnect = (typeof proxyOptions.autoConnect === 'undefined') ? true : !!proxyOptions.autoConnect
    this.autoFallback = (typeof proxyOptions.autoFallback === 'undefined') ? true : !!proxyOptions.autoFallback

    let self = this
    self.on('login', (remoteClient) => {
      let id = remoteClient.id