From 512afb4401366036ec8376573b5b26fbbb863b84 Mon Sep 17 00:00:00 2001 From: Arda Date: Sun, 22 Sep 2024 12:40:31 +0300 Subject: [PATCH] Refactored getPlayer() method --- .../littournaments/models/TournamentLeaderboard.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/waterarchery/littournaments/models/TournamentLeaderboard.java b/src/main/java/me/waterarchery/littournaments/models/TournamentLeaderboard.java index 7a8c622..bbe3b41 100644 --- a/src/main/java/me/waterarchery/littournaments/models/TournamentLeaderboard.java +++ b/src/main/java/me/waterarchery/littournaments/models/TournamentLeaderboard.java @@ -6,6 +6,7 @@ import org.bukkit.scheduler.BukkitTask; import java.util.HashMap; +import java.util.Optional; public class TournamentLeaderboard { @@ -27,8 +28,8 @@ public int getPlayerPos(TournamentPlayer tournamentPlayer) { return 0; } - public TournamentValue getPlayer(int pos) { - return leaderboard.getOrDefault(pos, null); + public Optional getPlayer(int pos) { + return Optional.ofNullable(leaderboard.getOrDefault(pos, null)); } public void startRefreshTask() {