Hey, so im working on a plugin which requires multiple users to be teleported to to a random location in the world within a certain radius, i have that part sorted but im trying to find the best way to teleport them because without loading the chuunks before they get teleported it will cause alot of lag on the server. But with loading the chunks i dont know the best way to do it because it wouldnt work just loading it right before they teleport i dont think. So any help is needed
You can get the world that they are in and load the chunks before hand using: Code (Text): loadChunk(int x, int z, boolean generate) Here is the link to the API page: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/World.html#loadChunk(int, int, boolean) If you wanted to wait a little before teleporting to give time for the server to load/generate the chunk, I guess you could use a BukkitRunnable to delay the teleportation.
Ohhhhh, sorry. I'm not too familiar with all that ASyncEvent magic or whatever. However, there might be something you could use with it to load chunks with ASync because from my understanding (could be 100% wrong), it performs tasks separately from the core server functions so the tps wouldn't be affected. Again, I could be totally wrong I haven't really worked with that stuff.