How do I add an inventory - Maxlego08/zShop-API GitHub Wiki

With zShop you will be able to create as much inventory as you want and navigate between them very simply.

Example of an inventory

name: "&eOres &8(&6%page%&f/&e%maxPage%&8)"
size: 54
type: DEFAULT
fillItem:
  material: GRAY_STAINED_GLASS_PANE
  name: "&e"
items:
  back:
    item:
      material: BARRIER
      name: "&cBack"
    type: BACK
    slot: 49
  next:
    item:
      material: ARROW
      name: "&7Next page"
    type: NEXT
    slot: 50
  previous:
    item:
      material: ARROW
      name: "&7Previous page"
    type: PREVIOUS
    slot: 48
  1:
    item:
      material: COAL
    buyPrice: 10.0
    sellPrice: 0.5
    type: ITEM
    slot: 0
  2:
    item:
      material: IRON_INGOT
    buyPrice: 10.0
    sellPrice: 0.5
    type: ITEM
    slot: 65

How to create an inventory

First you're going to have to name your inventory. All you have to do is this:

name: "&eOres &8(&6%page%&f/&e%maxPage%&8)"

You must then define a size for your inventory, be careful the size of the inventory must be a multiple of 9.

size: 54

Then you must define the inventory type, which is DEFAULT by default. Here are the types of inventory available: DEFAULT, BUY, SELL and CONFIRM

type: DEFAULT

Vous allez pouvoir remplir l'inventaire d'un certain item avec la fonction fillItem

fillItem:
  material: GRAY_STAINED_GLASS_PANE
  name: "&e"

All you have to do is add a list of button to your inventory.

items:
  back:
    item:
      material: BARRIER
      name: "&cBack"
    type: BACK
    slot: 49
  next:
    item:
      material: ARROW
      name: "&7Next page"
    type: NEXT
    slot: 50
  previous:
    item:
      material: ARROW
      name: "&7Previous page"
    type: PREVIOUS
    slot: 48
  1:
    item:
      material: COAL
    buyPrice: 10.0
    sellPrice: 0.5
    type: ITEM
    slot: 0
  2:
    item:
      material: IRON_INGOT
    buyPrice: 10.0
    sellPrice: 0.5
    type: ITEM
    slot: 65

As you can see here, the inventory will have several pages and it is still possible to navigate between the pages with the NEXT and PREVIOUS buttons. For your inventory to be multiple pages you must define a slot greater than the number of slots available in your inventory. Here we have 54 slots, so just do slot + (inventorySize * (page - 1)) so here we get: 11 + (54 * (2 - 1)) = 65.

All you have to do is add the name of the inventory file in the config.yml file:

categories:    
 - "ores"
 - "redstone"
 - "farm"
 - "foods"
 - "miscellaneous"
 - "mobs"
 - "buy"
 - "sell"
 - "blocks"
 - "confirm"
 - "example" #Add your inventory file name here