1. I'm expanding one of the discontinued stats plugins for my server and it's working for resources like wood (from chopping) or cloth (from gathering hemp) however, it doesn't seem to work when gathering items from boxes or barrels.

    Here's what I got:

    void OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item) {
    if(entity is BasePlayer) {
    executeQuery("INSERT INTO player_gather_resource (player, resource, count, date) VALUES (@0, @1, @2, @3)" +
    "ON DUPLICATE KEY UPDATE count = count + " + item.amount, ((BasePlayer)entity).userID, item.info.displayName.english, item.amount, getDate());
    }
    }

    Is OnDispenserGather the correct hook? Or is there another one for this?

    Thanks in advance.
    [DOUBLEPOST=1486237530][/DOUBLEPOST]Oh, sorry I have this part too

    void OnCollectiblePickup(Item item, BasePlayer player) {
    executeQuery("INSERT INTO player_gather_resource (player, resource, count, date) VALUES (@0, @1, @2, @3)" +
    "ON DUPLICATE KEY UPDATE count = count + " + item.amount, player.userID, item.info.displayName.english, item.amount, getDate());
    }

    That's for the hemp, wood and stone laying around on the ground.

    Neither works for barrels and boxes, it appears.
     
  2. OnDispenserGather and On CollectiblePickup should work for you. I would test it to be sure. For barrels and boxes, im not sure entirely. I guess you could scan for nearby items with OnEntityDeath, and check if it is a Item. If so, get the item, amount, player, etc. Then do whatever you want. There might be a better way.
     
  3. It seems that OnDispenserGather works for chopping wood and picking stone and OnCollectiblePickup works well for hemp and other things you pickup, but neither seems to work for items in barrels and boxes.

    I'll try using OnEntityDeath, but it sounds like it'll be a pain.