fix: console error

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
MiaoWoo 2019-02-26 09:40:00 +00:00
parent 6766c3b0ce
commit 2cd6e019c6
3 changed files with 15 additions and 11 deletions

View File

@ -53,7 +53,9 @@
if (stack.className.startsWith('<')) {
this.console(' §e位于§c', stack.fileName, '=>§c', stack.methodName, '§4行', stack.lineNumber);
} else {// %s.%s(§4%s:%s§c)
this.console(' §e位于§c', stack.className + '.' + stack.methodName + '(§4' + stack.fileName + ':' + stack.lineNumber + '§c)');
var className = stack.className
className = className.startsWith('jdk.nashorn.internal.scripts') ? className.substr(className.lastIndexOf('$') + 1) : className
this.console(' §e位于§c', className + '.' + stack.methodName + '(§4' + stack.fileName + ':' + stack.lineNumber + '§c)');
}
}.bind(this));
};

View File

@ -6,6 +6,7 @@
var sender = arguments[0];
if (!(sender instanceof org.bukkit.command.CommandSender)) {
this.error("第一个参数未实现 org.bukkit.command.CommandSender 无法发送消息!")
return
}
var args = Array.prototype.slice.call(arguments, 1);
sender.sendMessage(console.prefix + args.join(' '));

View File

@ -7,6 +7,7 @@
var sender = arguments[0];
if (!(sender instanceof org.spongepowered.api.command.CommandSource)) {
this.error("第一个参数未实现 org.spongepowered.api.command.CommandSource 无法发送消息!")
return
}
var args = Array.prototype.slice.call(arguments, 1);
sender.sendMessage(Text.of(console.prefix + args.join(' ')));