Updates the placeholder info to include parkour records

This commit is contained in:
Kristian Knarvik 2023-04-15 19:24:22 +02:00
parent 257fc48912
commit 6950246134
5 changed files with 14 additions and 9 deletions

View File

@ -151,11 +151,12 @@ Player records can be displayed on a leaderboard by using PlaceholderAPI. If you
leaderboard, you can use the [Placeholder Signs](https://git.knarcraft.net/EpicKnarvik97/PlaceholderSigns) plugin. The
format for the built-in placeholders is as follows:
`%dropper_record_recordType_gameModeType_identifierType_identifier_recordPlacing_infoType%`
`%gameMode_record_recordType_gameModeType_identifierType_identifier_recordPlacing_infoType%`
| Variable | Values | Description |
|----------------|-----------------------------|------------------------------------------------------------------------------------------------------------------------------------|
| dropper_record | | Denotes that it's a placeholder for a dropper record. Must be present as-is. |
| gameMode | dropper / parkour | A selection of which game-mode you are getting a record for |
| record | | This must be as-is. It's a selector in case placeholders are added for more than records. |
| recordType | deaths / time | Selects the type of record to get (deaths or time). |
| gameModeType | default / inverted / random | Selects the game-mode to get the record for. |
| identifierType | arena / group | The type of thing the following identifier points to (an arena or an arena group). |

View File

@ -171,7 +171,7 @@ public abstract class ArenaGroup<K extends Arena, S extends ArenaGroup<K, S>> im
* @return <p>True if the player is allowed to play the arena</p>
* @throws IllegalArgumentException <p>If checking an arena not in this group</p>
*/
public boolean canPlay(ArenaGameMode gameMode, Player player, UUID arenaId) throws IllegalArgumentException {
public boolean cannotPlay(ArenaGameMode gameMode, Player player, UUID arenaId) throws IllegalArgumentException {
if (!this.arenas.contains(arenaId)) {
throw new IllegalArgumentException("Cannot check for playability for arena not in this group!");
}
@ -179,7 +179,7 @@ public abstract class ArenaGroup<K extends Arena, S extends ArenaGroup<K, S>> im
for (UUID anArenaId : this.getArenas()) {
// If the target arena is reached, allow, as all previous arenas must have been cleared
if (arenaId.equals(anArenaId)) {
return true;
return false;
}
K arena = this.arenaHandler.getArena(anArenaId);
@ -192,11 +192,11 @@ public abstract class ArenaGroup<K extends Arena, S extends ArenaGroup<K, S>> im
// This is a lower-numbered arena the player has yet to complete
if (arena.getData().hasNotCompleted(gameMode, player)) {
return false;
return true;
}
}
return false;
return true;
}
/**

View File

@ -25,7 +25,11 @@ public enum ParkourArenaGameMode implements ConfigurationSerializable, ArenaGame
* @return <p>The specified arena game-mode</p>
*/
public static @NotNull ParkourArenaGameMode matchGamemode(@NotNull String gameMode) {
return ParkourArenaGameMode.DEFAULT;
try {
return ParkourArenaGameMode.valueOf(gameMode.toUpperCase());
} catch (IllegalArgumentException exception) {
return ParkourArenaGameMode.DEFAULT;
}
}
@NotNull

View File

@ -124,7 +124,7 @@ public class JoinDropperArenaCommand implements CommandExecutor {
// Require that the player has beaten the previous arena on the same game-mode before trying this one
if (configuration.mustDoGroupedInSequence() &&
!arenaGroup.canPlay(arenaGameMode, player, dropperArena.getArenaId())) {
arenaGroup.cannotPlay(arenaGameMode, player, dropperArena.getArenaId())) {
player.sendMessage("You have not yet beaten the previous arena!");
return false;
}

View File

@ -110,7 +110,7 @@ public class JoinParkourArenaCommand implements CommandExecutor {
// Require that the player has beaten the previous arena on the same game-mode before trying this one
if (configuration.mustDoGroupedInSequence() &&
!arenaGroup.canPlay(arenaGameMode, player, parkourArena.getArenaId())) {
arenaGroup.cannotPlay(arenaGameMode, player, parkourArena.getArenaId())) {
player.sendMessage("You have not yet beaten the previous arena!");
return false;
}