one_command
Version:
No longer maintained: please use www.npmjs.com/package/smelt-cli
24 lines (19 loc) • 621 B
JavaScript
var util = require("util");
module.exports = function(args, command)
{
var entityTag = args[0];
var objective = args[1];
var axis = args[2];
var max = parseInt(args[3]) || 32;
var axisFormat = "~%d ~ ~";
if(axis == "y")
axisFormat = "~ ~%d ~";
else if(axis == "z")
axisFormat = "~ ~ ~%d";
for(var i = max; i >= 1; i /= 2)
{
i = Math.ceil(i);
command(util.format("tp @e[tag=%s,score_%s_min=%d] " + axisFormat, entityTag, objective, i, i));
command(util.format("scoreboard players remove @e[tag=%s,score_%s_min=%d] %s %d", entityTag, objective, i, objective, i));
}
};