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,