Skip to content

Commit

Permalink
idk
Browse files Browse the repository at this point in the history
  • Loading branch information
Xinecraft committed Jan 12, 2024
1 parent a33349a commit 7c709bb
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,16 @@ private void trackDistanceTravelled(PlayerMoveEvent event, Player player, Player
// Track total distance travelled
playerSessionIntelData.distance_traveled_xmin += distance;

boolean isSwimming = false;
try {
isSwimming = (boolean) player.getClass().getMethod("isSwimming").invoke(player);
} catch (Exception e) {
// log
}
// Categorize and track distance based on movement type
if (player.isFlying() || player.isGliding()) {
playerSessionIntelData.distance_traveled_on_air_xmin += distance;
} else if (player.isSwimming()) {
} else if (isSwimming) {
playerSessionIntelData.distance_traveled_on_water_xmin += distance;
} else {
playerSessionIntelData.distance_traveled_on_land_xmin += distance;
Expand Down

0 comments on commit 7c709bb

Please sign in to comment.