Small fixes to commands/tp

This commit is contained in:
DemiPixel 2015-12-11 01:12:59 -08:00 committed by Romain Beaumont
parent e49daf1fcd
commit aeb5f888df
3 changed files with 3 additions and 5 deletions

View file

@ -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 {

View file

@ -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);
}
}

View file

@ -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)));