Just a quick question, is there a way to set entity invisble for one player.
Something like: player.setinvisible(“myentity”) ?
Didn’t found anything about it on the forum and as I know spigot has this, just wanna know if this is simply not implemented yet.
@DotDash You could do that but the invisibility effect will be seen (get it?) by all other players. I think K0yk want to choose who can see who. For instance, a player triggers a command which sets all other players invisible for this player (and only this one), like it’s done in some hubs.
It’d have to be done by packets that tells the client to despawn the target players. They still exist, but the client doesn’t know that. You can’t simply use an invisibility potion because it’ll still show those particle effects. All plugins with this functionality in bukkit used packets. I don’t think any 1.8 changes let us do it without.
Regardless of whether it does, the effects remain where it purely only makes the player model invisible, without eliminating sound or other visuals like arrows stuck on players, armor worn, particle effects caused by players and etc.
Fact is any hacked client that gets sent any evidence of a player is going to show it. Player sounds could show up as particle effects or tracers. Invisible players will be visible etc.
Vanish != invisibility status effects, Why is this even still an argument.
So I tried this code by following the given link, but this didn’t work:
@Subscribe
public void OnBreakBlock(PlayerBreakBlockEvent event)
{
Player player = (Player) event.getUser();
player.getOrCreate(InvisibilityData.class).get().setInvisibleTo(player2, true);
}
@K0yk That sounds like you aren’t using Optionals right.
“Cannot be called on an absent value” is something thats thrown when you try to get() from an Optional that doesn’t have anything. Make sure the value is present first using isPresent().