From 51c49b0de62e36a900b814cc85f3db36ecad45e8 Mon Sep 17 00:00:00 2001 From: nik2143 <44278678+nik2143@users.noreply.github.com> Date: Wed, 24 Nov 2021 15:57:55 +0100 Subject: [PATCH] Set a metadata value for vanished players (#4646) Co-authored-by: Josh Roy <10731363+JRoy@users.noreply.github.com> --- Essentials/src/main/java/com/earth2me/essentials/User.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Essentials/src/main/java/com/earth2me/essentials/User.java b/Essentials/src/main/java/com/earth2me/essentials/User.java index 9d8140cdd..4d161c5c0 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/User.java +++ b/Essentials/src/main/java/com/earth2me/essentials/User.java @@ -28,6 +28,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; +import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; @@ -893,6 +894,7 @@ public class User extends UserData implements Comparable, IMessageRecipien } setHidden(true); ess.getVanishedPlayersNew().add(getName()); + this.getBase().setMetadata("vanished", new FixedMetadataValue(ess, true)); if (isAuthorized("essentials.vanish.effect")) { this.getBase().addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false)); } @@ -905,6 +907,7 @@ public class User extends UserData implements Comparable, IMessageRecipien } setHidden(false); ess.getVanishedPlayersNew().remove(getName()); + this.getBase().setMetadata("vanished", new FixedMetadataValue(ess, false)); if (isAuthorized("essentials.vanish.effect")) { this.getBase().removePotionEffect(PotionEffectType.INVISIBILITY); }