Conduit-MC / conduit-plugin

Plugin base for Conduit plugins

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Conduit Plugin

Base plugin for Conduit

Conduit comes with a simple plugin API. Conduit will try to load plugins from the plugins folder. Each plugin must be in it's own folder and contain a package.json file and/or an index.js file.

Example

const ConduitPlugin = require('conduit-plugin');

class MyCustomPlugin extends ConduitPlugin {
	constructor(server) {
		super(server);
	}

	onInitialized() {
		console.log('This message is from a plugin. I have hooked the `initialized` event handle! I run BEFORE the base plugin');
	}

	onEnabled() {
		// Open a chest GUI with `/chest`
		this.registerCommand('chest', chestCommandHandler);
	}

	onBeforeChat(event) {
		event.getSender()
			.sendMessage('This message is sent via a plugin using `onBeforeChat`. This event runs before the chat packet is handled internally or by other plugins');
	}
}

module.exports = MyCustomPlugin;

function chestCommandHandler(event) {
	event.getSender().openWindow({
		type: 'chest',
		slots: 9,
		title: '§bChest'
	});
}

Plugin API

The plugin API docs can be found in the Wiki

About

Plugin base for Conduit plugins


Languages

Language:JavaScript 100.0%