-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
None
-
None
-
git-Spigot-baafee9-17543ec (MC: 1.14.2) (Implementing API version 1.14.2-R0.1-SNAPSHOT)
-
Yes
If the spawn location in PlayerSpawnLocationEvent is set to a location in a different world (than the player would have joined originally), the player is not added to the PlayerChunkMap/EntityTracker. This results in several issues e.g. entities don't despawn in the client, the inventory is not synced, you can't open elytras, the clients own metadata is not updated etc.
This is a huge issue on our server network.
Example plugin code (binary included as an attachment):
public class TestPlugin extends JavaPlugin implements Listener { private World world; @Override public void onEnable() { Bukkit.getPluginManager().registerEvents(this, this); world = Bukkit.createWorld(WorldCreator.name("test")); } @EventHandler public void onSpawnLocation(PlayerSpawnLocationEvent e) { Player player = e.getPlayer(); System.out.println("spawn1: " + e.getSpawnLocation()); if (e.getSpawnLocation().getWorld() == world) { e.setSpawnLocation(Bukkit.getWorld("world").getSpawnLocation()); } else { e.setSpawnLocation(world.getSpawnLocation()); } System.out.println("spawn2: " + e.getSpawnLocation()); } }