diff --git a/src/main/java/net/knarcraft/minigames/arena/parkour/ParkourArena.java b/src/main/java/net/knarcraft/minigames/arena/parkour/ParkourArena.java index 088649f..ecd9a3c 100644 --- a/src/main/java/net/knarcraft/minigames/arena/parkour/ParkourArena.java +++ b/src/main/java/net/knarcraft/minigames/arena/parkour/ParkourArena.java @@ -222,6 +222,15 @@ public class ParkourArena implements Arena { return copy; } + /** + * Gets whether this arena has no checkpoints + * + * @return
True if this arena has no checkpoints
+ */ + public boolean hasNoCheckpoints() { + return this.checkpoints.isEmpty(); + } + /** * Gets this arena's sanitized name * diff --git a/src/main/java/net/knarcraft/minigames/arena/parkour/ParkourArenaGameMode.java b/src/main/java/net/knarcraft/minigames/arena/parkour/ParkourArenaGameMode.java index d7811c7..7a5240c 100644 --- a/src/main/java/net/knarcraft/minigames/arena/parkour/ParkourArenaGameMode.java +++ b/src/main/java/net/knarcraft/minigames/arena/parkour/ParkourArenaGameMode.java @@ -18,7 +18,7 @@ public enum ParkourArenaGameMode implements ConfigurationSerializable, ArenaGame DEFAULT, /** - * A hard-core game mode where no checkpoints are allowed + * A hardcore game mode where no checkpoints are allowed */ HARDCORE, ; diff --git a/src/main/java/net/knarcraft/minigames/command/parkour/JoinParkourArenaCommand.java b/src/main/java/net/knarcraft/minigames/command/parkour/JoinParkourArenaCommand.java index 0067375..0ae8189 100644 --- a/src/main/java/net/knarcraft/minigames/command/parkour/JoinParkourArenaCommand.java +++ b/src/main/java/net/knarcraft/minigames/command/parkour/JoinParkourArenaCommand.java @@ -71,6 +71,12 @@ public class JoinParkourArenaCommand implements CommandExecutor { gameMode = ParkourArenaGameMode.DEFAULT; } + // Don't allow joining the hardcore game-mode if there are no checkpoints to skip + if (specifiedArena.hasNoCheckpoints() && gameMode == ParkourArenaGameMode.HARDCORE) { + player.sendMessage(Message.ERROR_HARDCORE_NO_CHECKPOINTS.getMessage()); + return false; + } + // Make sure the player has beaten the necessary levels ParkourArenaGroup arenaGroup = MiniGames.getInstance().getParkourArenaHandler().getGroup(specifiedArena.getArenaId()); if (arenaGroup != null && !doGroupChecks(specifiedArena, arenaGroup, gameMode, player)) { diff --git a/src/main/java/net/knarcraft/minigames/config/Message.java b/src/main/java/net/knarcraft/minigames/config/Message.java index d9cebf9..4cd491d 100644 --- a/src/main/java/net/knarcraft/minigames/config/Message.java +++ b/src/main/java/net/knarcraft/minigames/config/Message.java @@ -135,6 +135,11 @@ public enum Message { */ ERROR_ILLEGAL_COMMAND("&cYou cannot use that command while in an arena!"), + /** + * The message displayed if the player is trying to join a parkour arena on hardcore which has no checkpoints + */ + ERROR_HARDCORE_NO_CHECKPOINTS("&cThis arena cannot be played in hardcore mode as it has no checkpoints!"), + /* **************** * * Success messages * * **************** */