Skip to content

Commit dc641f0

Browse files
committed
fix: ensure teamstage modification on the client is a no-op
1 parent 65a854a commit dc641f0

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

common/src/main/java/dev/ftb/mods/ftbteams/api/TeamStagesHelper.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@
1111
import java.util.Set;
1212

1313
/**
14-
* Utility class providing some convenience methods for querying and adjust the team stages for a team. These methods
15-
* all handle client sync and team data serialization internally.
14+
* Utility class providing some convenience methods for querying and modifying the team stages for a team. These methods
15+
* all handle client sync and team data serialization for you.
16+
* <p>
17+
* These methods are all safe to call on the client, but it's only useful to query stages on the client with
18+
* {@link #hasTeamStage(Team, String)}; the methods which modify stages do nothing on the client.
1619
* <p>
1720
* Modifying a team's stages also causes a {@link TeamPropertiesChangedEvent} event to be fired.
1821
*/
@@ -85,6 +88,9 @@ public static Collection<String> getStages(Team team) {
8588
}
8689

8790
private static int updateStages(Team team, Collection<String> stages, boolean adding) {
91+
if (team.isClientTeam()) {
92+
return 0;
93+
}
8894
Set<String> stageSet = team.getProperty(TeamProperties.TEAM_STAGES);
8995
int changed = (int) stages.stream().filter(stage -> adding && stageSet.add(stage) || !adding && stageSet.remove(stage)).count();
9096
if (changed > 0) {

0 commit comments

Comments
 (0)