diff --git a/docs/API-Reference.md b/docs/API-Reference.md index 95b3af8..4aebd0f 100644 --- a/docs/API-Reference.md +++ b/docs/API-Reference.md @@ -5345,7 +5345,7 @@ all of Javascript's Array goodness. #### Example var utils = require('utils'); - var worlds = utils.array(server.worlds); + var worlds = utils.array(server.worldManager.getAllWorlds()); ### utils.players() function diff --git a/src/main/js/modules/at.js b/src/main/js/modules/at.js index 25d6270..04851cc 100644 --- a/src/main/js/modules/at.js +++ b/src/main/js/modules/at.js @@ -50,7 +50,7 @@ at('06:00', wakeup, null, false); function at(time24hr, callback, pWorlds, repeat) { var timeParts = time24hr.split( ':' ); var timeMins = (timeParts[0] * 60) + (timeParts[1] * 1); - if (!pWorlds || typeof pWorlds == 'undefined' ) { + if (!pWorlds || pWorlds === undefined ) { pWorlds = utils.worlds(); } if (repeat === undefined){ @@ -68,8 +68,8 @@ var atTasks = {}; function atMonitorFactory(world){ var worldName = ''+ world.name; var lastRun = null; - return function(){ - var timeMins = utils.getTime24(world); + return function atMonitorForWorld(){ + var timeMins = utils.time24(world); if (timeMins === lastRun){ return; } @@ -120,3 +120,5 @@ addUnloadHandler(function(){ clearInterval(atInterval); }); }); + +module.exports = at; diff --git a/src/main/js/plugins/at.js b/src/main/js/plugins/at.js new file mode 100644 index 0000000..f194221 --- /dev/null +++ b/src/main/js/plugins/at.js @@ -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.