From d113d0602fece21c824abcf9821e14722e4031bb Mon Sep 17 00:00:00 2001 From: "Blue (Lukas Rieger)" Date: Tue, 15 Sep 2020 13:07:09 +0200 Subject: [PATCH] Add check for vanished metadata on bukkit to hide vanished players on the map --- .../java/de/bluecolored/bluemap/bukkit/BukkitPlayer.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/implementations/spigot/src/main/java/de/bluecolored/bluemap/bukkit/BukkitPlayer.java b/implementations/spigot/src/main/java/de/bluecolored/bluemap/bukkit/BukkitPlayer.java index 0c03903c..e7aeebf0 100644 --- a/implementations/spigot/src/main/java/de/bluecolored/bluemap/bukkit/BukkitPlayer.java +++ b/implementations/spigot/src/main/java/de/bluecolored/bluemap/bukkit/BukkitPlayer.java @@ -31,6 +31,7 @@ import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Location; +import org.bukkit.metadata.MetadataValue; import org.bukkit.potion.PotionEffectType; import com.flowpowered.math.vector.Vector3d; @@ -118,6 +119,11 @@ public void update() { this.invisible = player.hasPotionEffect(PotionEffectType.INVISIBILITY); + //also check for "vanished" players + for (MetadataValue meta : player.getMetadata("vanished")) { + if (meta.asBoolean()) this.invisible = true; + } + this.name = Text.of(player.getName()); this.online = player.isOnline();