diff --git a/client.js b/client.js index 25eaccb8..e1c1f44a 100644 --- a/client.js +++ b/client.js @@ -11,8 +11,9 @@ var hashFiles = require('hash-files'); // require config.json var config = require('./config'); + // Functions -var deleteFolderRecursive = function (path) { +function deleteFolderRecursive(path) { if (fs.existsSync(path)) { fs.readdirSync(path).forEach(function (file, index) { var curPath = path + "/" + file; @@ -26,11 +27,50 @@ var deleteFolderRecursive = function (path) { } }; -function getDirectories(srcpath) { - return fs.readdirSync(srcpath).filter(function (file) { - return fs.statSync(path.join(srcpath, file)).isDirectory(); - }); +// function to handle sending commands into the game +function messageInterface(command, callback) { + if(client && client.exec && typeof client.exec == "function") { + try { + client.exec(command, callback); + } catch (err) { + console.log(err); + callback(err); + } + } } + +// load plugins and execute onLoad event +let pluginDirectories = getDirectories("./sharedPlugins/"); +let plugins = []; +for(i=0; i