A hook (or hooks) similar to OnItemAddedToContainer and OnItemRemovedFromContainer that applies specifically to players looting would be very useful, I think. Currently, these are called any time an item is added/removed, regardless of the source or destination. This can be filtered, but there's still no great way of determining the player doing the looting. There are workarounds for this, but none are all that elegant, and any time you try to tweak or expand things, you start getting more and more errors. If you search for past forum topics related to these hooks, you'll see what I mean.
OnLootEntity provides specific player information, but only calls when someone opens a container, rather than when they add/remove something.
A hook that sort of combines these two would be great. It could call any time a player adds or removes an item from a container (or other player) and provides:
- The name/ID of the player doing the looting
- The entity they are looting
- The owner of the entity they are looting (or player name/ID, if it's a player being looted)
- The item being added/removed
- The amount of said item being added/removed
The current hooks also do not call if an item is being added or removed to a stack, or if partial stacks are being moved. It also provides no information if the entity being looted is a player, and seems to give errors if it's not filtered out entirely.
Not sure if any of this is possible, but there are a lot of potential use cases for this, and I definitely feel it would be worthwhile to add. Your consideration would be very much appreciated.
OnLootEntity provides specific player information, but only calls when someone opens a container, rather than when they add/remove something.
A hook that sort of combines these two would be great. It could call any time a player adds or removes an item from a container (or other player) and provides:
- The name/ID of the player doing the looting
- The entity they are looting
- The owner of the entity they are looting (or player name/ID, if it's a player being looted)
- The item being added/removed
- The amount of said item being added/removed
The current hooks also do not call if an item is being added or removed to a stack, or if partial stacks are being moved. It also provides no information if the entity being looted is a player, and seems to give errors if it's not filtered out entirely.
Not sure if any of this is possible, but there are a lot of potential use cases for this, and I definitely feel it would be worthwhile to add. Your consideration would be very much appreciated.