A plugin manager that is capable of hot-reloading Mineflayer plugin.
npm install mineflayer-plugin-manager
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();
})
This project uses the MIT license.
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.