Inventory, Can´t move item & update the inventory

Discussion in 'Plugin Development' started by chikenlitle99, Jun 8, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    chikenlitle99

    Hello :D
    I would like to know how can I keep an item is moved from its inventory space.

    In my config.yml there is an option to select the "slot" of an item, I want to know how I can update the item every time you changed the number in the "config.yml"

    Hola :D
    Me gustaría saber como puedo evitar que los jugadores muevan el "item" del slot que estableci.

    En mi "config.yml" hay una opción en la cula puedes definir el "slot" en donde quieres que el item aparesca, lo que pasa que cuando cambio el "slot" y entro al juego el item no cambia de lugar, como puedo hacer para que el item cambie de lugar cuando cambio el numero en "slot"?

    This is my code:
    Code:java
    1.  
    2. item = getConfig().getInt("Item_Join.Item_Id");
    3. itemonjoin = getConfig().getBoolean("Item_Join.Item_On_Join");
    4. int slot = getConfig().getInt("Item_Join.Item_Slot");
    5.  
    6. if ((itemonjoin) && (!p.getInventory().contains(item))){
    7. ItemStack Item = new ItemStack(item);
    8.  
    9. ItemMeta meta = Item.getItemMeta();
    10. meta.setDisplayName(itemname);
    11. Object lores = new ArrayList();
    12. ((List)lores).add(itemlore);
    13. meta.setLore((List)lores);
    14. Item.setItemMeta(meta);
    15.  
    16. p.getInventory().setItem(slot, Item);
    17. }
    18.  
     
  2. Offline

    Ytry

    I am not sure I understand, are you saying you want to change the item in a specific slot or that you want to move the item to a different slot when the config change the slot it is supposed to be in?
     
  3. Offline

    Drkmaster83

    I'm pretty sure he's wanting the item's slot to change from a config.yml integer value, each time it's updated. Every time you modify that value in the config.yml, it will live-update in the inventory, erasing the old one (I suppose) and replacing the item in the specified config.yml value...

    The only way I can think this to be possible without a command basis to update the inventory is either update your values/config.yml and inventory on a runnable timer or every time the player clicks in the inventory, and apply the changes accordingly each time... Doesn't seem very efficient, but it's all I can think of.
     
  4. Offline

    Ytry

    That is all I can think of as well
     
  5. Offline

    chikenlitle99


    YES!!, you know how i do this?

    any?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 8, 2016
  6. Offline

    chikenlitle99

Thread Status:
Not open for further replies.

Share This Page