From efe67e0736bbdd4b70cc83dbf39cd4b0a98df216 Mon Sep 17 00:00:00 2001 From: d0by Date: Fri, 3 Dec 2021 16:42:54 +0100 Subject: [PATCH] Fixes --- .../eu/decentsoftware/holograms/api/DecentHolograms.java | 1 + .../holograms/api/holograms/HologramManager.java | 4 ++++ .../holograms/api/holograms/offset/OffsetListener.java | 2 +- .../decentsoftware/holograms/api/player/PlayerListener.java | 6 ------ 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/eu/decentsoftware/holograms/api/DecentHolograms.java b/src/main/java/eu/decentsoftware/holograms/api/DecentHolograms.java index 0522095d..f3b2e20d 100644 --- a/src/main/java/eu/decentsoftware/holograms/api/DecentHolograms.java +++ b/src/main/java/eu/decentsoftware/holograms/api/DecentHolograms.java @@ -64,6 +64,7 @@ protected void enable() { PluginManager pm = Bukkit.getPluginManager(); pm.registerEvents(new PlayerListener(this), plugin); + pm.registerEvents(hologramManager.getOffsetListener(), plugin); // Setup metrics Metrics metrics = new Metrics(plugin, 12797); diff --git a/src/main/java/eu/decentsoftware/holograms/api/holograms/HologramManager.java b/src/main/java/eu/decentsoftware/holograms/api/holograms/HologramManager.java index b323c09e..becf2c3c 100644 --- a/src/main/java/eu/decentsoftware/holograms/api/holograms/HologramManager.java +++ b/src/main/java/eu/decentsoftware/holograms/api/holograms/HologramManager.java @@ -34,6 +34,10 @@ public HologramManager() { S.sync(this::reload); } + public OffsetListener getOffsetListener() { + return offsetListener; + } + @Override public void tick() { for (Hologram hologram : Hologram.getCachedHolograms()) { diff --git a/src/main/java/eu/decentsoftware/holograms/api/holograms/offset/OffsetListener.java b/src/main/java/eu/decentsoftware/holograms/api/holograms/offset/OffsetListener.java index 91929d22..28cb3bf4 100644 --- a/src/main/java/eu/decentsoftware/holograms/api/holograms/offset/OffsetListener.java +++ b/src/main/java/eu/decentsoftware/holograms/api/holograms/offset/OffsetListener.java @@ -78,7 +78,7 @@ public void updateOffsets(Player player, Hologram hologram) { Location prevLocation = line.getLocation(); OffsetCalculator.Loc2D result = OffsetCalculator.calculateOffSet( new OffsetCalculator.Loc2D(playerLoc.getX(), playerLoc.getZ()), - new OffsetCalculator.Loc2D(-line.getOffsetX(), -line.getOffsetZ()), + new OffsetCalculator.Loc2D(line.getOffsetX(), line.getOffsetZ()), new OffsetCalculator.Loc2D(holoLoc.getX(), holoLoc.getZ()) ); Location finalOffsetLoc = new Location(holoLoc.getWorld(), result.getX(), line.getLocation().getY(), result.getZ()); diff --git a/src/main/java/eu/decentsoftware/holograms/api/player/PlayerListener.java b/src/main/java/eu/decentsoftware/holograms/api/player/PlayerListener.java index 12c6f957..f37ecf34 100644 --- a/src/main/java/eu/decentsoftware/holograms/api/player/PlayerListener.java +++ b/src/main/java/eu/decentsoftware/holograms/api/player/PlayerListener.java @@ -40,10 +40,4 @@ public void onRespawn(PlayerRespawnEvent e) { Hologram.getCachedHolograms().forEach(hologram -> hologram.hide(player)); } -// @EventHandler -// public void onTeleport(PlayerChangedWorldEvent e) { -// Player player = e.getPlayer(); -// Hologram.getCachedHolograms().forEach(hologram -> hologram.hide(player)); -// } - }