1
0
Fork 0
forked from CRSS/Website

fix: a few fixes to players

This commit is contained in:
TheClashFruit 2023-11-17 22:33:58 +01:00
parent 1aa2bdad9d
commit eeed8bbf58
Signed by: TheClashFruit
GPG key ID: 09BB24C34C2F3204

View file

@ -86,6 +86,7 @@
}; };
let overlayMaps = { let overlayMaps = {
"Players": playerMarkers,
"Miscellaneous Markers": miscMarkers, "Miscellaneous Markers": miscMarkers,
"Markers in RoP": ropMarkers, "Markers in RoP": ropMarkers,
"Markers in DRoR": rorMarkers, "Markers in DRoR": rorMarkers,
@ -119,9 +120,10 @@
mappedPlayers[player.uniqueId] = playerMarker; mappedPlayers[player.uniqueId] = playerMarker;
} else { } else {
const playerIcon = L.icon({ const playerIcon = L.icon({
iconUrl: `https://mc-heads.net/avatar/${player.displayName}/24`, iconUrl: `https://mc-heads.net/avatar/${player.displayName}`,
iconSize: [24, 24], iconSize: [28, 28],
iconAnchor: [12, 0] iconAnchor: [14, 14],
popupAnchor: [0, -14]
}); });
@ -133,6 +135,14 @@
mappedPlayers[player.uniqueId] = marker; mappedPlayers[player.uniqueId] = marker;
} }
} }
for (const [uniqueId, playerMarker] of Object.entries(mappedPlayers)) {
if(!players.find(p => p.uniqueId === uniqueId)) {
playerMarkers.removeLayer(playerMarker);
delete mappedPlayers[uniqueId];
}
}
} }
fetch('https://crss.blurryface.xyz/api/v1/players') fetch('https://crss.blurryface.xyz/api/v1/players')