mirror of
https://github.com/FancyInnovations/FancyPlugins.git
synced 2025-12-06 07:43:36 +00:00
fancyholograms v3: Ensure hologram world is valid before checking visibility distance
This commit is contained in:
@@ -86,11 +86,15 @@ public class HologramControllerImpl implements HologramController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isWithinVisibilityDistance(@NotNull final Hologram hologram, @NotNull final Player player) {
|
private boolean isWithinVisibilityDistance(@NotNull final Hologram hologram, @NotNull final Player player) {
|
||||||
final Location location = hologram.getData().getLocation();
|
|
||||||
if (!hologram.getData().getWorldName().equals(player.getWorld().getName())) {
|
if (!hologram.getData().getWorldName().equals(player.getWorld().getName())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final Location location = hologram.getData().getLocation();
|
||||||
|
if (location.getWorld() == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int visibilityDistance = hologram.getData().getVisibilityDistance();
|
int visibilityDistance = hologram.getData().getVisibilityDistance();
|
||||||
double distanceSquared = location.distanceSquared(player.getLocation());
|
double distanceSquared = location.distanceSquared(player.getLocation());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user