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

23 lines
577 B
JavaScript

/*
A test of the commando plugin.
Adds a new `/js-time` command with 4 possible options: Dawn, Midday, Dusk, Midnight
*/
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.toLowerCase() == time ) {
sender.location.world.setTime( i * 6000 );
break;
}
}
} else {
sender.sendMessage('This command only works in-world');
}
},times);