1.0.3 • Published 8 years ago

prismarine-tokens v1.0.3

Weekly downloads
8
License
MIT
Repository
github
Last release
8 years ago

prismarine-tokens

Store and use authentication tokens instead of passwords to emulate the way the official launcher works

Features

  • Store all authentications tokens to automatically reuse them on future connections
  • Minimal username+password authentications to prevent Mojang from blocking your account
  • Support of both mineflayer and minecraft-protocol
  • Multiple storage files
  • Asynchronous calls
  • Easy implementation on your project: just wrap all your bot in a callback function

Installation

npm install prismarine-tokens

Usage

Example with mineflayer

var mineflayer = require('mineflayer');
var tokens = require('prismarine-tokens');

var options = {
  host: 'localhost',   // optional
  port: 25565,         // optional
  username: 'email@example.com',
  password: '12345678',
  //Location of the file to store and read tokens for this bot
  //You can use the same file for all your bots
  tokensLocation: './bot_tokens.json',
  //Set to true if you want debug informations
  tokensDebug: true
};

tokens.use(options, function(_err, _opts){

  if (_err) throw _err;

  var bot = mineflayer.createBot(_opts);

  bot.on('connect', function() {
    console.info('connected');
  });

});

Example with minecraft-protocol

var mc = require('minecraft-protocol');
var tokens = require('prismarine-tokens');

var options = {
  host: 'localhost',   // optional
  port: 25565,         // optional
  username: 'email@example.com',
  password: '12345678',
  //Location of the file to store and read tokens for this bot
  //You can use the same file for all your bots
  tokensLocation: './bot_tokens.json',
  //Set to true if you want debug informations
  tokensDebug: true
};


tokens.use(options, function(_err, _opts){

  if (_err) throw _err;

  var client = mc.createClient(_opts);

  client.on('connect', function() {
    console.info('connected');
  });

});
1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago