Getting player that dropped a item into hopper.

Discussion in 'Plugin Development' started by CaLxCyMru, Apr 17, 2014.

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

    CaLxCyMru

    Hello there!
    I have been trying to figure out how I get the player that dropped a item into a hopper? I am using the InventoryPickupItemEvent. I suppose I would have to add a "invisible" lore that contained the players name? I don't really want to do this. But I will if I have to, do you have any other suggestions?

    EDIT:
    FYI I am trying to detect when a player drops a Gold Ingot into a hopper, then update a scoreboard with the new value.
    Thanks!
    -CaL
     
  2. Offline

    RawCode

    had you opened source of hopper tile entity, if no - open it, if yes - tell us, do hopper trigger any events at all?
     
  3. Offline

    CaLxCyMru

    No, I want it to trigger when a Item get's throw in to a hopper. I have not tested any code, this is all theory up to now. I want to know before I spend hours wasting my time if it's not possible. Eamples of code, if possible would be nice.
    RawCode
     
  4. Offline

    Syd

    CaLxCyMru
    Listen to the PlayerDropItemEvent, give the Item Entity a custom metadata (.setMetadata()) containing the data you need (i.e. the dropping player), then listen to the InventoryPickupItemEvent and retrieve the Metadata and you have detected when a player drops something into a hopper. (You might need some more checks ;))
     
  5. Offline

    CaLxCyMru

    Syd Good idea!

    I have never played with meta data before. Could you show some examples of setting metadata? If not, no worries!
    Thanks for your help!:)

    Edit - After looking for a little, I managed to work out how to set and get Meta data.
     
  6. Offline

    RawCode

    I want to know before I spend hours wasting my time CaLxCyMru

    this is not way of coding, good luck for you.
     
  7. Offline

    CaLxCyMru

    I'm sorry,What do you mean "this is not way of coding"?
    That sentence made no scene. That is no way of speaking English..
     
  8. Offline

    Syd

    CaLxCyMru likes this.
Thread Status:
Not open for further replies.

Share This Page