Fix issue #220
This commit is contained in:
parent
d0e919db19
commit
16c3c6b01f
3 changed files with 10 additions and 4 deletions
|
@ -5345,7 +5345,7 @@ all of Javascript's Array goodness.
|
||||||
#### Example
|
#### Example
|
||||||
|
|
||||||
var utils = require('utils');
|
var utils = require('utils');
|
||||||
var worlds = utils.array(server.worlds);
|
var worlds = utils.array(server.worldManager.getAllWorlds());
|
||||||
|
|
||||||
### utils.players() function
|
### utils.players() function
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ at('06:00', wakeup, null, false);
|
||||||
function at(time24hr, callback, pWorlds, repeat) {
|
function at(time24hr, callback, pWorlds, repeat) {
|
||||||
var timeParts = time24hr.split( ':' );
|
var timeParts = time24hr.split( ':' );
|
||||||
var timeMins = (timeParts[0] * 60) + (timeParts[1] * 1);
|
var timeMins = (timeParts[0] * 60) + (timeParts[1] * 1);
|
||||||
if (!pWorlds || typeof pWorlds == 'undefined' ) {
|
if (!pWorlds || pWorlds === undefined ) {
|
||||||
pWorlds = utils.worlds();
|
pWorlds = utils.worlds();
|
||||||
}
|
}
|
||||||
if (repeat === undefined){
|
if (repeat === undefined){
|
||||||
|
@ -68,8 +68,8 @@ var atTasks = {};
|
||||||
function atMonitorFactory(world){
|
function atMonitorFactory(world){
|
||||||
var worldName = ''+ world.name;
|
var worldName = ''+ world.name;
|
||||||
var lastRun = null;
|
var lastRun = null;
|
||||||
return function(){
|
return function atMonitorForWorld(){
|
||||||
var timeMins = utils.getTime24(world);
|
var timeMins = utils.time24(world);
|
||||||
if (timeMins === lastRun){
|
if (timeMins === lastRun){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -120,3 +120,5 @@ addUnloadHandler(function(){
|
||||||
clearInterval(atInterval);
|
clearInterval(atInterval);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
module.exports = at;
|
||||||
|
|
4
src/main/js/plugins/at.js
Normal file
4
src/main/js/plugins/at.js
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
// ensure that the at world-load event handlers are
|
||||||
|
// registered early in server startup
|
||||||
|
var at = require('at');
|
||||||
|
// nothing more needed.
|
Reference in a new issue