mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-27 19:47:44 +01:00
Merge branch 'master' of https://github.com/Minestom/Minestom
This commit is contained in:
commit
62663ccb64
@ -57,7 +57,6 @@ public final class EntityManager {
|
||||
private void waitingPlayersTick() {
|
||||
Player waitingPlayer;
|
||||
while ((waitingPlayer = waitingPlayers.poll()) != null) {
|
||||
waitingPlayer.init();
|
||||
|
||||
PlayerLoginEvent loginEvent = new PlayerLoginEvent(waitingPlayer);
|
||||
waitingPlayer.callEvent(PlayerLoginEvent.class, loginEvent);
|
||||
@ -65,6 +64,8 @@ public final class EntityManager {
|
||||
|
||||
Check.notNull(spawningInstance, "You need to specify a spawning instance in the PlayerLoginEvent");
|
||||
|
||||
waitingPlayer.init();
|
||||
|
||||
spawningInstance.scheduleNextTick(waitingPlayer::setInstance);
|
||||
}
|
||||
}
|
||||
|
@ -697,7 +697,7 @@ public class Player extends LivingEntity implements CommandSender {
|
||||
sendDimension(instanceDimensionType);
|
||||
}
|
||||
|
||||
final long[] visibleChunks = ChunkUtils.getChunksInRange(firstSpawn ? getRespawnPoint() : position, getChunkRange());
|
||||
final long[] visibleChunks = ChunkUtils.getChunksInRange(position, getChunkRange());
|
||||
final int length = visibleChunks.length;
|
||||
|
||||
AtomicInteger counter = new AtomicInteger(0);
|
||||
@ -709,8 +709,9 @@ public class Player extends LivingEntity implements CommandSender {
|
||||
if (chunk != null) {
|
||||
chunk.addViewer(this);
|
||||
if (chunk.getChunkX() == ChunkUtils.getChunkCoordinate((int) getPosition().getX()) &&
|
||||
chunk.getChunkZ() == ChunkUtils.getChunkCoordinate((int) getPosition().getZ()))
|
||||
chunk.getChunkZ() == ChunkUtils.getChunkCoordinate((int) getPosition().getZ())) {
|
||||
updateViewPosition(chunk);
|
||||
}
|
||||
}
|
||||
final boolean isLast = counter.get() == length - 1;
|
||||
if (isLast) {
|
||||
@ -742,15 +743,12 @@ public class Player extends LivingEntity implements CommandSender {
|
||||
private void spawnPlayer(Instance instance, boolean firstSpawn) {
|
||||
this.viewableEntities.forEach(entity -> entity.removeViewer(this));
|
||||
|
||||
super.setInstance(instance);
|
||||
|
||||
if (firstSpawn) {
|
||||
this.position = getRespawnPoint();
|
||||
this.cacheX = position.getX();
|
||||
this.cacheY = position.getY();
|
||||
this.cacheZ = position.getZ();
|
||||
updatePlayerPosition();
|
||||
teleport(getRespawnPoint());
|
||||
}
|
||||
|
||||
super.setInstance(instance);
|
||||
|
||||
PlayerSpawnEvent spawnEvent = new PlayerSpawnEvent(this, instance, firstSpawn);
|
||||
callEvent(PlayerSpawnEvent.class, spawnEvent);
|
||||
|
Loading…
Reference in New Issue
Block a user