diff options
author | Himbeer <himbeer@disroot.org> | 2024-12-07 13:57:39 +0100 |
---|---|---|
committer | Himbeer <himbeer@disroot.org> | 2024-12-07 13:57:39 +0100 |
commit | 2fe0cd17e14473f0d7ffd5a1f5f100bd2419b018 (patch) | |
tree | 8ff7eb5375e9a9a59af4a6f1f6d0d0ee5f2c203e /process.go | |
parent | aee7c77cb835299f7e0a96bc971a182619f91296 (diff) |
Implement inventory plugin API
This change adds an API to retrieve a read-only copy of the current
inventory and listen for and modify inventory actions.
Closes #90.
Diffstat (limited to 'process.go')
-rw-r--r-- | process.go | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -484,6 +484,17 @@ func (cc *ClientConn) process(pkt mt.Pkt) { case *mt.ToSrvCltInfo: // Store for any future hops (need to send it to the new server). cc.cltInfo = cmd + case *mt.ToSrvInvAction: + onInvActionMu.RLock() + defer onInvActionMu.RUnlock() + + for _, handler := range onInvAction { + cmd.Action = handler(cc, cmd.Action) + } + + if cmd.Action == "" { + return + } case *mt.ToSrvInvFields: if handleOnPlayerReceiveFields(cc, cmd) { return |