From 1c95476a00958ff19dfb18ab1a621546b3ad5be4 Mon Sep 17 00:00:00 2001 From: Dinnerbone Date: Thu, 15 Sep 2011 05:13:10 +0100 Subject: [PATCH] Implemented player experience methods --- .../craftbukkit/entity/CraftPlayer.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 9548234b99..86eeb82e06 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -396,4 +396,32 @@ public class CraftPlayer extends CraftHumanEntity implements Player { public GameMode getGameMode() { return GameMode.getByValue(getHandle().itemInWorldManager.a()); } + + public int getExperience() { + return getHandle().exp; + } + + public void setExperience(int exp) { + getHandle().d(exp); + } + + public int getLevel() { + return getHandle().expLevel; + } + + public void setLevel(int level) { + getHandle().expLevel = level; + } + + public int getTotalExperience() { + return getHandle().expTotal; + } + + public void setTotalExperience(int exp) { + getHandle().expTotal = exp; + + if (getTotalExperience() > getExperience()) { + getHandle().exp = getTotalExperience(); + } + } }