mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-10 18:38:18 +01:00
Less loops please
This commit is contained in:
parent
c8a07ecdb5
commit
6513842d28
@ -74,14 +74,8 @@ public class SetExpFix
|
|||||||
|
|
||||||
public static int getExpUntilNextLevel(final Player player)
|
public static int getExpUntilNextLevel(final Player player)
|
||||||
{
|
{
|
||||||
int exp = 0;
|
int exp = (int)Math.round(getExpToLevel(player) * player.getExp());
|
||||||
int currentLevel = player.getLevel() + 1;
|
int nextLevel = player.getLevel() + 1;
|
||||||
|
return getExpToLevel(nextLevel) - exp;
|
||||||
while (currentLevel > 0)
|
|
||||||
{
|
|
||||||
currentLevel--;
|
|
||||||
exp += getExpToLevel(currentLevel);
|
|
||||||
}
|
|
||||||
return exp - getTotalExperience(player);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user