Add check for vanished metadata on bukkit to hide vanished players on the map

This commit is contained in:
Blue (Lukas Rieger) 2020-09-15 13:07:09 +02:00
parent e9ab39c052
commit d113d0602f

View File

@ -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();