Solved Spawned entity on PlayerJoinEvent turns invisible

Discussion in 'Spigot Plugin Development' started by Atomix, Feb 3, 2020.

Thread Status:
Not open for further replies.
  1. What happens is I want to spawn a zombie lets say when a player joins the server...It all works great but instead of a normal zombie existing it is invisible (im not even sure if it exists so I checked by teleporting it to the player seconds after the player has joined which gave no error so I assume it is there). After a little research I came to think maybe the area around the player not being loaded may cause this. I found a workaround way by running a bukkit task and spawning the zombie ticks after the PlayerJoinEvent is triggered and it worked. So I wonder if there is a way to check when the player has actually joined and loaded area around them or maybe find some other solution where the entity doesnt turn invisible and probably uninteractable idk.

  2. Maybe try checking if the chunk is loaded?
  3. thought of it but its another workaround just like the run task later and if there is no other way this is what im going to use
    #3 Atomix, Feb 3, 2020
    Last edited: Dec 27, 2021
  4. There's unfortunately no other way to know if the player is "loaded" after login
  5. okay I expected this. Thanks for your replies, I will leave the thread open for some more time to see if anyone comes up with something and then close it.

    EDIT: i could use event.getPlayer().getLocation().getChunk().load() to load the chunks and run a timer to make sure they are loaded before spawning the entity which pretty much solves the issue
    #5 Atomix, Feb 3, 2020
    Last edited: Feb 3, 2020
    • Like Like x 1
Thread Status:
Not open for further replies.