Merge branch 'base'

This commit is contained in:
Blue (Lukas Rieger) 2020-08-16 19:09:00 +02:00
commit eab962cdac
4 changed files with 14 additions and 5 deletions

View File

@ -70,7 +70,7 @@ public void update(File storageFolder) {
BufferedImage head = createHead(skin);
ImageIO.write(head, "png", new File(storageFolder, uuid.toString() + ".png"));
} catch (ExecutionException | TimeoutException e) {
Logger.global.logWarning("Failed to load player-skin from mojang-servers: " + e);
Logger.global.logDebug("Failed to load player-skin from mojang-servers: " + e);
} catch (IOException e) {
Logger.global.logError("Failed to write player-head image!", e);
} catch (InterruptedException ignore) {}

View File

@ -2,6 +2,8 @@ import $ from 'jquery';
import Marker from "./Marker";
import {CSS2DObject} from "./CSS2DRenderer";
import STEVE from "../../../assets/playerheads/steve.png";
export default class PlayerMarker extends Marker {
constructor(blueMap, markerSet, markerData, playerUuid, worldUuid) {
@ -21,7 +23,7 @@ export default class PlayerMarker extends Marker {
this.blueMap.updateFrame = true;
if (!this.renderObject){
let iconElement = $(`<div class="marker-player"><img src="assets/playerheads/${this.player}.png" onerror="this.onerror=null;this.src='assets/playerheads/steve.png';"><div class="nameplate">${this.label}</div></div>`);
let iconElement = $(`<div class="marker-player"><img src="assets/playerheads/${this.player}.png" onerror="this.onerror=null;this.src='${STEVE}';"><div class="nameplate">${this.label}</div></div>`);
iconElement.find("img").click(this.onClick);
this.renderObject = new CSS2DObject(iconElement[0]);

View File

@ -50,6 +50,7 @@ export default class PlayerMarkerSet {
updateWith(liveData){
this.marker.forEach(marker => {
marker.nowOnline = false;
marker.worldChanged = false;
});
for(let i = 0; i < liveData.players.length; i++){
@ -72,11 +73,15 @@ export default class PlayerMarkerSet {
marker.nowOnline = true;
marker.position = new Vector3(player.position.x, player.position.y + 1.5, player.position.z);
if (marker.world !== player.world) {
marker.world = player.world;
marker.worldChanged = true;
}
marker.updatePosition();
}
this.marker.forEach(marker => {
if (marker.nowOnline !== marker.online){
if (marker.nowOnline !== marker.online || marker.worldChanged){
marker.online = marker.nowOnline;
marker.setVisible(this.visible);
}

View File

@ -189,6 +189,7 @@ public File getConfigFolder() {
return new File("config/bluemap");
}
@SubscribeEvent
public void onPlayerJoin(PlayerLoggedInEvent evt) {
PlayerEntity playerInstance = evt.getPlayer();
if (!(playerInstance instanceof ServerPlayerEntity)) return;
@ -198,6 +199,7 @@ public void onPlayerJoin(PlayerLoggedInEvent evt) {
onlinePlayerList.add(player);
}
@SubscribeEvent
public void onPlayerLeave(PlayerLoggedOutEvent evt) {
PlayerEntity player = evt.getPlayer();
if (!(player instanceof ServerPlayerEntity)) return;