Invisible players and mobs

Discussion in 'Spigot Plugin Development' started by GamemodeSurvival, Oct 8, 2019.

  1. When a player joins, sometimes(like 10% of the time) the player can not see someone and that someone can not see them(only tested with 2 people they might be invis to everyone.) When they switch worlds it is fixed, or when you do /vanish (custom command, toggles .canSee for every player) fixes it if they both do it. So the problem is I think they join and no one can see them. Nothing in my code effects this and I know this because it doesn't happen everytime. I tried adding something that for each player if they can't see eachother, toggle the .canSee but the bug still happens. Spigot version 1.12. I think it is server side considering I gave the plugin to my friend and it hasn't happened on his server yet(it is rare so maybe thats why?) And I have a boss system where every x seconds a boss spawns, if the player is not in the same world as the boss, they can not see it.
     
  2. Have you tried turning it on and off again when joining the server (without any conditions)?
     
  3. Does this happen when you disable your custom plugin? If yes, then some other plugin (or potentially even the server) is to blame.
    If this doesn't happen without your plugin, then there's only one logical conclusion.
     
  4. As said it works fine on my friends server. Only difference betweens ours is mine has via version.
     
  5. Via version messes a lot with packets. It's possible, that it causes this issue. I still believe that you might be able to fix this bug by toggling visibility for all players twice.
     
  6. Yes I told you if you toggle it twice via command it works. But players can't have invis command xD. And that doesn't fix the mobs.
     
  7. Players can't have it - you can still run it for them though on PlayerJoinEvent
     
  8. I did this. how to fix mobs? Should this fix mobs: mob.setRemoveWhenFarAway(false);
     
  9. You can play an entity despawn followed by a spawn packet for each mob that the player can see.
     
  10. mob.setRemoveWhenFarAway(false); worked
     
  11. Oh wow, nice - I didn't expect that to work