From df1b65b8a8cd93137da6d802bd787fe48d21d495 Mon Sep 17 00:00:00 2001 From: KingRainbow44 Date: Sat, 29 Apr 2023 02:10:14 -0400 Subject: [PATCH] Check active team size, rather than using a `4` constant --- src/main/java/emu/grasscutter/game/player/TeamManager.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/emu/grasscutter/game/player/TeamManager.java b/src/main/java/emu/grasscutter/game/player/TeamManager.java index 13fc0c19b..2c4b57316 100644 --- a/src/main/java/emu/grasscutter/game/player/TeamManager.java +++ b/src/main/java/emu/grasscutter/game/player/TeamManager.java @@ -513,6 +513,8 @@ public final class TeamManager extends BasePlayerDataManager { * @param trialAvatarIds The avatar IDs to remove. */ public void removeTrialAvatarTeam(List trialAvatarIds) { + var isTeam = trialAvatarIds.size() == this.getActiveTeam().size(); + var player = this.getPlayer(); var scene = player.getScene(); @@ -524,7 +526,7 @@ public final class TeamManager extends BasePlayerDataManager { this.getActiveTeam().forEach(avatarEntity -> scene .removeEntity(avatarEntity, VisionTypeOuterClass.VisionType.VISION_TYPE_REMOVE)); - if (trialAvatarIds.size() == 4) { + if (isTeam) { this.getActiveTeam().clear(); this.getTrialAvatars().clear(); } else { @@ -536,7 +538,7 @@ public final class TeamManager extends BasePlayerDataManager { } // Re-add the avatars to the team. - if (trialAvatarIds.size() == 4) { + if (isTeam) { // Restores all avatars from the player's avatar storage. this.getCurrentTeamInfo().getAvatars().forEach(avatarId -> this.getActiveTeam().add(new EntityAvatar(