Searching ALL Inventories.

Discussion in 'Plugin Development' started by SPDarklord, Jan 2, 2015.

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

    SPDarklord

    Hiya, So I recently made a magic armor plugin, I am now making an interface to apply the armor but I need the colour of the chestplate in the gui to change color too! So pretty much I need to search the players inventory to carry on doing what I was doing and check an inventory called DonorTools for a leather chestplate and change that colour too.

    {EDIT} I also need to keep the item lore of the leather chestplate in that one inventory as Click to toggle your rainbow armor!

    I would not like the code.
    I would just like to know the methods I need to call! (Any further help would be a bonus.)

    Thanks
     
  2. Offline

    Skionz

    Player#getInventory()
     
  3. Offline

    SPDarklord

    But the inventory is not a player is it?
    Inventory i = Bukkit.createInventory(null, 27, "" + ChatColor.DARK_AQUA + ChatColor.ITALIC + "Donor Items!");

    {EDIT} Forgot to tag you @Skionz

    Been trying to think this over but still no closer to coming up with a solution.

    If I assigned the player the inventory as opposed to setting it to null ( Bukkit.createInventory(null, 27, "" + ChatColor.DARK_AQUA + ChatColor.ITALIC + "Donor Items!"); ) would I be able to do player.getinventory?

    That is what I am trying to do just with a server created inventory.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Oct 31, 2016
  4. Offline

    SPDarklord

    Still no progress on it! Sorry :(
     
  5. Offline

    SuperOriginal

    I don't understand your intentions, or your problem.
     
  6. Offline

    MoseMister

    @SPDarklord

    I think i sort of understand it ..... your creating a new inventory as a GUI and what you want is the leather armor to change colour within the inventory you created 'GUI'.

    If your after that, then force the player to open the 'GUI' then record it within a list of inventory's, after that, have a Sync repeating task checking this list of inventory's checking for a leather armor, then create a new leather armor with the same states as the one currently within the inventory (you can keep the meta data I think) then override the slot with the new leather armor. To save a bit of RAM within your plugin, cast a event checking for inventory close, if it is one of these 'GUI' inventory's then remove it from the list so the repeater does not read it.

    Please note I can explain myself much better through code example but I respect your request for us not to show you code but to tell you how to do it in a hypothetical environment, problem with this is I don't know if that is possible because every time I have made a 'GUI' I cast it onto the player after I create it and don't modify it, but i believe this is possible due to InventoryClickEvent (you can change the inventory without closing it) and in minecraft itself inventory's change without being closed.

    oh and use @MoseMister for me to see your reply

    <<edit>> didn't read all your responses ...... because I can not delete my post ill just look like a idiot here instead
     
Thread Status:
Not open for further replies.

Share This Page