mirror of
https://github.com/SunNetservers/MiniGames.git
synced 2024-12-05 00:43:15 +01:00
Denies playing hardcore in a no-checkpoint arena
This commit is contained in:
parent
e039840e89
commit
fc1902e86a
@ -222,6 +222,15 @@ public class ParkourArena implements Arena {
|
|||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets whether this arena has no checkpoints
|
||||||
|
*
|
||||||
|
* @return <p>True if this arena has no checkpoints</p>
|
||||||
|
*/
|
||||||
|
public boolean hasNoCheckpoints() {
|
||||||
|
return this.checkpoints.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets this arena's sanitized name
|
* Gets this arena's sanitized name
|
||||||
*
|
*
|
||||||
|
@ -18,7 +18,7 @@ public enum ParkourArenaGameMode implements ConfigurationSerializable, ArenaGame
|
|||||||
DEFAULT,
|
DEFAULT,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A hard-core game mode where no checkpoints are allowed
|
* A hardcore game mode where no checkpoints are allowed
|
||||||
*/
|
*/
|
||||||
HARDCORE,
|
HARDCORE,
|
||||||
;
|
;
|
||||||
|
@ -71,6 +71,12 @@ public class JoinParkourArenaCommand implements CommandExecutor {
|
|||||||
gameMode = ParkourArenaGameMode.DEFAULT;
|
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
|
// Make sure the player has beaten the necessary levels
|
||||||
ParkourArenaGroup arenaGroup = MiniGames.getInstance().getParkourArenaHandler().getGroup(specifiedArena.getArenaId());
|
ParkourArenaGroup arenaGroup = MiniGames.getInstance().getParkourArenaHandler().getGroup(specifiedArena.getArenaId());
|
||||||
if (arenaGroup != null && !doGroupChecks(specifiedArena, arenaGroup, gameMode, player)) {
|
if (arenaGroup != null && !doGroupChecks(specifiedArena, arenaGroup, gameMode, player)) {
|
||||||
|
@ -135,6 +135,11 @@ public enum Message {
|
|||||||
*/
|
*/
|
||||||
ERROR_ILLEGAL_COMMAND("&cYou cannot use that command while in an arena!"),
|
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 *
|
* Success messages *
|
||||||
* **************** */
|
* **************** */
|
||||||
|
Loading…
Reference in New Issue
Block a user