mirror of
https://github.com/Minestom/Minestom.git
synced 2025-03-02 11:21:15 +01:00
Don't add players to the waiting list in the constructor, but in the registration method
This commit is contained in:
parent
924fac562b
commit
87e8e550f1
@ -4,6 +4,7 @@ import com.google.common.collect.Queues;
|
|||||||
import net.minestom.server.MinecraftServer;
|
import net.minestom.server.MinecraftServer;
|
||||||
import net.minestom.server.chat.ChatColor;
|
import net.minestom.server.chat.ChatColor;
|
||||||
import net.minestom.server.chat.ColoredText;
|
import net.minestom.server.chat.ColoredText;
|
||||||
|
import net.minestom.server.entity.fakeplayer.FakePlayerOption;
|
||||||
import net.minestom.server.event.player.AsyncPlayerPreLoginEvent;
|
import net.minestom.server.event.player.AsyncPlayerPreLoginEvent;
|
||||||
import net.minestom.server.event.player.PlayerLoginEvent;
|
import net.minestom.server.event.player.PlayerLoginEvent;
|
||||||
import net.minestom.server.instance.Instance;
|
import net.minestom.server.instance.Instance;
|
||||||
@ -79,9 +80,10 @@ public final class EntityManager {
|
|||||||
* If the {@link Player} hasn't been kicked, add him to the waiting list.
|
* If the {@link Player} hasn't been kicked, add him to the waiting list.
|
||||||
* <p>
|
* <p>
|
||||||
* Can be considered as a pre-init thing,
|
* Can be considered as a pre-init thing,
|
||||||
* currently executed in {@link Player#Player(UUID, String, PlayerConnection)}.
|
* currently executed in {@link ConnectionManager#createPlayer(UUID, String, PlayerConnection)}
|
||||||
|
* and {@link net.minestom.server.entity.fakeplayer.FakePlayer#initPlayer(UUID, String, FakePlayerOption, Consumer)}.
|
||||||
*
|
*
|
||||||
* @param player the {@link Player} to add
|
* @param player the {@link Player player} to add to the waiting list
|
||||||
*/
|
*/
|
||||||
public void addWaitingPlayer(@NotNull Player player) {
|
public void addWaitingPlayer(@NotNull Player player) {
|
||||||
|
|
||||||
|
@ -220,8 +220,6 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
|
|
||||||
// FakePlayer init its connection there
|
// FakePlayer init its connection there
|
||||||
playerConnectionInit();
|
playerConnectionInit();
|
||||||
|
|
||||||
MinecraftServer.getEntityManager().addWaitingPlayer(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -63,6 +63,8 @@ public class FakePlayer extends Player {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MinecraftServer.getEntityManager().addWaitingPlayer(fakePlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -334,6 +334,7 @@ public final class ConnectionManager {
|
|||||||
public Player createPlayer(@NotNull UUID uuid, @NotNull String username, @NotNull PlayerConnection connection) {
|
public Player createPlayer(@NotNull UUID uuid, @NotNull String username, @NotNull PlayerConnection connection) {
|
||||||
final Player player = getPlayerProvider().createPlayer(uuid, username, connection);
|
final Player player = getPlayerProvider().createPlayer(uuid, username, connection);
|
||||||
createPlayer(player);
|
createPlayer(player);
|
||||||
|
MinecraftServer.getEntityManager().addWaitingPlayer(player);
|
||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user