Stop a server?
CriminosaMC opened this issue · comments
CriminosaMC commented
I have scoured the documentation for a little while and I don't see any "elegant" way of stopping the server. How do I stop the server? I have the Server
instance stored in a variable, and after x amount of time I want to stop the server.
CriminosaMC commented
I've found a temporary workaround for the time being. It doesn't appear to be that elegant, but I looked through the source and discovered the close
method in the node-minecraft-protocol
package that this package utilises for servers.
Example code:
const mcServer = require("flying-squid");
const server = mcServer.createMCServer({
// options...
});
setTimeout(() => {
server._server.close();
}, 300000);
Deleted user commented
serv.quit('Server closed')
process.exit()