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)
|
||||
{
|
||||
int exp = 0;
|
||||
int currentLevel = player.getLevel() + 1;
|
||||
|
||||
while (currentLevel > 0)
|
||||
{
|
||||
currentLevel--;
|
||||
exp += getExpToLevel(currentLevel);
|
||||
}
|
||||
return exp - getTotalExperience(player);
|
||||
int exp = (int)Math.round(getExpToLevel(player) * player.getExp());
|
||||
int nextLevel = player.getLevel() + 1;
|
||||
return getExpToLevel(nextLevel) - exp;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user