mirror of
https://github.com/AsgardEternal/squad-js-map-vote.git
synced 2025-01-23 23:03:51 -06:00
new layer list update strategy
This commit is contained in:
parent
be290fef92
commit
9fb426b263
12
mapvote.js
12
mapvote.js
@ -573,12 +573,12 @@ export default class MapVote extends DiscordBasePlugin {
|
||||
|
||||
function getTranslation(t) {
|
||||
if (translations[ t.faction ]) return translations[ t.faction ]
|
||||
else if(t.faction){
|
||||
else if (t.faction) {
|
||||
const f = t.faction.split(' ');
|
||||
let fTag = "";
|
||||
f.forEach((e) => { fTag += e[ 0 ] });
|
||||
return fTag.toUpperCase();
|
||||
}else return "Unknown"
|
||||
} else return "Unknown"
|
||||
}
|
||||
}
|
||||
|
||||
@ -780,16 +780,18 @@ export default class MapVote extends DiscordBasePlugin {
|
||||
}
|
||||
|
||||
async updateLayerList() {
|
||||
Layers.layers = [];
|
||||
// Layers.layers = [];
|
||||
|
||||
this.verbose(1, 'Pulling [All For One] layer list...');
|
||||
const response = await axios.get(
|
||||
'http://hub.afocommunity.com/api/layers.json'
|
||||
'http://hub.afocommunity.com/api/layers.json', [ 0 ]
|
||||
);
|
||||
|
||||
for (const layer of response.data.Maps) {
|
||||
Layers.layers.push(new Layer(layer));
|
||||
if (!Layers.layers.find((e) => e.layerid == layer.layerid)) Layers.layers.push(new Layer(layer));
|
||||
}
|
||||
|
||||
this.verbose(1, 'Layer list updated');
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user