diff --git a/src/main/java/emu/grasscutter/game/TeamManager.java b/src/main/java/emu/grasscutter/game/TeamManager.java index 00f069c84..3f6c4ebe5 100644 --- a/src/main/java/emu/grasscutter/game/TeamManager.java +++ b/src/main/java/emu/grasscutter/game/TeamManager.java @@ -158,7 +158,7 @@ public class TeamManager { } public boolean isSpawned() { - return getPlayer().getWorld() != null && getPlayer().getScene().getEntities().containsKey(getCurrentAvatarEntity().getId()); + return getPlayer().getScene() != null && getPlayer().getScene().getEntities().containsKey(getCurrentAvatarEntity().getId()); } public int getMaxTeamSize() { @@ -256,7 +256,7 @@ public class TeamManager { updateTeamResonances(); // Packets - getPlayer().getScene().broadcastPacket(new PacketSceneTeamUpdateNotify(getPlayer())); + getPlayer().getWorld().broadcastPacket(new PacketSceneTeamUpdateNotify(getPlayer())); // Run callback if (responsePacket != null) { diff --git a/src/main/java/emu/grasscutter/game/World.java b/src/main/java/emu/grasscutter/game/World.java index 802ab6ba0..02c0df63a 100644 --- a/src/main/java/emu/grasscutter/game/World.java +++ b/src/main/java/emu/grasscutter/game/World.java @@ -152,6 +152,7 @@ public class World implements Iterable { // Copy main team to mp team if (this.isMultiplayer()) { player.getTeamManager().getMpTeam().copyFrom(player.getTeamManager().getCurrentSinglePlayerTeamInfo(), player.getTeamManager().getMaxTeamSize()); + player.getTeamManager().setCurrentCharacterIndex(0); } // Add to scene diff --git a/src/main/java/emu/grasscutter/game/managers/MultiplayerManager.java b/src/main/java/emu/grasscutter/game/managers/MultiplayerManager.java index ecc41f02d..0e0562421 100644 --- a/src/main/java/emu/grasscutter/game/managers/MultiplayerManager.java +++ b/src/main/java/emu/grasscutter/game/managers/MultiplayerManager.java @@ -95,14 +95,14 @@ public class MultiplayerManager { hostPlayer.sendPacket(new PacketPlayerEnterSceneNotify(hostPlayer, hostPlayer, EnterType.EnterSelf, EnterReason.HostFromSingleToMp, hostPlayer.getScene().getId(), hostPlayer.getPos())); } - // Make requester join - hostPlayer.getWorld().addPlayer(requester); - // Set scene pos and id of requester to the host player's requester.getPos().set(hostPlayer.getPos()); requester.getRotation().set(hostPlayer.getRotation()); requester.setSceneId(hostPlayer.getSceneId()); + // Make requester join + hostPlayer.getWorld().addPlayer(requester); + // Packet requester.sendPacket(new PacketPlayerEnterSceneNotify(requester, hostPlayer, EnterType.EnterOther, EnterReason.TeamJoin, hostPlayer.getScene().getId(), hostPlayer.getPos())); }