3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 00:00:41 +01:00

Also check out-of-bounds on player inventory

Dieser Commit ist enthalten in:
Camotoy 2021-03-08 18:17:14 -05:00
Ursprung ffae69471d
Commit d80372e0b4
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F

Datei anzeigen

@ -28,6 +28,7 @@ package org.geysermc.connector.inventory;
import lombok.Getter; import lombok.Getter;
import lombok.NonNull; import lombok.NonNull;
import lombok.Setter; import lombok.Setter;
import org.geysermc.connector.GeyserConnector;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
public class PlayerInventory extends Inventory { public class PlayerInventory extends Inventory {
@ -55,10 +56,18 @@ public class PlayerInventory extends Inventory {
} }
public GeyserItemStack getItemInHand() { 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]; return items[36 + heldItemSlot];
} }
public void setItemInHand(@NonNull GeyserItemStack item) { 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; items[36 + heldItemSlot] = item;
} }