From a643bafc84a0604b608d5fa4e44eaae6bc4d4607 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Mon, 31 Oct 2022 21:18:13 +0000 Subject: [PATCH 1/5] fix length check of parkour_player_course placeholder --- src/main/java/io/github/a5h73y/parkour/ParkourPlaceholders.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/a5h73y/parkour/ParkourPlaceholders.java b/src/main/java/io/github/a5h73y/parkour/ParkourPlaceholders.java index 0cdeded8..6485fd23 100644 --- a/src/main/java/io/github/a5h73y/parkour/ParkourPlaceholders.java +++ b/src/main/java/io/github/a5h73y/parkour/ParkourPlaceholders.java @@ -192,7 +192,7 @@ private String getPlayerPlaceholderValue(OfflinePlayer offlinePlayer, String... } case "course": - if (arguments.length < 3) { + if (arguments.length < 4) { return INVALID_SYNTAX; } From 00730c001e8b23ce8aa48e70b549379c32999175 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Mon, 31 Oct 2022 22:08:12 +0000 Subject: [PATCH 2/5] add missing parkour_current_checkpoint_next placeholder --- .../java/io/github/a5h73y/parkour/ParkourPlaceholders.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/io/github/a5h73y/parkour/ParkourPlaceholders.java b/src/main/java/io/github/a5h73y/parkour/ParkourPlaceholders.java index 6485fd23..b8d8ee67 100644 --- a/src/main/java/io/github/a5h73y/parkour/ParkourPlaceholders.java +++ b/src/main/java/io/github/a5h73y/parkour/ParkourPlaceholders.java @@ -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; From 2d5e7a5b6bb61afcd8a4e23344d801d5315f4eb8 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Tue, 1 Nov 2022 16:12:36 +0000 Subject: [PATCH 3/5] fix player_course_position placeholder not working if player has > 1 time recorded in DB --- .../java/io/github/a5h73y/parkour/database/DatabaseManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/a5h73y/parkour/database/DatabaseManager.java b/src/main/java/io/github/a5h73y/parkour/database/DatabaseManager.java index b65a895a..ea013656 100644 --- a/src/main/java/io/github/a5h73y/parkour/database/DatabaseManager.java +++ b/src/main/java/io/github/a5h73y/parkour/database/DatabaseManager.java @@ -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); From aaa8c7b3c8a19ae811da6f7dfe65fea211e54975 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Tue, 1 Nov 2022 16:21:06 +0000 Subject: [PATCH 4/5] update docs with DecentHolograms example --- docs/guides/compatible-plugins.md | 57 ++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/docs/guides/compatible-plugins.md b/docs/guides/compatible-plugins.md index 712cb232..490d6887 100644 --- a/docs/guides/compatible-plugins.md +++ b/docs/guides/compatible-plugins.md @@ -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". + +
Parkour Leaderboards (Click to expand) + +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. + +
+ +
Parkour Course Best Player (Click to expand) + +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%` + +
+ +
Next Checkpoint (Click to expand) + +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%` + +
+ ## 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.** @@ -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) From c2a45df52a3446c322729fc1c25c0496862e993e Mon Sep 17 00:00:00 2001 From: BuildTools Date: Tue, 1 Nov 2022 17:32:54 +0000 Subject: [PATCH 5/5] reset player snapshot after teleport to avoid deleting join location --- .../io/github/a5h73y/parkour/type/player/PlayerManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/a5h73y/parkour/type/player/PlayerManager.java b/src/main/java/io/github/a5h73y/parkour/type/player/PlayerManager.java index 2d26f674..75388bad 100644 --- a/src/main/java/io/github/a5h73y/parkour/type/player/PlayerManager.java +++ b/src/main/java/io/github/a5h73y/parkour/type/player/PlayerManager.java @@ -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"));