diff --git a/src/util/games/skywars/ExpCalculator.php b/src/util/games/skywars/ExpCalculator.php index cf0c506..63e070a 100644 --- a/src/util/games/skywars/ExpCalculator.php +++ b/src/util/games/skywars/ExpCalculator.php @@ -74,10 +74,9 @@ public function getTotalExpForLevel($level) { * @param $level * @return mixed */ - public function getPrestigeForLevel($prestiges, $level) { - foreach ($prestiges as $i => $prestige) { - $nextPrestige = $prestiges[$i + 1]; - if ($level >= $prestige["RequiredLevel"] && $level < $nextPrestige["RequiredLevel"]) { + public function getPrestigeForLevel(array $prestiges, $level) { + foreach (array_reverse($prestiges) as $prestige) { + if ($level >= $prestige["RequiredLevel"]) { return $prestige; } } diff --git a/tests/games/bedwars/LevelTest.php b/tests/games/bedwars/LevelTest.php index 19e9d08..5e6ceb0 100644 --- a/tests/games/bedwars/LevelTest.php +++ b/tests/games/bedwars/LevelTest.php @@ -1,6 +1,6 @@