mineflayer-plugin-manager
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

mineflayer-plugin-manager

A plugin manager that is capable of hot-reloading Mineflayer plugin.


Installation

npm install mineflayer-plugin-manager

Usage

Simple example:

  • Run npm install mineflayer-plugin-manager.
  • Place all Mineflayer plugins inside ./plugins folder.
  • Import mineflayer-plugin-manager: const { plugin as PluginManager } = require('mineflayer-plugin-manager').
  • Call bot.loadPlugin(PluginManager).
  • Make changes to your plugins.
  • Call bot.pluginManager.reload().
  • Enjoy new changes.
const Mineflayer = require("mineflayer");
const { plugin as PluginManager } = require("mineflayer-plugin-manager");
const gui = require("mineflayer-gui");

const bot = mineflayer.createBot({
  host: 'localhost',
  port: 25565,
  username: 'bot',
});

//Load all remote plugins that is installed from npm
bot.loadPlugin(gui.plugin);

//Loads plugin manager, it will automatically load all local plugins inside './myFolder' folder
bot.loadPlugin(PluginManager);

///Reload all plugins with latest content
bot.on('chat', (message) => {
  if (message == 'reload')
    bot.pluginManager.reload();
})

Advanced usage (refer API):

const Mineflayer = require("mineflayer");
const { plugin as PluginManager } = require("mineflayer-plugin-manager");
const gui = require("mineflayer-gui");

const bot = mineflayer.createBot({
  host: 'localhost',
  port: 25565,
  username: 'bot',
  pluginManager: {
    logDebug: true, //Enable debug logging
    pluginDir: './myFolder', //Override default plugin folder path
    removeListener: true,
    removeAttributes: true,
    onlyLoadJsPlugin: true,
    whitelistFileTypes: ['.js', '.json']
  }
});

//Load all remote plugins that is installed from npm
bot.loadPlugin(gui.plugin);

//Loads plugin manager, it will automatically load all local plugins inside './myFolder' folder
bot.loadPlugin(PluginManager);

//Reload all plugins with latest content
bot.on('chat', (message) => {
  if (message == 'reload')
    bot.pluginManager.reload();
})

Documentation

API

License

This project uses the MIT license.

Contributions

This project is accepting PRs and Issues. See something you think can be improved? Go for it! Any and all help is highly appreciated!

For larger changes, it is recommended to discuss these changes in the issues tab before writing any code. It's also preferred to make many smaller PRs than one large one, where applicable.

Package Sidebar

Install

npm i mineflayer-plugin-manager

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

19.9 kB

Total Files

13

Last publish

Collaborators

  • jungledome