diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml
index 43bf1085..1609acba 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.0'
+ artifact_name: 'Parkour-7.2.1'
release_type: '-RELEASE'
on: push
diff --git a/README.md b/README.md
index 62e3c423..6e36ed06 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.0
+ 7.2.1
jar
provided
@@ -48,5 +48,5 @@ repositories {
```
```
-compile 'com.github.A5H73Y:Parkour:7.2.0'
+compile 'com.github.A5H73Y:Parkour:7.2.1'
```
diff --git a/docs/changelogs.md b/docs/changelogs.md
index 7d5d89fb..6fa8b6fd 100644
--- a/docs/changelogs.md
+++ b/docs/changelogs.md
@@ -3,6 +3,14 @@ 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.1
+
+* Added option to disable "OnCourse.ParkourKit.FloatingClosestBlock"
+* Improvement to use centre of each block when calculating closest block
+* Fixed various Challenge bugs
+* Fix NPE with placeholders
+* Update dependency versions
+
## 7.2.0
* Added ability to set a one-time fee for a course
diff --git a/docs/tutorials/parkour-courses.md b/docs/tutorials/parkour-courses.md
index 98dc3996..c759717c 100644
--- a/docs/tutorials/parkour-courses.md
+++ b/docs/tutorials/parkour-courses.md
@@ -246,8 +246,12 @@ _They **must** be uppercase._
* `%PLAYER_DISPLAY%` the Player's display name
* `%COURSE%` the Course's name
* `%DEATHS%` the amount of deaths accumulated
-* `%TIME%` the amount of time accumulated
* `%CHECKPOINT%` the current checkpoint number
+* `%TIME%` a formatted output of time accumulated
+* `%TIME_MS%` the total amount of milliseconds accumulated
+* `%TIME_S%` the total amount of seconds accumulated
+* `%TIME_M%` the total amount of minutes accumulated
+* `%TIME_H%` the total amount of hours accumulated
## Adding a Join Item
diff --git a/pom.xml b/pom.xml
index a7ad5185..c391ad1a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
4.0.0
io.github.a5h73y
Parkour
- 7.2.0
+ 7.2.1
jar
Parkour
diff --git a/src/main/java/io/github/a5h73y/parkour/listener/PlayerListener.java b/src/main/java/io/github/a5h73y/parkour/listener/PlayerListener.java
index 25fab83a..559fdea9 100644
--- a/src/main/java/io/github/a5h73y/parkour/listener/PlayerListener.java
+++ b/src/main/java/io/github/a5h73y/parkour/listener/PlayerListener.java
@@ -251,8 +251,8 @@ public void onPlayerDisconnect(PlayerQuitEvent event) {
parkour.getPlayerManager().teardownParkourPlayer(player);
- if (player.isBanned()
- && parkour.getParkourConfig().getBoolean("Other.OnPlayerBan.ResetParkourInfo")) {
+ if (parkour.getParkourConfig().getBoolean("Other.OnPlayerBan.ResetParkourInfo")
+ && player.isBanned()) {
parkour.getPlayerManager().resetPlayer(player);
}
}
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 1c994e4b..076e7bf6 100644
--- a/src/main/java/io/github/a5h73y/parkour/other/ParkourConstants.java
+++ b/src/main/java/io/github/a5h73y/parkour/other/ParkourConstants.java
@@ -26,6 +26,14 @@ public class ParkourConstants {
public static final String TIME_PLACEHOLDER = "%TIME%";
+ public static final String TIME_MS_PLACEHOLDER = "%TIME_MS%";
+
+ public static final String TIME_S_PLACEHOLDER = "%TIME_S%";
+
+ public static final String TIME_M_PLACEHOLDER = "%TIME_M%";
+
+ public static final String TIME_H_PLACEHOLDER = "%TIME_H%";
+
public static final String AMOUNT_PLACEHOLDER = "%AMOUNT%";
public static final String PARKOUR_RANK_PLACEHOLDER = "%RANK%";
diff --git a/src/main/java/io/github/a5h73y/parkour/type/player/session/ParkourSession.java b/src/main/java/io/github/a5h73y/parkour/type/player/session/ParkourSession.java
index 39266c06..8736831d 100644
--- a/src/main/java/io/github/a5h73y/parkour/type/player/session/ParkourSession.java
+++ b/src/main/java/io/github/a5h73y/parkour/type/player/session/ParkourSession.java
@@ -157,7 +157,11 @@ public long getCurrentTime() {
}
public String getDisplayTime() {
- return DateTimeUtils.displayCurrentTime(hasFinished() ? getTimeFinished() : getCurrentTime());
+ return DateTimeUtils.displayCurrentTime(getAccumulatedTime());
+ }
+
+ public long getAccumulatedTime() {
+ return hasFinished() ? getTimeFinished() : getCurrentTime();
}
public void recalculateTime() {
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 5e67780c..b5fb575a 100644
--- a/src/main/java/io/github/a5h73y/parkour/utility/TranslationUtils.java
+++ b/src/main/java/io/github/a5h73y/parkour/utility/TranslationUtils.java
@@ -7,7 +7,11 @@
import static io.github.a5h73y.parkour.other.ParkourConstants.DEATHS_PLACEHOLDER;
import static io.github.a5h73y.parkour.other.ParkourConstants.PLAYER_DISPLAY_PLACEHOLDER;
import static io.github.a5h73y.parkour.other.ParkourConstants.PLAYER_PLACEHOLDER;
+import static io.github.a5h73y.parkour.other.ParkourConstants.TIME_H_PLACEHOLDER;
+import static io.github.a5h73y.parkour.other.ParkourConstants.TIME_MS_PLACEHOLDER;
+import static io.github.a5h73y.parkour.other.ParkourConstants.TIME_M_PLACEHOLDER;
import static io.github.a5h73y.parkour.other.ParkourConstants.TIME_PLACEHOLDER;
+import static io.github.a5h73y.parkour.other.ParkourConstants.TIME_S_PLACEHOLDER;
import static io.github.a5h73y.parkour.other.ParkourConstants.TOTAL_CHECKPOINT_PLACEHOLDER;
import static io.github.a5h73y.parkour.utility.StringUtils.colour;
@@ -16,6 +20,8 @@
import io.github.a5h73y.parkour.type.player.session.ParkourSession;
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;
@@ -392,11 +398,16 @@ public static void announceParkourMessage(Player player, String scope, String me
* @return updated input message
*/
public static String replaceAllParkourPlaceholders(String input, Player player, ParkourSession session) {
+ MillisecondConverter converter = new MillisecondConverter(session.getAccumulatedTime());
String result = input.replace(PLAYER_PLACEHOLDER, player.getName())
.replace(PLAYER_DISPLAY_PLACEHOLDER, player.getDisplayName())
.replace(COURSE_PLACEHOLDER, session.getCourse().getDisplayName())
.replace(DEATHS_PLACEHOLDER, String.valueOf(session.getDeaths()))
.replace(TIME_PLACEHOLDER, session.getDisplayTime())
+ .replace(TIME_MS_PLACEHOLDER, String.valueOf(session.getAccumulatedTime()))
+ .replace(TIME_S_PLACEHOLDER, String.valueOf(converter.getTotalSeconds()))
+ .replace(TIME_M_PLACEHOLDER, String.valueOf(converter.getTotalMinutes()))
+ .replace(TIME_H_PLACEHOLDER, String.valueOf(converter.getTotalHours()))
.replace(CHECKPOINT_PLACEHOLDER, String.valueOf(session.getCurrentCheckpoint()))
.replace(TOTAL_CHECKPOINT_PLACEHOLDER, String.valueOf(session.getCourse().getNumberOfCheckpoints()));
return Parkour.getInstance().getPlaceholderApi().parsePlaceholders(player, result);
diff --git a/src/main/java/io/github/a5h73y/parkour/utility/cache/GenericCache.java b/src/main/java/io/github/a5h73y/parkour/utility/cache/GenericCache.java
index 9d60fdd1..335e2914 100644
--- a/src/main/java/io/github/a5h73y/parkour/utility/cache/GenericCache.java
+++ b/src/main/java/io/github/a5h73y/parkour/utility/cache/GenericCache.java
@@ -53,7 +53,8 @@ protected Set getExpiredKeys() {
protected boolean isExpired(K key) {
boolean result = true;
if (this.cacheMap.containsKey(key)) {
- LocalDateTime expirationDateTime = this.cacheMap.get(key).getCreatedAt().plus(this.cacheTimeout, ChronoUnit.SECONDS);
+ LocalDateTime expirationDateTime = this.cacheMap.get(key)
+ .getCreatedAt().plus(this.cacheTimeout, ChronoUnit.SECONDS);
result = LocalDateTime.now().isAfter(expirationDateTime);
}
return result;
diff --git a/src/main/java/io/github/a5h73y/parkour/utility/time/MillisecondConverter.java b/src/main/java/io/github/a5h73y/parkour/utility/time/MillisecondConverter.java
index f5b32d32..78f78c8d 100644
--- a/src/main/java/io/github/a5h73y/parkour/utility/time/MillisecondConverter.java
+++ b/src/main/java/io/github/a5h73y/parkour/utility/time/MillisecondConverter.java
@@ -41,6 +41,10 @@ public void setSeconds(long seconds) {
this.seconds = seconds;
}
+ public long getTotalSeconds() {
+ return seconds;
+ }
+
public long getMinutes() {
return minutes % 60;
}
@@ -49,6 +53,10 @@ public void setMinutes(long minutes) {
this.minutes = minutes;
}
+ public long getTotalMinutes() {
+ return minutes;
+ }
+
public long getHours() {
return hours % 24;
}
@@ -57,6 +65,10 @@ public void setHours(long hours) {
this.hours = hours;
}
+ public long getTotalHours() {
+ return hours;
+ }
+
public long getDays() {
return days;
}