Skip to content

Commit

Permalink
fixes #139 (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
BitByLogics authored Nov 7, 2024
1 parent ecd561c commit 2bdb22d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/main/java/de/oliver/fancyholograms/HologramManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.google.common.cache.CacheBuilder;
import com.google.common.collect.ImmutableList;
import de.oliver.fancyholograms.api.HologramManager;
import de.oliver.fancyholograms.api.data.DisplayHologramData;
import de.oliver.fancyholograms.api.data.HologramData;
import de.oliver.fancyholograms.api.data.TextHologramData;
import de.oliver.fancyholograms.api.events.HologramsLoadedEvent;
Expand All @@ -14,6 +15,7 @@
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.UnmodifiableView;
import org.joml.Vector3f;

import java.time.Duration;
import java.util.*;
Expand Down Expand Up @@ -299,7 +301,13 @@ public void syncHologramWithNpc(@NotNull final Hologram hologram) {
npc.getData().setShowInTab(false);
npc.updateForAll();

final var location = npc.getData().getLocation().clone().add(0, npc.getEyeHeight() + 0.5, 0);
final var npcScale = npc.getData().getScale();

if(hologram.getData() instanceof DisplayHologramData displayData) {
displayData.setScale(new Vector3f(npcScale));
}

final var location = npc.getData().getLocation().clone().add(0, (npc.getEyeHeight() * npcScale) + (0.5 * npcScale), 0);
hologram.getData().setLocation(location);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void onModify(@NotNull final NpcModifyEvent event) {
final var holograms = this.plugin.getHologramsManager().getHolograms();

switch (event.getModification()) {
case TYPE, LOCATION -> {
case TYPE, LOCATION, SCALE -> {
final var needsToBeUpdated = holograms.stream()
.filter(hologram -> event.getNpc().getData().getName().equals(hologram.getData().getLinkedNpcName()))
.toList();
Expand Down

0 comments on commit 2bdb22d

Please sign in to comment.