mirror of
https://github.com/Minestom/Minestom.git
synced 2024-11-13 22:25:53 +01:00
Init player before setting its instance
This commit is contained in:
parent
ea951f9566
commit
8ff4f9432c
@ -371,14 +371,10 @@ public final class ConnectionManager {
|
||||
PlayerLoginEvent loginEvent = new PlayerLoginEvent(waitingPlayer);
|
||||
EventDispatcher.call(loginEvent);
|
||||
final Instance spawningInstance = loginEvent.getSpawningInstance();
|
||||
|
||||
Check.notNull(spawningInstance, "You need to specify a spawning instance in the PlayerLoginEvent");
|
||||
// Spawn the player at Player#getRespawnPoint during the next instance tick
|
||||
Player finalWaitingPlayer = waitingPlayer;
|
||||
spawningInstance.scheduleNextTick(instance -> {
|
||||
finalWaitingPlayer.UNSAFE_init(spawningInstance);
|
||||
finalWaitingPlayer.setInstance(spawningInstance);
|
||||
});
|
||||
waitingPlayer.UNSAFE_init(spawningInstance);
|
||||
spawningInstance.scheduleNextTick(waitingPlayer::setInstance);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user