Skip to content

Commit 4e29f2c

Browse files
nik2143JRoy
andauthored
Set a metadata value for vanished players (EssentialsX#4646)
Co-authored-by: Josh Roy <[email protected]>
1 parent ba34130 commit 4e29f2c

File tree

1 file changed

+3
-0
lines changed
  • Essentials/src/main/java/com/earth2me/essentials

1 file changed

+3
-0
lines changed

Essentials/src/main/java/com/earth2me/essentials/User.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
2929
import org.bukkit.inventory.ItemStack;
3030
import org.bukkit.inventory.PlayerInventory;
31+
import org.bukkit.metadata.FixedMetadataValue;
3132
import org.bukkit.potion.PotionEffect;
3233
import org.bukkit.potion.PotionEffectType;
3334

@@ -893,6 +894,7 @@ public void setVanished(final boolean set) {
893894
}
894895
setHidden(true);
895896
ess.getVanishedPlayersNew().add(getName());
897+
this.getBase().setMetadata("vanished", new FixedMetadataValue(ess, true));
896898
if (isAuthorized("essentials.vanish.effect")) {
897899
this.getBase().addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false));
898900
}
@@ -905,6 +907,7 @@ public void setVanished(final boolean set) {
905907
}
906908
setHidden(false);
907909
ess.getVanishedPlayersNew().remove(getName());
910+
this.getBase().setMetadata("vanished", new FixedMetadataValue(ess, false));
908911
if (isAuthorized("essentials.vanish.effect")) {
909912
this.getBase().removePotionEffect(PotionEffectType.INVISIBILITY);
910913
}

0 commit comments

Comments
 (0)