mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-03-13 15:20:14 +01:00
Set a metadata value for vanished players (#4646)
Co-authored-by: Josh Roy <10731363+JRoy@users.noreply.github.com>
This commit is contained in:
parent
5723dac6ba
commit
51c49b0de6
@ -28,6 +28,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
@ -893,6 +894,7 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
|
|||||||
}
|
}
|
||||||
setHidden(true);
|
setHidden(true);
|
||||||
ess.getVanishedPlayersNew().add(getName());
|
ess.getVanishedPlayersNew().add(getName());
|
||||||
|
this.getBase().setMetadata("vanished", new FixedMetadataValue(ess, true));
|
||||||
if (isAuthorized("essentials.vanish.effect")) {
|
if (isAuthorized("essentials.vanish.effect")) {
|
||||||
this.getBase().addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false));
|
this.getBase().addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false));
|
||||||
}
|
}
|
||||||
@ -905,6 +907,7 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
|
|||||||
}
|
}
|
||||||
setHidden(false);
|
setHidden(false);
|
||||||
ess.getVanishedPlayersNew().remove(getName());
|
ess.getVanishedPlayersNew().remove(getName());
|
||||||
|
this.getBase().setMetadata("vanished", new FixedMetadataValue(ess, false));
|
||||||
if (isAuthorized("essentials.vanish.effect")) {
|
if (isAuthorized("essentials.vanish.effect")) {
|
||||||
this.getBase().removePotionEffect(PotionEffectType.INVISIBILITY);
|
this.getBase().removePotionEffect(PotionEffectType.INVISIBILITY);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user