feat: print stack on game

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
MiaoWoo 2019-03-09 10:29:06 +08:00
parent 8d5902600f
commit 2dff086a01

View File

@ -123,8 +123,9 @@ function main(sender, command, args){
var pname = args[1]; var pname = args[1];
if (pluginCache.indexOf(pname) !== -1) { if (pluginCache.indexOf(pname) !== -1) {
manager.reload(pname) manager.reload(pname)
console.sender(sender, '§6插件 §b%s §a重载完成!'.format(pname))
} else { } else {
console.sender(sender, '§c插件 %s 不存在!'.format(pname)) console.sender(sender, '§c插件 §b%s §c不存在!'.format(pname))
} }
} else { } else {
self.reloadConfig(); self.reloadConfig();
@ -133,17 +134,24 @@ function main(sender, command, args){
break; break;
case "restart": case "restart":
try { try {
console.sender(sender, '§6Reloading §3MiaoScript Engine...');
ScriptEngineContextHolder.disableEngine(); ScriptEngineContextHolder.disableEngine();
ScriptEngineContextHolder.enableEngine(); ScriptEngineContextHolder.enableEngine();
console.sender(sender, '§3MiaoScript Engine §6Reload §aSuccessful...'); console.sender(sender, '§3MiaoScript Engine §6Reload §aSuccessful...');
} catch (ex) { } catch (ex) {
console.sender(sender, "§3MiaoScript Engine §6Reload §cError! ERR: " + ex); console.sender(sender, "§3MiaoScript Engine §6Reload §cError! ERR: " + ex);
console.ex(ex); console.sender(sender, console.stack(ex));
} }
break; break;
case "run": case "run":
args.shift(1); args.shift(1);
console.sender(sender, eval(args.join(' ')) || '§4没有返回结果!'); try {
var script = args.join(' ')
console.sender(sender, '§b运行脚本:§r', script)
console.sender(sender, '§a返回结果:§r', eval(script) || '§4没有返回结果!');
} catch (ex) {
console.sender(sender, console.stack(ex))
}
break; break;
case "create": case "create":
var name = args[1]; var name = args[1];