Compare commits
2 Commits
3906bd747b
...
e9e7c1cc80
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e9e7c1cc80 | ||
|
|
40f52a4a45 |
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -131,13 +131,18 @@ public class PlayerService implements RoundListener {
|
|||
if (optionalPlayerState.isPresent()) {
|
||||
PLAYER_STATE playerState = optionalPlayerState.get();
|
||||
return Optional.of(switch (playerState) {
|
||||
case DISCONNECTED, SPECTATING -> PLAYER_STATE.SPECTATING;
|
||||
case DISCONNECTED, SPECTATING -> {
|
||||
if (roundState.equals(ROUND_STATE.ENDED)) {
|
||||
yield PLAYER_STATE.REGISTERED;
|
||||
}
|
||||
yield PLAYER_STATE.SPECTATING;
|
||||
}
|
||||
case REGISTERED -> PLAYER_STATE.REGISTERED;
|
||||
});
|
||||
}
|
||||
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