Allow round to start from ROUND_STATE.ENDED and update related state handling
This commit is contained in:
parent
40f52a4a45
commit
e9e7c1cc80
|
|
@ -20,7 +20,7 @@ public class StartRound extends SubCommand {
|
|||
@Override
|
||||
public boolean onCommand(CommandSender commandSender, String[] args) {
|
||||
ROUND_STATE roundState = roundService.getRoundState();
|
||||
if (roundState == ROUND_STATE.PLAYER_REGISTRATION) {
|
||||
if (roundState == ROUND_STATE.PLAYER_REGISTRATION || roundState == ROUND_STATE.ENDED) {
|
||||
round.startRound();
|
||||
} else {
|
||||
commandSender.sendRichMessage(Messages.START_ROUND.CAN_NOT_START_ROUND,
|
||||
|
|
|
|||
|
|
@ -141,8 +141,8 @@ public class PlayerService implements RoundListener {
|
|||
});
|
||||
}
|
||||
return switch (roundState) {
|
||||
case PLAYER_REGISTRATION, COUNTDOWN -> Optional.of(PLAYER_STATE.REGISTERED);
|
||||
case KILL_PHASE, FINALE, ENDED, SAFE_PHASE -> Optional.of(PLAYER_STATE.SPECTATING);
|
||||
case PLAYER_REGISTRATION, COUNTDOWN, ENDED -> Optional.of(PLAYER_STATE.REGISTERED);
|
||||
case KILL_PHASE, FINALE, SAFE_PHASE -> Optional.of(PLAYER_STATE.SPECTATING);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ public class Round {
|
|||
}
|
||||
|
||||
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.");
|
||||
}
|
||||
roundState = ROUND_STATE.COUNTDOWN;
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ public class RoundService implements RoundListener {
|
|||
WorldBorderUtil.resetBorder();
|
||||
}
|
||||
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)) {
|
||||
Bukkit.broadcast(MiniMessage.miniMessage().deserialize(Messages.GAME.NEXT_STATE, Placeholder.parsed("round", roundState.getHumanReadableName())));
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user