Ignore spurious slot IDs sent by client, e.g. in enchanting tables

This commit is contained in:
md_5 2018-12-30 22:27:16 +11:00
parent 5d2a10c5c5
commit 15c9b1eb5a

View file

@ -210,7 +210,9 @@ public abstract class InventoryView {
* @return corresponding inventory, or null
*/
public final Inventory getInventory(int rawSlot) {
if (rawSlot == OUTSIDE) {
// Slot may be -1 if not properly detected due to client bug
// e.g. dropping an item into part of the enchantment list section of an enchanting table
if (rawSlot == OUTSIDE || rawSlot == -1) {
return null;
}
Preconditions.checkArgument(rawSlot >= 0, "Negative, non outside slot %s", rawSlot);