3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 12:30:06 +01:00

SPIGOT-4031: Improve bounds checking in CraftInventoryView.

Dieser Commit ist enthalten in:
Hex 2018-07-16 22:47:47 -06:00
Ursprung b4bff6fc3d
Commit 1526726b57

Datei anzeigen

@ -50,7 +50,7 @@ public class CraftInventoryView extends InventoryView {
@Override
public void setItem(int slot, ItemStack item) {
net.minecraft.server.ItemStack stack = CraftItemStack.asNMSCopy(item);
if (slot != -999) {
if (slot >= 0) {
container.getSlot(slot).set(stack);
} else {
player.getHandle().drop(stack, false);
@ -59,7 +59,7 @@ public class CraftInventoryView extends InventoryView {
@Override
public ItemStack getItem(int slot) {
if (slot == -999) {
if (slot < 0) {
return null;
}
return CraftItemStack.asCraftMirror(container.getSlot(slot).getItem());
@ -125,7 +125,7 @@ public class CraftInventoryView extends InventoryView {
// Nothing to do, it's a CONTAINER slot
}
} else {
if (slot == -999 || slot == -1) {
if (slot < 0) {
type = SlotType.OUTSIDE;
} else if (inventory.getType() == InventoryType.CRAFTING) { // Also includes creative inventory
if (slot < 9) {