summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2012-08-03 10:33:45 +0200
committersnowleo <schneeleo@gmail.com>2012-08-03 10:33:45 +0200
commit6513842d28d03782b23159baafa39cc5dd70f527 (patch)
tree147965580c37cf41c66558a41ac0e58a95b301ae
parentc8a07ecdb5033da2644097d5ac5c891922b9bde8 (diff)
downloadEssentials-6513842d28d03782b23159baafa39cc5dd70f527.tar
Essentials-6513842d28d03782b23159baafa39cc5dd70f527.tar.gz
Essentials-6513842d28d03782b23159baafa39cc5dd70f527.tar.lz
Essentials-6513842d28d03782b23159baafa39cc5dd70f527.tar.xz
Essentials-6513842d28d03782b23159baafa39cc5dd70f527.zip
Less loops please
-rw-r--r--Essentials/src/com/earth2me/essentials/craftbukkit/SetExpFix.java12
1 files changed, 3 insertions, 9 deletions
diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/SetExpFix.java b/Essentials/src/com/earth2me/essentials/craftbukkit/SetExpFix.java
index d044d55d8..e4a226da0 100644
--- a/Essentials/src/com/earth2me/essentials/craftbukkit/SetExpFix.java
+++ b/Essentials/src/com/earth2me/essentials/craftbukkit/SetExpFix.java
@@ -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;
}
}