diff --git a/src/components/map/marker/PlayerMarker.vue b/src/components/map/marker/PlayerMarker.vue index 451c024..ebc74ca 100644 --- a/src/components/map/marker/PlayerMarker.vue +++ b/src/components/map/marker/PlayerMarker.vue @@ -48,7 +48,6 @@ export default defineComponent({ //The player marker marker = new PlayerMarker(props.player, { - showSkin: componentSettings.value!.showSkins, imageSize: componentSettings.value!.imageSize, showHealth: componentSettings.value!.showHealth, showArmor: componentSettings.value!.showArmor, diff --git a/src/index.d.ts b/src/index.d.ts index 9f8004c..7867cbf 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -321,7 +321,6 @@ interface LiveAtlasPlayerMarkerConfig { layerName: string; layerPriority: number; imageSize: LiveAtlasPlayerImageSize; - showSkins: boolean; showHealth: boolean; showArmor: boolean; } diff --git a/src/leaflet/icon/PlayerIcon.ts b/src/leaflet/icon/PlayerIcon.ts index c35dbc5..16a475e 100644 --- a/src/leaflet/icon/PlayerIcon.ts +++ b/src/leaflet/icon/PlayerIcon.ts @@ -28,7 +28,6 @@ playerImage.className = 'player__icon'; export interface PlayerIconOptions extends BaseIconOptions { imageSize: LiveAtlasPlayerImageSize, - showSkin: boolean, showHealth: boolean, showArmor: boolean, } @@ -68,16 +67,17 @@ export class PlayerIcon extends Layer implements Icon { this._playerName = document.createElement('span'); this._playerName.className = 'player__name'; - this._playerImage = playerImage.cloneNode() as HTMLImageElement; - this._playerImage.height = this._playerImage.width = getImagePixelSize(this.options.imageSize); + if (this.options.imageSize != 'none') { + this._playerImage = playerImage.cloneNode() as HTMLImageElement; + this._playerImage.height = this._playerImage.width = getImagePixelSize(this.options.imageSize); - if (this.options.showSkin) { getMinecraftHead(this._player, this.options.imageSize).then(head => { this._playerImage!.src = head.src; }).catch(() => {}); + + this._playerInfo.appendChild(this._playerImage); } - this._playerInfo.appendChild(this._playerImage); this._playerInfo.appendChild(this._playerName); if (this.options.showHealth) { diff --git a/src/leaflet/marker/PlayerMarker.ts b/src/leaflet/marker/PlayerMarker.ts index ed790fd..2ebe9ae 100644 --- a/src/leaflet/marker/PlayerMarker.ts +++ b/src/leaflet/marker/PlayerMarker.ts @@ -21,7 +21,6 @@ import {watch} from "@vue/runtime-core"; import {WatchStopHandle} from "vue"; export interface PlayerMarkerOptions extends MarkerOptions { - showSkin: boolean, imageSize: LiveAtlasPlayerImageSize, showHealth: boolean, showArmor: boolean, @@ -40,7 +39,6 @@ export class PlayerMarker extends Marker { this._PlayerIcon = options.icon = new PlayerIcon(player, { imageSize: options.imageSize, - showSkin: options.showSkin, showHealth: options.showHealth, showArmor: options.showArmor, }); diff --git a/src/providers/Pl3xmapMapProvider.ts b/src/providers/Pl3xmapMapProvider.ts index 783545a..5611e87 100644 --- a/src/providers/Pl3xmapMapProvider.ts +++ b/src/providers/Pl3xmapMapProvider.ts @@ -94,15 +94,15 @@ export default class Pl3xmapMapProvider extends MapProvider { if(worldResponse.player_tracker?.enabled) { const health = !!worldResponse.player_tracker?.nameplates?.show_health, - armor = !!worldResponse.player_tracker?.nameplates?.show_armor; + armor = !!worldResponse.player_tracker?.nameplates?.show_armor, + images = !!worldResponse.player_tracker?.nameplates?.show_heads; worldConfig.components.playerMarkers = { grayHiddenPlayers: true, hideByDefault: !!worldResponse.player_tracker?.default_hidden, layerName: worldResponse.player_tracker?.label || '', layerPriority: worldResponse.player_tracker?.priority, - imageSize: health && armor ? 'large' : 'small', - showSkins: true, + imageSize: images ? (health && armor ? 'large' : 'small') : 'none', showHealth: health, showArmor: armor, } diff --git a/src/util/dynmap.ts b/src/util/dynmap.ts index a036e5d..5cd8599 100644 --- a/src/util/dynmap.ts +++ b/src/util/dynmap.ts @@ -22,7 +22,7 @@ import { LiveAtlasComponentConfig, LiveAtlasDimension, LiveAtlasLine, - LiveAtlasMarker, + LiveAtlasMarker, LiveAtlasPlayerImageSize, LiveAtlasServerConfig, LiveAtlasServerMessageConfig, LiveAtlasWorldDefinition @@ -139,6 +139,7 @@ export function buildComponents(response: any): LiveAtlasComponentConfig { (response.components || []).forEach((component: any) => { const type = component.type || "unknown"; + let imageSize: LiveAtlasPlayerImageSize = 'large'; switch (type) { case "markers": @@ -149,23 +150,24 @@ export function buildComponents(response: any): LiveAtlasComponentConfig { break; case "playermarkers": + if(!component.showplayerfaces) { + imageSize = 'none'; + } else if(component.smallplayerfaces) { + imageSize = 'small'; + } else if(component.showplayerbody) { + imageSize = 'body'; + } + components.playerMarkers = { grayHiddenPlayers: response.grayplayerswhenhidden || false, hideByDefault: component.hidebydefault || false, layerName: component.label || "Players", layerPriority: component.layerprio || 0, - showSkins: component.showplayerfaces || false, - imageSize: 'large', + imageSize, showHealth: component.showplayerhealth || false, showArmor: component.showplayerhealth || false, } - if(component.smallplayerfaces) { - components.playerMarkers.imageSize = 'small' - } else if(component.showplayerbody) { - components.playerMarkers.imageSize = 'body'; - } - break; case "coord":