Spaces:
Running
Running
; | |
const Command = require('./command.js'); | |
const CommandCode = require('../constants/commands.js'); | |
const Packet = require('../packets/packet.js'); | |
class Quit extends Command { | |
constructor(callback) { | |
super(); | |
this.onResult = callback; | |
} | |
start(packet, connection) { | |
connection._closing = true; | |
const quit = new Packet( | |
0, | |
Buffer.from([1, 0, 0, 0, CommandCode.QUIT]), | |
0, | |
5 | |
); | |
if (this.onResult) { | |
this.onResult(); | |
} | |
connection.writePacket(quit); | |
return null; | |
} | |
} | |
module.exports = Quit; | |