summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorGJ <gjmcferrin@gmail.com>2013-12-16 23:09:35 -0500
committerWesley Wolfe <weswolf@aol.com>2014-01-25 18:14:52 -0600
commit10a28d123b14f068355239269412f3e7e8806aa6 (patch)
treed15bb9d1b988f65858ba24ba773047eff3513ffc /src/main
parent2a2e90233e88d825cd29e352b6c903096c4c6828 (diff)
downloadbukkit-10a28d123b14f068355239269412f3e7e8806aa6.tar
bukkit-10a28d123b14f068355239269412f3e7e8806aa6.tar.gz
bukkit-10a28d123b14f068355239269412f3e7e8806aa6.tar.lz
bukkit-10a28d123b14f068355239269412f3e7e8806aa6.tar.xz
bukkit-10a28d123b14f068355239269412f3e7e8806aa6.zip
[Bleeding] Fix logic for calculating slot in Creative mode. Fixes BUKKIT-4715
Previously, hotbar slots for player inventory would return 9 - 18 while in Creative mode, rather than 0 - 9. This commit fixes the logic used for calculating the returned slot based on the raw slot.
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/bukkit/inventory/InventoryView.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/inventory/InventoryView.java b/src/main/java/org/bukkit/inventory/InventoryView.java
index 0427c569..7e98d528 100644
--- a/src/main/java/org/bukkit/inventory/InventoryView.java
+++ b/src/main/java/org/bukkit/inventory/InventoryView.java
@@ -1,5 +1,6 @@
package org.bukkit.inventory;
+import org.bukkit.GameMode;
import org.bukkit.entity.HumanEntity;
import org.bukkit.event.inventory.InventoryType;
@@ -174,6 +175,9 @@ public abstract class InventoryView {
return rawSlot;
}
int slot = rawSlot - numInTop;
+ if (getPlayer().getGameMode() == GameMode.CREATIVE && getType() == InventoryType.PLAYER) {
+ return slot;
+ }
if (getType() == InventoryType.CRAFTING) {
if(slot < 4) return 39 - slot;
else slot -= 4;