Skip to content

Commit

Permalink
Don't count spectators as players in waiting lobby
Browse files Browse the repository at this point in the history
  • Loading branch information
Patbox committed Nov 10, 2024
1 parent 8968fa8 commit a7c0158
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ private void onTick() {

@Nullable
private GameResult requestStart() {
if (this.gameSpace.getPlayers().size() < this.playerConfig.minPlayers()) {
if (this.gameSpace.getPlayers().participants().size() < this.playerConfig.minPlayers()) {
return GameResult.error(GameTexts.Start.notEnoughPlayers());
}

Expand Down Expand Up @@ -218,7 +218,7 @@ private long getTargetCountdownDuration() {
return START_REQUESTED_COUNTDOWN;
}

if (this.gameSpace.getPlayers().size() >= this.playerConfig.minPlayers()) {
if (this.gameSpace.getPlayers().participants().size() >= this.playerConfig.minPlayers()) {
if (this.isActiveFull()) {
return countdown.fullSeconds() * 20L;
} else if (this.isReady()) {
Expand Down Expand Up @@ -261,10 +261,10 @@ private void updateSidebar() {

if (this.playerConfig.playerConfig().maxPlayers().isEmpty()) {
b.add(Text.translatable("text.plasmid.game.waiting_lobby.sidebar.players",
Text.literal("" + this.gameSpace.getPlayers().size()).formatted(Formatting.AQUA), "", ""));
Text.literal("" + this.gameSpace.getPlayers().participants().size()).formatted(Formatting.AQUA), "", ""));
} else {
b.add(Text.translatable("text.plasmid.game.waiting_lobby.sidebar.players",
Text.literal("" + this.gameSpace.getPlayers().size()).formatted(Formatting.AQUA),
Text.literal("" + this.gameSpace.getPlayers().participants().size()).formatted(Formatting.AQUA),
Text.literal("/").formatted(Formatting.GRAY),
Text.literal("" + this.playerConfig.playerConfig().maxPlayers().orElse(0)).formatted(Formatting.AQUA)));
}
Expand Down Expand Up @@ -297,7 +297,7 @@ private long getRemainingTicks(long time) {
}

private boolean isReady() {
return this.gameSpace.getPlayers().size() >= this.playerConfig.thresholdPlayers();
return this.gameSpace.getPlayers().participants().size() >= this.playerConfig.thresholdPlayers();
}

private boolean isFull() {
Expand Down

0 comments on commit a7c0158

Please sign in to comment.