this.inherits(COMMAND); this.command = "shutdown"; this.allow_busy = true; this.allow_state = true; this.allow_die = true; this.allow_level = 6; this.handler = 0; this.enter = function (me, arg) { if (arg == "stop") { if (this.handler) { clearInterval(this.handler); WORLD.sendAll("服务器停止维护,谢谢大家支持。"); } return; } WORLD.sendAll("服务器将要关闭维护,各位玩家请处理好自己的游戏状态。"); this.handler = this.call_interval(function (count) { WORLD.sendAll("还有" + (100 - count * 10) + "秒后服务器将关闭维护,请处理好自己的游戏状态。"); }, 10000, 10, function () { WORLD.sendAll("服务器关闭。"); WORLD.close(); // WORLD.LISTENER.tcpServer._events.connection = null; }); }