summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorEvilSeph <evilseph@gmail.com>2012-11-18 11:33:58 -0500
committerEvilSeph <evilseph@gmail.com>2012-11-18 17:45:29 -0500
commitcc78e173124747d3cdb5c588fafa1df8f9b81f47 (patch)
tree0beba09e358b87d77916b35a97790e95995a15e2 /src/main
parent7ef9adc04e6bb318c7de1a738868b8fe91b35ca7 (diff)
downloadcraftbukkit-cc78e173124747d3cdb5c588fafa1df8f9b81f47.tar
craftbukkit-cc78e173124747d3cdb5c588fafa1df8f9b81f47.tar.gz
craftbukkit-cc78e173124747d3cdb5c588fafa1df8f9b81f47.tar.lz
craftbukkit-cc78e173124747d3cdb5c588fafa1df8f9b81f47.tar.xz
craftbukkit-cc78e173124747d3cdb5c588fafa1df8f9b81f47.zip
Fix players losing experience when keepInventory is true. Fixes BUKKIT-2915
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/net/minecraft/server/EntityPlayer.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 06709f9b..85efb807 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -764,7 +764,9 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void reset() {
float exp = 0;
- if (this.keepLevel) {
+ boolean keepInventory = this.world.getGameRules().getBoolean("keepInventory");
+
+ if (this.keepLevel || keepInventory) {
exp = this.exp;
this.newTotalExp = this.expTotal;
this.newLevel = this.expLevel;
@@ -781,7 +783,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
effects.clear();
this.activeContainer = this.defaultContainer;
this.lastSentExp = -1;
- if (this.keepLevel) {
+ if (this.keepLevel || keepInventory) {
this.exp = exp;
} else {
this.giveExp(this.newExp);