1.0.1 • Published 7 years ago
spigen v1.0.1
spigen
Programmatically manage Spigot server instances, in Node.
Install
npm i spigen
Purpose
Spigen is designed for use by (generally) large dynamic Minecraft networks.
Start a server
const Spigen = require('spigen')
const generator = new Spigen('spigot.jar')
const serverInstance = generator.createServer({
'host': 'localhost',
'port': 25565,
'eula': true,
'maxPlayers': 100
})
Custom Spigot start parameters
All Spigot start parameters can be used as options in generator.createServer(options)
.
For example:
generator.createServer({
'--level-name': 'mainWorld'
})
Utilizing serverInstance
Spigot instances are created using generators with the generator.createServer
method.
For example:
const generator = new Spigen('spigot.jar')
const serverInstance = generator.createServer()
Methods
serverInstance.stop
Requests server stop with /stop
command.
serverInstance.execute(String command)
Executes a command on the server.
Properties
serverInstance.process
Internal Spigot child process.
Events
error
(error)
It is recommended that this event be handled. This occurs when the child process experiences a fatal error.
err
(error)
This is emitted when output to stderr is recieved from the Spigot instance.
log
(message)
This is emitted when Spigot instances output to stdout.
close
(code)
This is emitted when Spigot ends.
done
Emitted when Spigot has fully started.