mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-25 08:23:13 +09:00
Fixed error related to getting playerCount
This commit is contained in:
1 parent
ce13ad50e0
commit
9b6f8cf652
2 files changed
+8
-4
No files matched your search
@@ -591,10 +591,10 @@ async function instanceManagement(instanceconfig) {
|
|||||||
// require plugin class and execute it
|
// require plugin class and execute it
|
||||||
let pluginClass = require(path.resolve(pluginConfig.pluginPath, "index.js"));
|
let pluginClass = require(path.resolve(pluginConfig.pluginPath, "index.js"));
|
||||||
plugins[i] = new pluginClass(combinedConfig, async function(data, callback){
|
plugins[i] = new pluginClass(combinedConfig, async function(data, callback){
|
||||||
if(data.toString('utf8')[0] != "/") {
|
if(data && data.toString('utf8')[0] != "/") {
|
||||||
log(data.toString('utf8'));
|
log(data.toString('utf8'));
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else if (data && data.toString('utf8')[0] == "/"){
|
||||||
return messageInterface(data.toString('utf8'), callback);
|
return messageInterface(data.toString('utf8'), callback);
|
||||||
}
|
}
|
||||||
}, { // extra functions to pass in object. Should have done it like this from the start, but won't break backwards compat.
|
}, { // extra functions to pass in object. Should have done it like this from the start, but won't break backwards compat.
|
||||||
@@ -670,7 +670,11 @@ async function instanceManagement(instanceconfig) {
|
|||||||
publicIP: config.publicIP, // IP of the server should be global for all instances, so we pull that straight from the config
|
publicIP: config.publicIP, // IP of the server should be global for all instances, so we pull that straight from the config
|
||||||
mods:modHashes,
|
mods:modHashes,
|
||||||
instanceName: instance,
|
instanceName: instance,
|
||||||
playerCount:playerCount.replace(/(\r\n\t|\n|\r\t)/gm, ""),
|
}
|
||||||
|
if(playerCount){
|
||||||
|
payload.playerCount = playerCount.replace(/(\r\n\t|\n|\r\t)/gm, "");
|
||||||
|
} else {
|
||||||
|
payload.playerCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function callback(err, mac) {
|
function callback(err, mac) {
|
||||||
|
|||||||
+1
-1
@@ -50,7 +50,7 @@
|
|||||||
"mkdirp-promise": "^5.0.1",
|
"mkdirp-promise": "^5.0.1",
|
||||||
"moment": "^2.22.2",
|
"moment": "^2.22.2",
|
||||||
"ncp": "^2.0.0",
|
"ncp": "^2.0.0",
|
||||||
"needle": "^2.2.1",
|
"needle": "^2.2.4",
|
||||||
"node-factorio-api": "^0.3.1-alpha",
|
"node-factorio-api": "^0.3.1-alpha",
|
||||||
"node-forge": "^0.7.1",
|
"node-forge": "^0.7.1",
|
||||||
"prom-client": "^10.2.3",
|
"prom-client": "^10.2.3",
|
||||||
|
|||||||
Reference in new issue
Block a user