diff --git a/src/lib/command.js b/src/lib/command.js index 8557368..0532e88 100644 --- a/src/lib/command.js +++ b/src/lib/command.js @@ -37,9 +37,7 @@ class Command { } } - var val = res[0].params.action(res[1]) - if (val && val.catch) res = await val.catch((err)=> setTimeout(() => {throw err;},0)); - else res = val; + res = await com.params.action(pars); if(res) return '' + res; } else { diff --git a/src/lib/plugins/commands.js b/src/lib/plugins/commands.js index 524c32c..c18e90c 100644 --- a/src/lib/plugins/commands.js +++ b/src/lib/plugins/commands.js @@ -117,7 +117,7 @@ module.exports.player=function(player, serv) { if (res) player.chat(serv.color.red + res); } catch(err) { - if (err instanceof UserError) player.chat('Error: ' + err.message); + if (err instanceof UserError) player.chat(serv.color.red + 'Error: ' + err.message); else setTimeout(() => {throw err;}, 0); } } diff --git a/src/lib/plugins/tp.js b/src/lib/plugins/tp.js index ac230f8..f27bba9 100644 --- a/src/lib/plugins/tp.js +++ b/src/lib/plugins/tp.js @@ -16,7 +16,7 @@ module.exports.player = (player, serv) => { if(args.length === 2) { let entities_from = player.selectorString(args[0]); let entity_to = player.selectorString(args[1]); - if(entity_to.length==0) throw new UserError("at least one target"); + if(entity_to.length==0) throw new UserError('Invalid target'); entity_to = entity_to[0]; entities_from.forEach(e => e.teleport(entity_to.position.scaled(1/32)));