Add a method on InventoryView to get the MenuType (#12193)

Since there is a new (better) way to create views for players using MenuType, it would be nice to also be able to get it back from InventoryView after creating.
This commit is contained in:
Glicz
2025-05-01 03:43:51 +02:00
committed by GitHub
parent 0e9b94d533
commit 835b955913
4 changed files with 25 additions and 0 deletions

View File

@@ -95,6 +95,11 @@ public class CraftContainer extends AbstractContainerMenu {
this.title = title;
}
@Override
public MenuType getMenuType() {
return CraftMenuType.minecraftToBukkit(getNotchInventoryType(inventory));
}
}, player, id);
}

View File

@@ -94,6 +94,12 @@ public class CraftInventoryView<T extends AbstractContainerMenu, I extends Inven
this.title = title;
}
@Override
public org.bukkit.inventory.MenuType getMenuType() {
MenuType<?> menuType = container.menuType;
return menuType != null ? CraftMenuType.minecraftToBukkit(menuType) : null;
}
public boolean isInTop(int rawSlot) {
return rawSlot < this.viewing.getSize();
}