mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-19 23:33:13 +09:00
Changed usage of globals, worked around edge cases
This commit is contained in:
1 parent
f9ef2ebbe1
commit
98f801e244
11 files changed
+124
-62
No files matched your search
@@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
const fs = require("fs").promises;
|
||||
const fs = require("fs-extra");
|
||||
const path = require("path");
|
||||
|
||||
const libPlugin = require("@clusterio/lib/plugin");
|
||||
@@ -50,7 +50,8 @@ class MasterPlugin extends libPlugin.BaseMasterPlugin {
|
||||
this.logger.verbose(`Downloading inventory for ${message.data.player_name}`);
|
||||
return {
|
||||
player_name: message.data.player_name,
|
||||
inventory: this.inventories[message.data.player_name],
|
||||
inventory: this.inventories[message.data.player_name] || {},
|
||||
new_player: !this.inventories[message.data.player_name],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -63,7 +64,7 @@ class MasterPlugin extends libPlugin.BaseMasterPlugin {
|
||||
let inventories = Object.keys(this.inventories)
|
||||
.map(name => ({
|
||||
name,
|
||||
length: this.inventories[name].length,
|
||||
length: JSON.stringify(this.inventories[name]).length,
|
||||
}))
|
||||
.sort((a, b) => a.stringified.length - b.stringified.length);
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user