new layer list update strategy

This commit is contained in:
Davide Fantino 2022-11-18 13:12:11 +01:00
parent be290fef92
commit 9fb426b263

View File

@ -780,16 +780,18 @@ export default class MapVote extends DiscordBasePlugin {
} }
async updateLayerList() { async updateLayerList() {
Layers.layers = []; // Layers.layers = [];
this.verbose(1, 'Pulling [All For One] layer list...'); this.verbose(1, 'Pulling [All For One] layer list...');
const response = await axios.get( 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) { 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');
} }
} }