mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-22 18:45:21 +01:00
Merge branch 'base'
This commit is contained in:
commit
eab962cdac
@ -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) {}
|
||||
|
@ -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]);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user