Allow round to start from ROUND_STATE.ENDED and update related state handling

This commit is contained in:
akastijn 2026-07-11 19:35:33 +02:00
parent 40f52a4a45
commit e9e7c1cc80
4 changed files with 5 additions and 5 deletions

View File

@ -20,7 +20,7 @@ public class StartRound extends SubCommand {
@Override @Override
public boolean onCommand(CommandSender commandSender, String[] args) { public boolean onCommand(CommandSender commandSender, String[] args) {
ROUND_STATE roundState = roundService.getRoundState(); ROUND_STATE roundState = roundService.getRoundState();
if (roundState == ROUND_STATE.PLAYER_REGISTRATION) { if (roundState == ROUND_STATE.PLAYER_REGISTRATION || roundState == ROUND_STATE.ENDED) {
round.startRound(); round.startRound();
} else { } else {
commandSender.sendRichMessage(Messages.START_ROUND.CAN_NOT_START_ROUND, commandSender.sendRichMessage(Messages.START_ROUND.CAN_NOT_START_ROUND,

View File

@ -141,8 +141,8 @@ public class PlayerService implements RoundListener {
}); });
} }
return switch (roundState) { return switch (roundState) {
case PLAYER_REGISTRATION, COUNTDOWN -> Optional.of(PLAYER_STATE.REGISTERED); case PLAYER_REGISTRATION, COUNTDOWN, ENDED -> Optional.of(PLAYER_STATE.REGISTERED);
case KILL_PHASE, FINALE, ENDED, SAFE_PHASE -> Optional.of(PLAYER_STATE.SPECTATING); case KILL_PHASE, FINALE, SAFE_PHASE -> Optional.of(PLAYER_STATE.SPECTATING);
}; };
} }
} }

View File

@ -77,7 +77,7 @@ public class Round {
} }
public void startRound() { public void startRound() {
if (!roundState.equals(ROUND_STATE.PLAYER_REGISTRATION)) { if (!roundState.equals(ROUND_STATE.PLAYER_REGISTRATION) && !roundState.equals(ROUND_STATE.ENDED)) {
throw new IllegalStateException("Round can not be started before player registration."); throw new IllegalStateException("Round can not be started before player registration.");
} }
roundState = ROUND_STATE.COUNTDOWN; roundState = ROUND_STATE.COUNTDOWN;

View File

@ -137,7 +137,7 @@ public class RoundService implements RoundListener {
WorldBorderUtil.resetBorder(); WorldBorderUtil.resetBorder();
} }
if (roundState.equals(ROUND_STATE.FINALE)) { if (roundState.equals(ROUND_STATE.FINALE)) {
WorldBorderUtil.setSize(Config.ROUND.FINALE_BORDER_SIZE); WorldBorderUtil.setSize(Config.ROUND.FINALE_BORDER_SIZE, 1);
} }
if (!roundState.equals(ROUND_STATE.ENDED) && !roundState.equals(ROUND_STATE.PLAYER_REGISTRATION)) { if (!roundState.equals(ROUND_STATE.ENDED) && !roundState.equals(ROUND_STATE.PLAYER_REGISTRATION)) {
Bukkit.broadcast(MiniMessage.miniMessage().deserialize(Messages.GAME.NEXT_STATE, Placeholder.parsed("round", roundState.getHumanReadableName()))); Bukkit.broadcast(MiniMessage.miniMessage().deserialize(Messages.GAME.NEXT_STATE, Placeholder.parsed("round", roundState.getHumanReadableName())));