diff options
author | KHobbits <rob@khobbits.co.uk> | 2012-03-17 03:38:32 +0000 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2012-03-17 03:38:32 +0000 |
commit | e4ce814c2f3ff919ad77d2b3845f996a09bfc327 (patch) | |
tree | b0c6e0d248a9b7f997a447e718534e8df90969a2 | |
parent | 87cd6930208560b206a32ec047c75342423c940a (diff) | |
download | Essentials-e4ce814c2f3ff919ad77d2b3845f996a09bfc327.tar Essentials-e4ce814c2f3ff919ad77d2b3845f996a09bfc327.tar.gz Essentials-e4ce814c2f3ff919ad77d2b3845f996a09bfc327.tar.lz Essentials-e4ce814c2f3ff919ad77d2b3845f996a09bfc327.tar.xz Essentials-e4ce814c2f3ff919ad77d2b3845f996a09bfc327.zip |
Comments to SetExpFix.
-rw-r--r-- | Essentials/src/com/earth2me/essentials/craftbukkit/SetExpFix.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/SetExpFix.java b/Essentials/src/com/earth2me/essentials/craftbukkit/SetExpFix.java index 5b1161851..70d15b856 100644 --- a/Essentials/src/com/earth2me/essentials/craftbukkit/SetExpFix.java +++ b/Essentials/src/com/earth2me/essentials/craftbukkit/SetExpFix.java @@ -5,6 +5,8 @@ import org.bukkit.entity.Player; public class SetExpFix { + //This method is used to update both the recorded total experience and displayed total experience. + //We reset both types to prevent issues. public static void setTotalExperience(final Player player, final int exp) { if (exp < 0) @@ -14,6 +16,9 @@ public class SetExpFix player.setExp(0); player.setLevel(0); player.setTotalExperience(0); + + //This following code is technically redundant now, as bukkit now calulcates levels more or less correctly + //At larger numbers however... player.getExp(3000), only seems to give 2999, putting the below calculations off. int amount = exp; while (amount > 0) { @@ -44,6 +49,8 @@ public class SetExpFix return 7 + (level * 7 >> 1); } + //This method is required because the bukkit player.getTotalExperience() method, shows exp that has been 'spent'. + //Without this people would be able to use exp and then still sell it. public static int getTotalExperience(final Player player) { int exp = (int) (getExpToLevel(player) * player.getExp()); |