mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-02-04 04:12:54 +08:00
Fix host team size not changing when a player joins their world for the first time
This commit is contained in:
parent
62e54010ad
commit
b505b0825a
@ -148,7 +148,7 @@ public class World implements Iterable<Player> {
|
|||||||
player.setPeerId(this.getNextPeerId());
|
player.setPeerId(this.getNextPeerId());
|
||||||
player.getTeamManager().setEntityId(getNextEntityId(EntityIdType.TEAM));
|
player.getTeamManager().setEntityId(getNextEntityId(EntityIdType.TEAM));
|
||||||
|
|
||||||
// Copy main team to mp team
|
// Copy main team to multiplayer team
|
||||||
if (this.isMultiplayer()) {
|
if (this.isMultiplayer()) {
|
||||||
player.getTeamManager().getMpTeam().copyFrom(player.getTeamManager().getCurrentSinglePlayerTeamInfo(), player.getTeamManager().getMaxTeamSize());
|
player.getTeamManager().getMpTeam().copyFrom(player.getTeamManager().getCurrentSinglePlayerTeamInfo(), player.getTeamManager().getMaxTeamSize());
|
||||||
player.getTeamManager().setCurrentCharacterIndex(0);
|
player.getTeamManager().setCurrentCharacterIndex(0);
|
||||||
@ -282,8 +282,8 @@ public class World implements Iterable<Player> {
|
|||||||
|
|
||||||
private void updatePlayerInfos(Player paramPlayer) {
|
private void updatePlayerInfos(Player paramPlayer) {
|
||||||
for (Player player : getPlayers()) {
|
for (Player player : getPlayers()) {
|
||||||
// Dont send packets if player is loading in and filter out joining player
|
// Dont send packets if player is logging in and filter out joining player
|
||||||
if (!player.hasSentAvatarDataNotify() || player.getSceneLoadState().getValue() < SceneLoadState.INIT.getValue() || player == paramPlayer) {
|
if (!player.hasSentAvatarDataNotify() || player == paramPlayer) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,15 +292,18 @@ public class World implements Iterable<Player> {
|
|||||||
player.getTeamManager().getMpTeam().copyFrom(player.getTeamManager().getMpTeam(), player.getTeamManager().getMaxTeamSize());
|
player.getTeamManager().getMpTeam().copyFrom(player.getTeamManager().getMpTeam(), player.getTeamManager().getMaxTeamSize());
|
||||||
player.getTeamManager().updateTeamEntities(null);
|
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
|
// Team packets
|
||||||
player.getSession().send(new PacketWorldPlayerInfoNotify(this));
|
player.getSession().send(new PacketSyncTeamEntityNotify(player));
|
||||||
player.getSession().send(new PacketScenePlayerInfoNotify(this));
|
player.getSession().send(new PacketSyncScenePlayTeamEntityNotify(player));
|
||||||
player.getSession().send(new PacketWorldPlayerRTTNotify(this));
|
}
|
||||||
|
|
||||||
// Team packets
|
|
||||||
player.getSession().send(new PacketSyncTeamEntityNotify(player));
|
|
||||||
player.getSession().send(new PacketSyncScenePlayTeamEntityNotify(player));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user