This repository has been archived on 2021-07-14. You can view files and clone it, but cannot push or open issues or pull requests.
scriptcraft/src/main/js/plugins/commando/commando-test.js
2016-03-28 15:44:07 +00:00

27 lines
673 B
JavaScript

/*
A test of the commando plugin.
Adds a new `/js-time` command with 4 possible options: Dawn, Midday, Dusk, Midnight
*/
if (__plugin.canary){
console.warn('commando-test not yet supported in CanaryMod');
return;
}
var commando = require('./commando').commando,
times = ['Dawn','Midday','Dusk','Midnight'];
commando( 'js-time' , function( params, sender ) {
var time = ''+params[0].toLowerCase(),
i = 0;
if ( sender.location ) {
for ( ; i < 4; i++ ) {
if ( times[i].toLowerCase() == time ) {
sender.location.world.setTime( i * 6000 );
break;
}
}
} else {
echo( sender, 'This command only works in-world');
}
},times);