Need InventoryChangeEvent or similar

Discussion in 'Plugin Development' started by iamdansker, Jul 6, 2012.

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

    I am currently working a chest " kinda standalone" shop plugin.
    Now what i need is a way to detect when an item is changed/added/removed in that chest but i haven't found any method for doing this yes

    I have a solution but i would prefer another. My other solution is making a class that extends the class ItemStack and then make that my class execute events when something is changed by overriding the original functions, but i have my doubts about it since i am not entirely sure how bukkit/minecraft handles chest exchanges so it could cause some issues, but it shouldn't be anything that i can't make a work around fix for, but it would just be easier with a general method of doing this.
     
  2. If you want to check whenever a player places or takes an item from a chest, you can use the InventoryClickEvent with alot of checks xD

    Also, that solution would't have worked because the game won't use your class.
     
  3. Digi thanks for the quick answer but can i ask why it wont accept my class? I can't see why.
     
  4. Well, org.bulkkit.inventory.ItemStack will not survive because it's converted to net.minecraft.server.ItemStack and if you extend that instead you won't be able to use it in most methods without heavily casting and getting handles and even then I don't think it will survive because it will be converted back to org.bukkit.inventory.ItemStack when you get it... that's my theory anyway, I'm not entirely sure, someone correct me if I'm wrong :}

    Still, I belive by using reflection you can do some stuff, but I don't know anything about reflection.
     
  5. Oh i see, that would explain why it wouldn't work, i had the idea that the ItemStack was extending the native minecraft class, but now when i think about it that isn't how bukkit works in most other cases i am aware of.
     
Thread Status:
Not open for further replies.

Share This Page