Make init function UNSAFE

This commit is contained in:
LeoDog896 2021-01-18 10:44:12 -05:00
parent 4aed6ffa5c
commit 78abfb9657
2 changed files with 3 additions and 2 deletions

View File

@ -229,10 +229,11 @@ public class Player extends LivingEntity implements CommandSender {
* Init the player and spawn him.
* <p>
* WARNING: executed in the main update thread
* UNSAFE: Only meant to be used when a netty player connects through the server.
*
* @param spawnInstance the player spawn instance (defined in {@link PlayerLoginEvent})
*/
public void init(@NotNull Instance spawnInstance) {
public void UNSAFE_init(@NotNull Instance spawnInstance) {
this.dimensionType = spawnInstance.getDimensionType();
JoinGamePacket joinGamePacket = new JoinGamePacket();

View File

@ -503,7 +503,7 @@ public final class ConnectionManager {
Check.notNull(spawningInstance, "You need to specify a spawning instance in the PlayerLoginEvent");
waitingPlayer.init(spawningInstance);
waitingPlayer.UNSAFE_init(spawningInstance);
// Spawn the player at Player#getRespawnPoint during the next instance tick
spawningInstance.scheduleNextTick(waitingPlayer::setInstance);