Skip to content

Commit bc784b8

Browse files
committed
fix elytra flight calculations
fixes #74
1 parent f5ddada commit bc784b8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/lol/hyper/toolstats/events/PlayerMove.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,14 @@ private void trackFlight(Player player, long startTime) {
8686
}
8787

8888
// get the duration of the flight
89-
long duration = (System.currentTimeMillis() - startTime) + flightTime;
89+
long duration = (System.currentTimeMillis() - startTime);
90+
double newDuration = flightTime + duration;
9091
container.set(toolStats.flightTime, PersistentDataType.LONG, flightTime + duration);
9192

9293
// do we add the lore based on the config?
9394
if (toolStats.config.getBoolean("enabled.flight-time")) {
9495
String oldFlightFormatted = toolStats.numberFormat.formatDouble((double) flightTime / 1000);
95-
String newFlightFormatted = toolStats.numberFormat.formatDouble((double) (flightTime + duration) / 1000);
96+
String newFlightFormatted = toolStats.numberFormat.formatDouble(newDuration / 1000);
9697
String oldLine = toolStats.configTools.formatLore("flight-time", "{time}", oldFlightFormatted);
9798
String newLine = toolStats.configTools.formatLore("flight-time", "{time}", newFlightFormatted);
9899
if (oldLine == null || newLine == null) {

0 commit comments

Comments
 (0)