From b505b0825aec5b921b4a61227f5db94fbf7ee411 Mon Sep 17 00:00:00 2001 From: Melledy <52122272+Melledy@users.noreply.github.com> Date: Thu, 21 Jul 2022 16:24:04 -0700 Subject: [PATCH] Fix host team size not changing when a player joins their world for the first time --- .../emu/grasscutter/game/world/World.java | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/main/java/emu/grasscutter/game/world/World.java b/src/main/java/emu/grasscutter/game/world/World.java index 456a07108..04858e2a5 100644 --- a/src/main/java/emu/grasscutter/game/world/World.java +++ b/src/main/java/emu/grasscutter/game/world/World.java @@ -148,7 +148,7 @@ public class World implements Iterable { player.setPeerId(this.getNextPeerId()); player.getTeamManager().setEntityId(getNextEntityId(EntityIdType.TEAM)); - // Copy main team to mp team + // Copy main team to multiplayer team if (this.isMultiplayer()) { player.getTeamManager().getMpTeam().copyFrom(player.getTeamManager().getCurrentSinglePlayerTeamInfo(), player.getTeamManager().getMaxTeamSize()); player.getTeamManager().setCurrentCharacterIndex(0); @@ -282,8 +282,8 @@ public class World implements Iterable { private void updatePlayerInfos(Player paramPlayer) { for (Player player : getPlayers()) { - // Dont send packets if player is loading in and filter out joining player - if (!player.hasSentAvatarDataNotify() || player.getSceneLoadState().getValue() < SceneLoadState.INIT.getValue() || player == paramPlayer) { + // Dont send packets if player is logging in and filter out joining player + if (!player.hasSentAvatarDataNotify() || player == paramPlayer) { continue; } @@ -292,15 +292,18 @@ public class World implements Iterable { player.getTeamManager().getMpTeam().copyFrom(player.getTeamManager().getMpTeam(), player.getTeamManager().getMaxTeamSize()); player.getTeamManager().updateTeamEntities(null); } + + // Dont send packets if player is loading into the scene + if (player.getSceneLoadState().getValue() < SceneLoadState.INIT.getValue() ) { + // World player info packets + player.getSession().send(new PacketWorldPlayerInfoNotify(this)); + player.getSession().send(new PacketScenePlayerInfoNotify(this)); + player.getSession().send(new PacketWorldPlayerRTTNotify(this)); - // World player info packets - player.getSession().send(new PacketWorldPlayerInfoNotify(this)); - player.getSession().send(new PacketScenePlayerInfoNotify(this)); - player.getSession().send(new PacketWorldPlayerRTTNotify(this)); - - // Team packets - player.getSession().send(new PacketSyncTeamEntityNotify(player)); - player.getSession().send(new PacketSyncScenePlayTeamEntityNotify(player)); + // Team packets + player.getSession().send(new PacketSyncTeamEntityNotify(player)); + player.getSession().send(new PacketSyncScenePlayTeamEntityNotify(player)); + } } }