-
Notifications
You must be signed in to change notification settings - Fork 0
Structure of a plugin
For a functioning, more complex example see: https://github.com/RepComm/extrude-repcraft
JavaScript plugins at a minimum are made of up 3 things:
- It's folder/directory
- It's
package.json
definition - A javascript file
All plugins reside in their own folders,
all of which reside in <spigot-home>/repcraft/js-plugins
NOTE: the js-plugins
folder won't exist until you run spigot at least once with RepCraft
installed.
This is a basic json formatted file. It is mainly for RepCraft to discover your plugin with.
The only required member is main
, which should point to your main javascript file.
{
"main":"myPlugin.js"
}
This is where your plugin code goes!
You may opt to use .js
as the extension,
however, you may use ES Modules if you choose .mjs
as the extension.
Logically your code doesn't have to be any different from .js
however, you gain a lot of abilities from modules.
There is no boiler-plate / starting code required for your plugin to load correctly. The simplest plugin code is something like:
console.log("Hello World! My js plugin has loaded!");