mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Also check out-of-bounds on player inventory
This commit is contained in:
parent
ffae69471d
commit
d80372e0b4
1 changed files with 9 additions and 0 deletions
|
@ -28,6 +28,7 @@ package org.geysermc.connector.inventory;
|
|||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import lombok.Setter;
|
||||
import org.geysermc.connector.GeyserConnector;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
|
||||
public class PlayerInventory extends Inventory {
|
||||
|
@ -55,10 +56,18 @@ public class PlayerInventory extends Inventory {
|
|||
}
|
||||
|
||||
public GeyserItemStack getItemInHand() {
|
||||
if (36 + heldItemSlot > this.size) {
|
||||
GeyserConnector.getInstance().getLogger().debug("Held item slot was larger than expected!");
|
||||
return GeyserItemStack.EMPTY;
|
||||
}
|
||||
return items[36 + heldItemSlot];
|
||||
}
|
||||
|
||||
public void setItemInHand(@NonNull GeyserItemStack item) {
|
||||
if (36 + heldItemSlot > this.size) {
|
||||
GeyserConnector.getInstance().getLogger().debug("Held item slot was larger than expected!");
|
||||
return;
|
||||
}
|
||||
items[36 + heldItemSlot] = item;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue