Getting a GUI Menu's Content

Discussion in 'Plugin Development' started by cdnyassuo34, Sep 3, 2019.

  1. Offline

    cdnyassuo34

    hello all,
    I have been trying to get a GUI Menu for my ItemSaver Plugin and I'd like to know how to a GUI Menu's content(Inventory => ItemStack[] or something like that ). if anyone could tell me how I would be graceful :)
     
  2. Offline

    Shqep

    its um self-explanatory?

    Code:Java
    1. Inventory aye;
    2. ItemStack[] realnicecontents = aye.getContents();
     
  3. Offline

    SnowPingerr

    else you should use
    (use clickinventoryevent)
    Inventory inv = e.getInventory();
    ItemStack = inv.getItem(int);
    Inventory ;
     
  4. Offline

    timtower Moderator Moderator

    @SnowPingerr Because the slot contains null, it is empty.
     
  5. Offline

    SnowPingerr

    I tryied it myself but it just returns null ... how to replace null by material.air ?
    Edit: I tought about doing a condition :
    if it's null return Material.AIR;
    else return item
     
  6. Offline

    timtower Moderator Moderator

  7. Offline

    SnowPingerr

    (I am trying to use this too) I am trying to make a Crafting recipe from a Menu
    but item that are Air cannot be saved in the recipe
     
  8. Offline

    Shqep

    Just check the recipe and if the slot is null, ignore it, and save the other slots?

    If by make a recipe you mean to create a new custom recipe from the GUI.
     

Share This Page