From d5266b659b9572126a5d4508dedbf1e3fac81163 Mon Sep 17 00:00:00 2001 From: akastijn Date: Sat, 11 Jul 2026 19:38:26 +0200 Subject: [PATCH] Register online players without `auto-join-bypass` permission during `ROUND_STATE.PLAYER_REGISTRATION` or `ROUND_STATE.ENDED`. --- .../alttd/hunger_games/commands/subcommands/StartRound.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/com/alttd/hunger_games/commands/subcommands/StartRound.java b/src/main/java/com/alttd/hunger_games/commands/subcommands/StartRound.java index bce15c0..6302d19 100644 --- a/src/main/java/com/alttd/hunger_games/commands/subcommands/StartRound.java +++ b/src/main/java/com/alttd/hunger_games/commands/subcommands/StartRound.java @@ -3,10 +3,12 @@ package com.alttd.hunger_games.commands.subcommands; import com.alttd.hunger_games.commands.SubCommand; import com.alttd.hunger_games.config.Messages; import com.alttd.hunger_games.data_objects.ROUND_STATE; +import com.alttd.hunger_games.services.PlayerService; import com.alttd.hunger_games.services.Round; import com.alttd.hunger_games.services.RoundService; import lombok.RequiredArgsConstructor; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; +import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import java.util.List; @@ -16,11 +18,15 @@ public class StartRound extends SubCommand { private final Round round; private final RoundService roundService; + private final PlayerService playerService; @Override public boolean onCommand(CommandSender commandSender, String[] args) { ROUND_STATE roundState = roundService.getRoundState(); if (roundState == ROUND_STATE.PLAYER_REGISTRATION || roundState == ROUND_STATE.ENDED) { + Bukkit.getOnlinePlayers().stream() + .filter(player -> !player.hasPermission("hungergames.auto-join-bypass")) + .forEach(playerService::registerPlayer); round.startRound(); } else { commandSender.sendRichMessage(Messages.START_ROUND.CAN_NOT_START_ROUND,