Skip to content

Commit

Permalink
Update to new InventoryView internals
Browse files Browse the repository at this point in the history
  • Loading branch information
Jikoo committed Jul 27, 2024
1 parent 68f0b7b commit 31539df
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public abstract class OpenChestMenu<T extends Container & ISpecialInventory & In
protected final boolean viewOnly;
protected final boolean ownContainer;
protected final int topSize;
private CraftInventoryView bukkitEntity;
private CraftInventoryView<OpenChestMenu<T>> bukkitEntity;
// Syncher fields
private @Nullable ContainerSynchronizer synchronizer;
private final List<DataSlot> dataSlots = new ArrayList<>();
Expand Down Expand Up @@ -129,22 +129,22 @@ protected void preSlotSetup() {}


@Override
public final @NotNull CraftInventoryView getBukkitView() {
public final @NotNull CraftInventoryView<OpenChestMenu<T>> getBukkitView() {
if (bukkitEntity == null) {
bukkitEntity = createBukkitEntity();
}

return bukkitEntity;
}

protected @NotNull CraftInventoryView createBukkitEntity() {
protected @NotNull CraftInventoryView<OpenChestMenu<T>> createBukkitEntity() {
Inventory top;
if (viewOnly) {
top = new OpenDummyInventory(container);
} else {
top = container.getBukkitInventory();
}
return new CraftInventoryView(viewer.getBukkitEntity(), top, this) {
return new CraftInventoryView<>(viewer.getBukkitEntity(), top, this) {
@Override
public @Nullable Inventory getInventory(int rawSlot) {
if (viewOnly) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ protected boolean checkViewOnly() {
}

@Override
protected @NotNull CraftInventoryView createBukkitEntity() {
protected @NotNull CraftInventoryView<OpenChestMenu<OpenInventory>> createBukkitEntity() {
org.bukkit.inventory.Inventory bukkitInventory;
if (viewOnly) {
bukkitInventory = new OpenDummyInventory(container);
Expand All @@ -114,7 +114,7 @@ protected boolean checkViewOnly() {
bukkitInventory = container.getBukkitInventory();
}

return new CraftInventoryView(viewer.getBukkitEntity(), bukkitInventory, this) {
return new CraftInventoryView<>(viewer.getBukkitEntity(), bukkitInventory, this) {
@Override
public org.bukkit.inventory.ItemStack getItem(int index) {
if (viewOnly || index < 0) {
Expand Down Expand Up @@ -174,7 +174,7 @@ public int convertSlot(int rawSlot) {
if (slot >= topSize) {
return super.getSlotType(offset + slot);
}
return container.getSlotType(offset + slot);
return OpenInventoryMenu.this.container.getSlotType(offset + slot);
}

@Override
Expand Down

0 comments on commit 31539df

Please sign in to comment.