diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml index 00cb7208..6da64513 100644 --- a/.github/workflows/maven-build.yml +++ b/.github/workflows/maven-build.yml @@ -1,7 +1,7 @@ name: Build env: - artifact_name: 'Parkour-7.2.2' + artifact_name: 'Parkour-7.2.3' release_type: '-RELEASE' on: push diff --git a/README.md b/README.md index 7e3798a6..bfd8feb4 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ For the list of known supported plugins and tutorials on how to set them up, [cl com.github.A5H73Y Parkour - 7.2.2 + 7.2.3 jar provided @@ -48,5 +48,5 @@ repositories { ``` ``` -compile 'com.github.A5H73Y:Parkour:7.2.2' +compile 'com.github.A5H73Y:Parkour:7.2.3' ``` diff --git a/docs/changelogs.md b/docs/changelogs.md index a28ee3df..69576f49 100644 --- a/docs/changelogs.md +++ b/docs/changelogs.md @@ -3,6 +3,12 @@ Changelogs Please note that each version of Parkour is backwards compatible with the previous version and will automatically upgrade your config upon server start up. There will be no manual intervention, unless stated in breaking changes. +## 7.2.3 + +* Added "%COURSE_NAME%" internal placeholder +* Rearranged events to ensure Record events happen before Finish event +* Bumped dependencies & optimised build size + ## 7.2.2 * Added "OnCourse.ManualCheckpointAnyPressurePlate" setting diff --git a/docs/guides/compatible-plugins.md b/docs/guides/compatible-plugins.md index b5df94ef..c4946fb9 100644 --- a/docs/guides/compatible-plugins.md +++ b/docs/guides/compatible-plugins.md @@ -262,14 +262,14 @@ To achieve seamless integration with the plugin, Parkour's event command system To apply to every single Course, set the `CourseDefault.Command.Join` to: -`replay start %PLAYER%-%COURSE% %PLAYER%` +`replay start %PLAYER%-%COURSE_NAME% %PLAYER%` This means only the Player which joined the Course is recorded, the recording name will be a combination of the Player's name and the Course name. To avoid complications, the recording will only be saved if they complete the Course with either their best time ever, or the Course's best time ever. All other events will discard the recording. -Set the `Leave`, `Finish` commands to `replay stop %PLAYER%-%COURSE% -nosave` +Set the `Leave`, `Finish` commands to `replay stop %PLAYER%-%COURSE_NAME% -nosave` -Set the `PlayerCourseRecord` and `GlobalCourseRecord` commands to `replay stop %PLAYER%-%COURSE% -force` +Set the `PlayerCourseRecord` and `GlobalCourseRecord` commands to `replay stop %PLAYER%-%COURSE_NAME% -force` -Now you can use `/replay play (player)-(course)` to see that Player's best time on the Course. Also, if you have PlaceholderAPI integration you could evaluate the best Player on a given Course to see the best Course time run. +Now you can use `/replay play (player)-(course)` to see that Player's best time on the Course. Also, if you have PlaceholderAPI integration you could evaluate the best player's name using `%parkour_course_record_(course)_player%` when wanting to watch the best player's run for the given Course. diff --git a/pom.xml b/pom.xml index b52a5cf2..43ac1449 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 io.github.a5h73y Parkour - 7.2.2 + 7.2.3 jar Parkour @@ -112,14 +112,12 @@ org.bstats bstats-bukkit 3.0.2 - compile com.github.Huskehhh MySQL 63040a058d - compile org.slf4j @@ -132,21 +130,18 @@ de.themoep inventorygui 1.5-SNAPSHOT - compile com.github.cryptomorin XSeries - 9.8.0 - compile + 10.0.0 io.github.g00fy2 versioncompare 1.5.0 - compile @@ -159,16 +154,31 @@ org.yaml snakeyaml 2.2 + provided com.google.code.gson gson 2.10.1 + provided org.json json - 20231013 + 20240303 + provided + + + com.esotericsoftware.yamlbeans + yamlbeans + 1.17 + provided + + + com.google.guava + guava + 33.2.0-jre + provided @@ -179,6 +189,10 @@ src/main/resources + + parkourPlaceholders.json + parkourCheckstyles.xml + true @@ -187,7 +201,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.12.0 + 3.13.0 ${java.version} ${java.version} @@ -197,7 +211,7 @@ org.apache.maven.plugins maven-jar-plugin - 3.3.0 + 3.4.1 ${export_dir} @@ -206,7 +220,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.5.1 + 3.5.3 false true diff --git a/src/main/java/io/github/a5h73y/parkour/other/ParkourConstants.java b/src/main/java/io/github/a5h73y/parkour/other/ParkourConstants.java index 076e7bf6..fcca0e0d 100644 --- a/src/main/java/io/github/a5h73y/parkour/other/ParkourConstants.java +++ b/src/main/java/io/github/a5h73y/parkour/other/ParkourConstants.java @@ -14,6 +14,8 @@ public class ParkourConstants { public static final String COURSE_PLACEHOLDER = "%COURSE%"; + public static final String COURSE_NAME_PLACEHOLDER = "%COURSE_NAME%"; + public static final String PLAYER_PLACEHOLDER = "%PLAYER%"; public static final String PLAYER_DISPLAY_PLACEHOLDER = "%PLAYER_DISPLAY%"; 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 36829d54..77477fa6 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 @@ -565,11 +565,11 @@ public void finishCourse(final Player player) { playerConfig.setLastCompletedCourse(courseName); playerConfig.setExistingSessionCourseName(null); + submitPlayerLeaderboard(player, session); parkour.getParkourSessionManager().forceVisible(player); parkour.getParkourSessionManager().deleteParkourSession(player, courseName); parkour.getCourseManager().runEventCommands(player, session, FINISH); parkour.getConfigManager().getCourseConfig(courseName).incrementCompletions(); - submitPlayerLeaderboard(player, session); } /** diff --git a/src/main/java/io/github/a5h73y/parkour/utility/TranslationUtils.java b/src/main/java/io/github/a5h73y/parkour/utility/TranslationUtils.java index b5fb575a..fe9e7a0d 100644 --- a/src/main/java/io/github/a5h73y/parkour/utility/TranslationUtils.java +++ b/src/main/java/io/github/a5h73y/parkour/utility/TranslationUtils.java @@ -3,6 +3,7 @@ import static io.github.a5h73y.parkour.other.ParkourConstants.ARGUMENTS_PLACEHOLDER; import static io.github.a5h73y.parkour.other.ParkourConstants.CHECKPOINT_PLACEHOLDER; import static io.github.a5h73y.parkour.other.ParkourConstants.COMMAND_PLACEHOLDER; +import static io.github.a5h73y.parkour.other.ParkourConstants.COURSE_NAME_PLACEHOLDER; import static io.github.a5h73y.parkour.other.ParkourConstants.COURSE_PLACEHOLDER; import static io.github.a5h73y.parkour.other.ParkourConstants.DEATHS_PLACEHOLDER; import static io.github.a5h73y.parkour.other.ParkourConstants.PLAYER_DISPLAY_PLACEHOLDER; @@ -18,10 +19,9 @@ import io.github.a5h73y.parkour.Parkour; import io.github.a5h73y.parkour.type.course.ParkourEventType; import io.github.a5h73y.parkour.type.player.session.ParkourSession; +import io.github.a5h73y.parkour.utility.time.MillisecondConverter; import java.util.regex.Matcher; import java.util.regex.Pattern; - -import io.github.a5h73y.parkour.utility.time.MillisecondConverter; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -45,7 +45,7 @@ public class TranslationUtils { * @return String of appropriate translation */ public static String getTranslation(@Nullable String translationKey, - boolean prefix) { + boolean prefix) { if (!ValidationUtils.isStringValid(translationKey)) { return "Invalid translation."; } @@ -84,8 +84,8 @@ public static String getTranslation(@Nullable String translationKey) { * @return String of appropriate translation */ public static String getValueTranslation(@Nullable String translationKey, - @Nullable String value, - boolean prefix) { + @Nullable String value, + boolean prefix) { return VALUE_PLACEHOLDER.matcher(getTranslation(translationKey, prefix)) .replaceAll(value == null ? "" : Matcher.quoteReplacement(value)); } @@ -101,8 +101,8 @@ public static String getValueTranslation(@Nullable String translationKey, * @return String of appropriate translation */ public static String getValueTranslation(@Nullable String translationKey, - @Nullable Number value, - boolean prefix) { + @Nullable Number value, + boolean prefix) { return getValueTranslation(translationKey, String.valueOf(value), prefix); } @@ -116,7 +116,7 @@ public static String getValueTranslation(@Nullable String translationKey, * @return String of appropriate translation */ public static String getValueTranslation(@Nullable String translationKey, - @Nullable String value) { + @Nullable String value) { return getValueTranslation(translationKey, value, true); } @@ -131,8 +131,8 @@ public static String getValueTranslation(@Nullable String translationKey, * @return course event message */ public static String getCourseEventMessage(@NotNull ParkourSession session, - @NotNull ParkourEventType eventType, - @Nullable String fallbackKey) { + @NotNull ParkourEventType eventType, + @Nullable String fallbackKey) { String result = Parkour.getInstance().getConfigManager().getCourseConfig(session.getCourseName()) .getEventMessage(eventType); @@ -152,7 +152,7 @@ public static String getCourseEventMessage(@NotNull ParkourSession session, * @param recipients targets to receive the message */ public static void sendTranslation(@Nullable String translationKey, boolean prefix, - @Nullable CommandSender... recipients) { + @Nullable CommandSender... recipients) { String translation = getTranslation(translationKey, prefix); if (recipients != null && !translation.isEmpty()) { for (CommandSender recipient : recipients) { @@ -168,7 +168,7 @@ public static void sendTranslation(@Nullable String translationKey, boolean pref * @param players to receive the message */ public static void sendTranslation(@Nullable String translationKey, - @Nullable CommandSender... players) { + @Nullable CommandSender... players) { sendTranslation(translationKey, true, players); } @@ -180,8 +180,8 @@ public static void sendTranslation(@Nullable String translationKey, * @param players targets to receive the message */ public static void sendValueTranslation(@Nullable String translationKey, - @Nullable String value, - @Nullable CommandSender... players) { + @Nullable String value, + @Nullable CommandSender... players) { sendValueTranslation(translationKey, value, true, players); } @@ -193,8 +193,8 @@ public static void sendValueTranslation(@Nullable String translationKey, * @param recipients targets to receive the message */ public static void sendValueTranslation(@Nullable String translationKey, - @Nullable String value, boolean prefix, - @Nullable CommandSender... recipients) { + @Nullable String value, boolean prefix, + @Nullable CommandSender... recipients) { String translation = getValueTranslation(translationKey, value, prefix); if (recipients != null && !translation.isEmpty()) { for (CommandSender recipient : recipients) { @@ -402,6 +402,7 @@ public static String replaceAllParkourPlaceholders(String input, Player player, String result = input.replace(PLAYER_PLACEHOLDER, player.getName()) .replace(PLAYER_DISPLAY_PLACEHOLDER, player.getDisplayName()) .replace(COURSE_PLACEHOLDER, session.getCourse().getDisplayName()) + .replace(COURSE_NAME_PLACEHOLDER, session.getCourse().getName()) .replace(DEATHS_PLACEHOLDER, String.valueOf(session.getDeaths())) .replace(TIME_PLACEHOLDER, session.getDisplayTime()) .replace(TIME_MS_PLACEHOLDER, String.valueOf(session.getAccumulatedTime()))