diff --git a/src/api.ts b/src/api.ts index 77690f6..5cc1982 100644 --- a/src/api.ts +++ b/src/api.ts @@ -43,6 +43,7 @@ function buildServerConfig(response: any): DynmapServerConfig { return { version: response.dynmapversion || '', allowChat: response.allowwebchat || false, + grayHiddenPlayers: response.grayplayerswhenhidden || false, chatRequiresLogin: response['webchat-requires-login'] || false, chatInterval: response['webchat-interval'] || 5, defaultMap: response.defaultmap || undefined, @@ -488,17 +489,20 @@ export default { const players: Set = new Set(); (response.players || []).forEach((player: any) => { + const world = player.world && player.world !== '-some-other-bogus-world-' ? player.world : undefined; + players.add({ account: player.account || "", health: player.health || 0, armor: player.armor || 0, name: player.name ? sanitizer.sanitize(player.name) : "Steve", sort: player.sort || 0, + hidden: !world, location: { x: player.x || 0, y: player.y || 0, z: player.z || 0, - world: player.world || undefined, + world: world, } }); }); diff --git a/src/components/Map.vue b/src/components/Map.vue index b1ad265..aeb802e 100644 --- a/src/components/Map.vue +++ b/src/components/Map.vue @@ -232,6 +232,11 @@ export default defineComponent({ return; } + if(player.hidden) { + console.warn(`Cannot follow ${player.name}. Player is hidden from the map.`); + return; + } + if(!player.location.world) { console.warn(`Cannot follow ${player.name}. Player isn't in a known world.`); return; diff --git a/src/components/sidebar/FollowTarget.vue b/src/components/sidebar/FollowTarget.vue index 4475e43..ae9eba9 100644 --- a/src/components/sidebar/FollowTarget.vue +++ b/src/components/sidebar/FollowTarget.vue @@ -18,9 +18,12 @@