MCPcopy Create free account
hub / github.com/GoMudEngine/GoMud / onPlayerSpawn

Method onPlayerSpawn

modules/mudmail/mudmail.go:150–168  ·  view source on GitHub ↗

onPlayerSpawn loads the user's inbox into memory and migrates legacy data.

(e events.Event)

Source from the content-addressed store, hash-verified

148
149// onPlayerSpawn loads the user's inbox into memory and migrates legacy data.
150func (m *MudmailModule) onPlayerSpawn(e events.Event) events.ListenerReturn {
151 evt, ok := e.(events.PlayerSpawn)
152 if !ok {
153 return events.Continue
154 }
155
156 inbox := m.load(evt.UserId)
157
158 m.inboxes[evt.UserId] = inbox
159
160 // Notify the user if they have unread messages.
161 if countUnread(inbox) > 0 {
162 if u := users.GetByUserId(evt.UserId); u != nil {
163 u.Command(`inbox check`)
164 }
165 }
166
167 return events.Continue
168}
169
170// onPlayerDespawn saves and unloads the user's inbox.
171func (m *MudmailModule) onPlayerDespawn(e events.Event) events.ListenerReturn {

Callers

nothing calls this directly

Calls 4

loadMethod · 0.95
GetByUserIdFunction · 0.92
countUnreadFunction · 0.85
CommandMethod · 0.45

Tested by

no test coverage detected