Node.js
Servercraft can also be used programmatically through Node.js. To get started, install the package.
npm i servercraftInitialize
const servercraft = require('servercraft')
const server = new servercraft()Setup
server.setup(startAfter, args, config, version)If startAfter is false, you can omit or pass null for the args and config parameters. If startAfter is true, you can omit the config parameter.
Start
server.start(args, config)Stop
server.stop()Get IP
Args are command-line arguments, and config is a JSON object. You can find a list of all the arguments here. You can find a list of all the config options below.
Download
Servercraft also allows you to only download a JAR file to a directory.
Config
maxMemoryAllocation
maxMemoryAllocation is the maximum amount of memory that the server can use. This is in MB.
Number
minMemoryAllocation
minMemoryAllocation is the minimum amount of memory that the server can use. This is in MB.
Number
Start
Setup
startAfter
Start server after setup
bool
args
If startAfter is true, pass these command-line arguments to start()
string
config
If startAfter is true, pass this to start()
object
Delete your server
Get path to the directory
Last updated
Was this helpful?