Skip to content

Commit

Permalink
Improvements on User#getStat
Browse files Browse the repository at this point in the history
  • Loading branch information
Despical committed Dec 5, 2023
1 parent 1017822 commit 37b0c24
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/main/java/me/despical/kotl/user/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,7 @@ public UUID getUniqueId() {
}

public int getStat(StatsStorage.StatisticType statisticType) {
final var statistic = stats.get(statisticType);

if (statistic == null) {
stats.put(statisticType, 0);
return 0;
}

return statistic;
return stats.computeIfAbsent(statisticType, stat -> 0);
}

public void setStat(StatsStorage.StatisticType stat, int value) {
Expand Down

0 comments on commit 37b0c24

Please sign in to comment.