mirror of
https://github.com/BlueMap-Minecraft/BlueMapWeb.git
synced 2025-02-19 19:31:41 +01:00
Moving live-player-endpoint
This commit is contained in:
parent
889d3cf94c
commit
25c4658de4
@ -40,8 +40,6 @@ export class PlayerMarker extends Marker {
|
||||
this.data.playerUuid = playerUuid;
|
||||
this.data.name = playerUuid;
|
||||
|
||||
this.data.world = "?";
|
||||
|
||||
this.elementObject = new CSS2DObject(htmlToElement(`
|
||||
<div id="bm-marker-${this.data.id}" class="bm-marker-${this.data.type}">
|
||||
<img src="assets/playerheads/${this.data.playerUuid}.png" alt="playerhead" draggable="false">
|
||||
@ -89,7 +87,7 @@ export class PlayerMarker extends Marker {
|
||||
* @typedef PlayerLike {{
|
||||
* uuid: string,
|
||||
* name: string,
|
||||
* world: string,
|
||||
* foreign: boolean,
|
||||
* position: {x: number, y: number, z: number},
|
||||
* rotation: {yaw: number, pitch: number, roll: number}
|
||||
* }}
|
||||
@ -138,8 +136,7 @@ export class PlayerMarker extends Marker {
|
||||
this.playerNameElement.innerHTML = name;
|
||||
|
||||
// update world
|
||||
this.data.world = markerData.world || "?";
|
||||
|
||||
this.data.foreign = markerData.foreign;
|
||||
}
|
||||
|
||||
dispose() {
|
||||
|
@ -33,15 +33,12 @@ export class PlayerMarkerManager extends MarkerManager {
|
||||
* @constructor
|
||||
* @param markerScene {THREE.Scene} - The scene to which all markers will be added
|
||||
* @param playerDataUrl {string} - The marker file from which this manager updates its markers
|
||||
* @param worldId {string} - The worldId of the world for which the markers should be loaded
|
||||
* @param events {EventTarget}
|
||||
*/
|
||||
constructor(markerScene, playerDataUrl, worldId, events = null) {
|
||||
constructor(markerScene, playerDataUrl, events = null) {
|
||||
super(markerScene, playerDataUrl, events);
|
||||
Object.defineProperty(this, 'isPlayerMarkerManager', {value: true});
|
||||
|
||||
this.worldId = worldId;
|
||||
|
||||
this.getPlayerMarkerSet();
|
||||
}
|
||||
|
||||
@ -105,8 +102,8 @@ export class PlayerMarkerManager extends MarkerManager {
|
||||
// update
|
||||
marker.updateFromData(markerData);
|
||||
|
||||
// hide if wrong world
|
||||
marker.visible = markerData.world === this.worldId;
|
||||
// hide if from different world
|
||||
marker.visible = !markerData.foreign;
|
||||
|
||||
return marker;
|
||||
}
|
||||
@ -127,4 +124,12 @@ export class PlayerMarkerManager extends MarkerManager {
|
||||
return playerMarkerSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param playerUuid {string}
|
||||
* @returns {Marker}
|
||||
*/
|
||||
getPlayerMarker(playerUuid) {
|
||||
return this.markers.get("bm-player-" + playerUuid);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user