Solved Check if Inventory is Made by Plugin

Discussion in 'Plugin Development' started by dkabot, Jan 26, 2013.

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

    dkabot

    I've been messing around with using Inventories as a GUI of sorts. I'm sure it's not the newest idea around, just check if some item was clicked and do something if it was, not allowing the normal inventory stuff to happen. Works great in theory, especially now with items you can rename.

    However, I've run into the issue as in the title; I only want to listen for items clicked in an inventory generated by MY plugin. Only solution I could think of is to extend InventoryType and add my own, but something tells me that's not the best way if at all possible. Just saving and checking an instance of the inventory also hasn't worked, but I have no other ideas.
     
  2. Offline

    RealDope

    You can set the title of inventories I think. You could name it like MyPluginName Inventory or something and then check if the inventory name is equal to that.
     
  3. Offline

    dkabot

    I had thought of that one, but with 1.5 users will be able to rename inventories themselves using anvils, which would break it... maybe a name and formatting, but a plugin could still make that conflict... hmm.
     
  4. Offline

    RealDope

    Just format it super crazy, with like rainbow colors and stuff :3
     
  5. Offline

    dkabot

    Well, the user will be seeing it so you can't make it TOO crazy. But that will have to do. Oh well.
     
  6. Offline

    raGan.

    You could maybe create class inplementing inventoryholder, and assign it to inventory upon creation. Then just check if owner is instance of your class.
     
    dkabot likes this.
  7. Offline

    dkabot

    Wow, I am able to implement InventoryHolder on my own class after all.
    It appears that it works! Thanks.
     
  8. Offline

    raGan.

    I'm glad to 'hear' that.
     
Thread Status:
Not open for further replies.

Share This Page