Skip to content

Commit

Permalink
Refactored getPlayer() method
Browse files Browse the repository at this point in the history
  • Loading branch information
WaterArchery committed Sep 22, 2024
1 parent 725aaec commit 512afb4
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.bukkit.scheduler.BukkitTask;

import java.util.HashMap;
import java.util.Optional;

public class TournamentLeaderboard {

Expand All @@ -27,8 +28,8 @@ public int getPlayerPos(TournamentPlayer tournamentPlayer) {
return 0;
}

public TournamentValue getPlayer(int pos) {
return leaderboard.getOrDefault(pos, null);
public Optional<TournamentValue> getPlayer(int pos) {
return Optional.ofNullable(leaderboard.getOrDefault(pos, null));
}

public void startRefreshTask() {
Expand Down

0 comments on commit 512afb4

Please sign in to comment.