From 10a28d123b14f068355239269412f3e7e8806aa6 Mon Sep 17 00:00:00 2001 From: GJ Date: Mon, 16 Dec 2013 23:09:35 -0500 Subject: [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. --- src/main/java/org/bukkit/inventory/InventoryView.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/main/java/org') 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; -- cgit v1.2.3