Skip to content

Commit

Permalink
Merge pull request #332 from steve4744/master
Browse files Browse the repository at this point in the history
reset player snapshot after teleport to avoid deleting join location
  • Loading branch information
A5H73Y authored Nov 2, 2022
2 parents 9e4b0a2 + c2a45df commit e719aa0
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 4 deletions.
57 changes: 56 additions & 1 deletion docs/guides/compatible-plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,61 @@ The `Plugin.PlaceholderAPI.CacheTime` value can be set to an interval in minutes

[All the Parkour Placeholders are available here](/essential/placeholders.md).

## Decent Holograms

Parkour doesn't directly support [Decent Holograms](https://www.spigotmc.org/resources/decentholograms.96927/), however it can use PlaceholderAPI to create dynamic and nice looking Parkour holograms.

### Example usages

We can create a few examples of what is now possible. For demonstration purposes, I will be using a Course named "tutorial".

<details><summary>Parkour Leaderboards (Click to expand)</summary>

First we create a new Parkour leaderboard Hologram using the command and giving it a title.
`/dh create Leaderboard_tutorial Parkour Leaderboard - Tutorial`

Add a line for each position you want on the leaderboard (up to 10):

`/dh line add Leaderboard_tutorial 1 %parkour_topten_tutorial_1%`
`/dh line add Leaderboard_tutorial 1 %parkour_topten_tutorial_2%`
`/dh line add Leaderboard_tutorial 1 %parkour_topten_tutorial_3%`

Above we are using the Parkour placeholder `%parkour_topten_(course)_(position)%`.
There is an entry in the `strings.yml` named `PlaceholderAPI.TopTenResult` which will allow you to customise the appearance and colours used.

</details>

<details><summary>Parkour Course Best Player (Click to expand)</summary>

First we create a new Parkour leader Hologram using the command and giving it a title.
`/dh create Leader_tutorial Parkour Leader - Tutorial`

Add a line for each detail you want to display:

`/dh line add Leader_tutorial 1 Best Player: %parkour_leaderboard_tutorial_1_player%`
`/dh line add Leader_tutorial 1 Time: %parkour_leaderboard_tutorial_1_time%`
`/dh line add Leader_tutorial 1 Deaths: %parkour_leaderboard_tutorial_1_deaths%`

</details>

<details><summary>Next Checkpoint (Click to expand)</summary>

Display the next checkpoint for the Player to achieve, which displays a hologram above the pressure plate / action required to achieve the checkpoint.

For example, when checkpoint 2 is achieved only the hologram for checkpoint 3 will be visible.

![Next Checkpoint Example](https://i.imgur.com/JcnQsz6.png "Next Checkpoint Example")

Stand over the place where you want the pressure plate to be and enter

`/dh create (course)_checkpoint_(checkpoint) %parkour_current_checkpoint_hologram_(course)_(checkpoint)%`

For example:

`/dh create tutorial_checkpoint_3 %parkour_current_checkpoint_hologram_tutorial_3%`

</details>

## Holographic Displays (v3.0.0+)

**At the time of writing, Holographic Displays v3.0.0 is still in beta and has some known issues and could change in the future.**
Expand Down Expand Up @@ -84,7 +139,7 @@ For example:

## Holographic Displays (v2.x.x)

Parkour doesn't directly support [Holographic Displays](https://dev.bukkit.org/projects/holographic-displays/files), however you can use PlaceholderAPI which allows you to create dynamic and nice looking Parkour holograms.
Parkour doesn't directly support [Holographic Displays](https://dev.bukkit.org/projects/holographic-displays/files), however it can use PlaceholderAPI to create dynamic and nice looking Parkour holograms.

You will need to install the following plugins to achieve this:
* [Holographic Displays](https://dev.bukkit.org/projects/holographic-displays?gameCategorySlug=bukkit-plugins&projectID=75097)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ private String getPlayerPlaceholderValue(OfflinePlayer offlinePlayer, String...
}

case "course":
if (arguments.length < 3) {
if (arguments.length < 4) {
return INVALID_SYNTAX;
}

Expand Down Expand Up @@ -345,6 +345,10 @@ private String getCurrentCheckpointPlaceholderValue(Player player, ParkourSessio
case "number":
return String.valueOf(session.getCurrentCheckpoint());

case "next":
return session.getCurrentCheckpoint() < session.getCourse().getNumberOfCheckpoints()
? String.valueOf(session.getCurrentCheckpoint() + 1) : "";

case "hologram":
if (arguments.length != 5 || !ValidationUtils.isInteger(arguments[4])) {
return INVALID_SYNTAX;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public int getPositionOnLeaderboard(OfflinePlayer player, String courseName) {

if (courseId > 0 && hasPlayerAchievedTime(player, courseName)) {
String leaderboardPositionQuery = "SELECT COUNT(*) AS position FROM time WHERE courseId=? AND time < " +
"(SELECT time FROM time WHERE courseId=? AND playerId=?)";
"(SELECT time FROM time WHERE courseId=? AND playerId=? ORDER BY time LIMIT 1)";

PluginUtils.debug("Checking leaderboard position for: " + leaderboardPositionQuery);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -519,9 +519,9 @@ public void finishCourse(final Player player) {
rewardPrize(player, session);
} else {
restorePlayerData(player, playerConfig);
playerConfig.resetPlayerDataSnapshot();
rewardPrize(player, session);
teleportCourseCompletion(player, courseName);
playerConfig.resetPlayerDataSnapshot();
}
parkour.getConfigManager().getCourseCompletionsConfig().addCompletedCourse(player, courseName);
}, parkour.getParkourConfig().getLong("OnFinish.TeleportDelay"));
Expand Down

0 comments on commit e719aa0

Please sign in to comment.