GithubHelp home page GithubHelp logo

darcros / node-minecraft-proxy Goto Github PK

View Code? Open in Web Editor NEW
31.0 2.0 15.0 70 KB

Simple Minecraft proxy written in Node.js using the node-minecraft-protocol library

License: MIT License

JavaScript 100.00%
minecraft-proxy minecraft minecraft-protocol

node-minecraft-proxy's Introduction

node-minecraft-proxy

Simple Minecraft proxy written in Node.js using the node-minecraft-protocol library

Features

  • Connect to proxy
  • Forward players to servers
  • Change server
  • Basic plugin support, see ./src/Plugins/ChatCommands.js for an example

Installation

npm install basic-minecraft-proxy

Examples

See also ./examples/ for other examples

Creating a proxy

This example shows how to create a new proxy and how to the options are passed.

const McProxy = require('minecraft-proxy');

let localServerOptions = {
  'port': '25578',
  'version': '1.12.1',
  'online-mode': false,
  'motd': 'nodejs minecraft proxy'
}

let serverList = {
  hub: {
    host: 'localhost',
    port: 25565,
    isDefault: true,
    isFallback: true
  },
  minigames: {
    host: 'localhost',
    port: 25566
  }
}

// if you leave proxyOptions empty yo may as well not pass it in the arguments, I wrote it anyway to point out that it exist
let proxyOptions = {}

/*
  Use the "/server <serverName>" command in chat to move between servers.
  <serverName> is the name that you chose for the server inside the serverList
  This command is implemented by /src/Plugins/ChatCommands.js and it can be disabled by setting enablePlugin: false inside proxyOptions
*/
let proxy = McProxy.createProxy(localServerOptions, serverList, proxyOptions);

proxy.on('error', console.error);

proxy.on('listening', () => {
  console.info('Listening!');
});

Moving players from a server to another

In this example every player will be moved from the hub server (default) to the minigames server 30 seconds after having logged in.

proxy.on('login', (player) => {
  setTimeout(() => {
    proxy.setRemoteServer(player.id, "minigames");
  }, 30 * 1000);
});

Documentation

See the wiki.

node-minecraft-proxy's People

Contributors

darcros avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

node-minecraft-proxy's Issues

Online mode

It doesn' t work with online-mode set to true.

Failed to verify username!

Hi, I lauched your proxy example and got the following error on my hub server:

lost connection: Failed to verify username!

as for the proxy:

Connection lost, timed out

Did I do something wrong? thx

IN FORGE

I used ts to rewrite the client of setremoteserver, but it seems that the protocol is manually configured by the replay method and will not be forwarded, so players cannot join the forge server. Can you help me explain your idea

Get player hostname

For example if I have two domains for my server: play.server.com and survival.server.com.

How can I make that if the player joins via the survival.server.com domain that the player automatically get sent to the Survival.

And if the players connects via play.server.com, it gets sent to the default server.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.