Skip to content

Commit 1f3765d

Browse files
committed
Fix consistency with getItemAt() for MC 1.21.5+
1 parent cd2beda commit 1f3765d

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

src/main/java/com/laytonsmith/abstraction/bukkit/entities/BukkitMCPlayer.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,6 @@ public MCItemStack getItemAt(Integer slot) {
141141
ItemStack is = null;
142142
if(slot == null) {
143143
is = p.getInventory().getItemInMainHand();
144-
// Empty slots should return null, but unlike other PlayerInventory methods,
145-
// getItemInMainHand() never returns null.
146-
if(is.getType() == Material.AIR) {
147-
return null;
148-
}
149144
} else if(slot == 100) {
150145
is = p.getInventory().getBoots();
151146
} else if(slot == 101) {
@@ -159,7 +154,7 @@ public MCItemStack getItemAt(Integer slot) {
159154
} else if(slot >= 0 && slot <= 35) {
160155
is = p.getInventory().getItem(slot);
161156
}
162-
if(is == null) {
157+
if(is == null || is.getAmount() <= 0 || is.getType() == Material.AIR) {
163158
return null;
164159
}
165160
return new BukkitMCItemStack(is);

0 commit comments

Comments
 (0)