Handle empty stage list in Round and adjust state transitions in RoundService
This commit is contained in:
parent
62c9661c82
commit
a137ef4cc6
|
|
@ -119,6 +119,12 @@ public class Round {
|
|||
|
||||
private void scheduleNextStage(int index) {
|
||||
List<GameStage> gameStageList = Config.ROUND.STAGES;
|
||||
if (gameStageList.isEmpty()) {
|
||||
nextStage(); // Transition to SAFE_PHASE
|
||||
nextStage(); // Transition to KILL_PHASE
|
||||
return;
|
||||
}
|
||||
|
||||
if (gameStageList.size() <= index) {
|
||||
nextStage();
|
||||
return;
|
||||
|
|
@ -128,10 +134,15 @@ public class Round {
|
|||
Duration duration = gameStage.getDuration();
|
||||
|
||||
startCountdown(duration, () -> {
|
||||
GameStageHandler.handleStageChange(gameStage.getWorldBorderSize());
|
||||
if (gameStageList.size() <= index + 1) {
|
||||
nextStage();
|
||||
GameStageHandler.handleStageChange(gameStage.getWorldBorderSize());
|
||||
startCountdown(Duration.ofMinutes(5), this::nextStage);
|
||||
} else {
|
||||
if (index == 0 && roundState.equals(ROUND_STATE.SAFE_PHASE)) {
|
||||
nextStage();
|
||||
}
|
||||
GameStageHandler.handleStageChange(gameStage.getWorldBorderSize());
|
||||
scheduleNextStage(index + 1);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ public class RoundService implements RoundListener {
|
|||
if (roundState.equals(ROUND_STATE.FINALE)) {
|
||||
WorldBorderUtil.setSize(60);
|
||||
}
|
||||
if (!roundState.equals(ROUND_STATE.ENDED)) {
|
||||
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