From 165afd762c1b144f605051cb3d0cf78f8d9ad426 Mon Sep 17 00:00:00 2001 From: James Lyne Date: Tue, 22 Dec 2020 13:15:59 +0000 Subject: [PATCH] Use player account for skin URL. Fixes #2 --- src/leaflet/icon/PlayerIcon.ts | 2 +- src/util.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/leaflet/icon/PlayerIcon.ts b/src/leaflet/icon/PlayerIcon.ts index 5f602cf..a064f47 100644 --- a/src/leaflet/icon/PlayerIcon.ts +++ b/src/leaflet/icon/PlayerIcon.ts @@ -103,7 +103,7 @@ export class PlayerIcon extends DivIcon { Util.getMinecraftHead(player, size).then(head => { this._playerImage!.src = head.src; - }); + }).catch(() => {}); } else { this._playerImage = noSkinImage.cloneNode(false) as HTMLImageElement; } diff --git a/src/util.ts b/src/util.ts index 2d65c2c..6cc5c5f 100644 --- a/src/util.ts +++ b/src/util.ts @@ -50,12 +50,12 @@ export default { resolve(faceImage); }; - faceImage.onerror = function() { - console.warn('Failed to retrieve face of "', player, '" with size "', size, '"!'); - reject(); + faceImage.onerror = function(e) { + console.warn(`Failed to retrieve face of ${player.account} with size ${size}!`); + reject(e); }; - const src = (size === 'body') ? `faces/body/${player.name}.png` :`faces/${size}x${size}/${player.name}.png`; + const src = (size === 'body') ? `faces/body/${player.account}.png` :`faces/${size}x${size}/${player.account}.png`; faceImage.src = this.concatURL(window.config.url.markers, src); }); },