[pull] master from Thomas-Smyth:master (#31)

* ESLint & README Generation

* SquadJS 2.0.2-beta1

* SquadJS v2.0.2-beta1

* Fix bug in seeding plugin

* try/catch axios request + set pulled flag

Wraps axios request with try/catch for cases where we do not get a response or get an error

sets `this.pulled` flag after receiving and parsing response

* ESLint & README Generation

* Intervalled Broadcasts on the line 47 causes a crash because of undefined. The code should have been this.options.broadcasts instead of this.broadcasts

* yarn build-all

* ESLint & README Generation

* prefer throwing error to catch

- rm try/catch
prefer to throw error on failure to fetch layer information as it is critical to the apps operation

+add log line to indicate a force update

+increase verboseness of already pulled log as it is not critical info

* Added toLowerCase to address case sensitive config

* ESLint & README Generation

* SquadJS v2.0.2 Release

Co-authored-by: Thomas Smyth <thomas.smyth3141@gmail.com>
Co-authored-by: SeanWalsh95 <SeanWalsh95@users.noreply.github.com>
Co-authored-by: Dusan Milutinovic <bgteam@live.com>
Co-authored-by: got2bhockey <you@example.com>
This commit is contained in:
pull[bot] 2021-02-26 02:50:43 +00:00 committed by GitHub
parent cbcde90b8c
commit 7c1c29a00f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 6 deletions

View File

@ -1,6 +1,6 @@
{
"name": "SquadJS",
"version": "2.0.1",
"version": "2.0.2",
"repository": "https://github.com/Thomas-Smyth/SquadJS.git",
"author": "Thomas Smyth <https://github.com/Thomas-Smyth>",
"license": "BSL-1.0",

View File

@ -13,22 +13,26 @@ class Layers {
async pull(force = false) {
if (this.pulled && !force) {
Logger.verbose('Layers', 1, 'Already pulled layers.');
Logger.verbose('Layers', 2, 'Already pulled layers.');
return;
}
if (force) Logger.verbose('Layers', 1, 'Forcing update to layer information...');
this.layers = [];
Logger.verbose('Layers', 1, 'Pulling layers...');
const response = await axios.get(
'https://raw.githubusercontent.com/Squad-Wiki-Editorial/squad-wiki-pipeline-map-data/dev/completed_output/2.0/finished_2.0.json'
);
this.layers = [];
for (const layer of response.data.Maps) {
this.layers.push(new Layer(layer));
}
Logger.verbose('Layers', 1, `Pulled ${this.layers.length} layers.`);
this.pulled = true;
return this.layers;
}

View File

@ -38,7 +38,7 @@ export default class ChatCommands extends BasePlugin {
async mount() {
for (const command of this.options.commands) {
this.server.on(`CHAT_COMMAND:${command.command}`, async (data) => {
this.server.on(`CHAT_COMMAND:${command.command.toLowerCase()}`, async (data) => {
if (command.ignoreChats.includes(data.chat)) return;
if (command.type === 'broadcast') {

View File

@ -44,6 +44,6 @@ export default class IntervalledBroadcasts extends BasePlugin {
async broadcast() {
await this.server.rcon.broadcast(this.options.broadcasts[0]);
this.broadcasts.push(this.options.broadcasts.shift());
this.options.broadcasts.push(this.options.broadcasts.shift());
}
}

View File

@ -63,7 +63,10 @@ export default class SeedingMode extends BasePlugin {
}
async broadcast() {
if (this.server.a2sPlayerCount !== 0 && this.server.a2sPlayerCount < this.options.liveThreshold)
if (
this.server.a2sPlayerCount !== 0 &&
this.server.a2sPlayerCount < this.options.seedingThreshold
)
await this.server.rcon.broadcast(this.options.seedingMessage);
else if (
this.server.a2sPlayerCount !== 0 &&