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
1 changed files with 6 additions and 0 deletions

View File

@ -31,6 +31,7 @@ import java.util.UUID;
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 class BukkitPlayer implements Player {
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();