Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added included plugin named delay #95

Merged
merged 3 commits into from Apr 27, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
57 changes: 57 additions & 0 deletions BangCommands/Included/delay.js
@@ -0,0 +1,57 @@
/*
author: mrjvs
*/

var delay = {};


delay.Install = function (smelt) {
smelt.addSupportModule("delay_support_module.mcc");
switch(smelt.settings.Output.MinecraftVersion)
{
case "1.9":
case "1.10":
smelt.addSupportModule("smelt-for-1.9.mcc");
break;
case "1.11":
default:
smelt.addSupportModule("smelt-for-1.11.mcc");
break;
}
};


delay.HowTo = function () {
var usage = "\n Usage:\n\n !delay ticks conditional command\n Ticks, int: how many ticks delay it before the command runs.\n Conditional, boolean: if the delay chain command block needs to be conditional or not.\n Command, string: what command to delay.\n\n Example: !delay 20 true /say hello there\n";
return usage;
}

delay.Execute = function(smelt) {

function makeid() {
var text = "",
possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
i = 0;
for (i=0; i < 5; i++ )
text += possible.charAt(Math.floor(Math.random() * possible.length));

return text;
}

var markerId = makeid();
var command = smelt.args[3];

for (var i = 4; i < smelt.args.length; i++) {
command += " " + smelt.args[i];
}

var options = {};
options["type"] = "chain";
options["auto"] = true;
options["conditional"] = smelt.args[2];
smelt.addCommandBlock("execute @e[tag=" + markerId + ",type=area_effect_cloud,c=1] ~ ~ ~ summon minecraft:area_effect_cloud ~ ~ ~ {Tags:[\"aecDelay\"],Particle:\"take\",Age:-" + smelt.args[1] + "}", options);
smelt.addCommandBlock(command,{auto:false,type:"impulse",conditional:false,markerTag:markerId});

};

module.exports = delay;