summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNathan Adams <dinnerbone@dinnerbone.com>2011-11-30 22:31:03 +0000
committerNathan Adams <dinnerbone@dinnerbone.com>2011-11-30 22:31:03 +0000
commita513406005d4aae3b710d76386948ca56b7bd09a (patch)
treece5873b9dd3ba53474e09ce06b70e1d1f6aba7ad /src
parent8fbe78a2c3b65f4140c4d0db4bed5a9bcdaf1792 (diff)
downloadcraftbukkit-a513406005d4aae3b710d76386948ca56b7bd09a.tar
craftbukkit-a513406005d4aae3b710d76386948ca56b7bd09a.tar.gz
craftbukkit-a513406005d4aae3b710d76386948ca56b7bd09a.tar.lz
craftbukkit-a513406005d4aae3b710d76386948ca56b7bd09a.tar.xz
craftbukkit-a513406005d4aae3b710d76386948ca56b7bd09a.zip
Fixed exp methods returning wrong values
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index a26ac0d1..1e980b04 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -458,28 +458,42 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return GameMode.getByValue(getHandle().itemInWorldManager.a());
}
+ public void giveExp(int exp) {
+ getHandle().giveExp(exp);
+ }
+
+ public float getExp() {
+ return getHandle().exp;
+ }
+
+ public void setExp(float exp) {
+ getHandle().exp = exp;
+
+ giveExp(0);
+ }
+
public int getExperience() {
- return getHandle().expTotal;
+ return (int)(getExp() * 100);
}
public void setExperience(int exp) {
- getHandle().d(exp - getExperience());
+ setExp(exp / 100);
}
public int getLevel() {
- return (int)getHandle().exp;
+ return (int)getHandle().expLevel;
}
public void setLevel(int level) {
- getHandle().exp = level;
+ getHandle().expLevel = level;
}
public int getTotalExperience() {
- return getHandle().expLevel;
+ return getHandle().expTotal;
}
public void setTotalExperience(int exp) {
- getHandle().expLevel = exp;
+ getHandle().expTotal = exp;
if (getTotalExperience() > getExperience()) {
getHandle().expTotal = getTotalExperience();