saves all the players in the manager to the path specified in their data file
()
| 29 | |
| 30 | // saves all the players in the manager to the path specified in their data file |
| 31 | func (mgr *PlayerEntityManager) SaveAll() { |
| 32 | mgr.mu.RLock() |
| 33 | defer mgr.mu.RUnlock() |
| 34 | for _, player := range mgr.m { |
| 35 | player.sync() |
| 36 | |
| 37 | player.data.Save() |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | func NewPlayerEntityManager() *PlayerEntityManager { |
| 42 | return &PlayerEntityManager{m: make(map[uuid.UUID]*PlayerEntity)} |