Skip to content

Commit

Permalink
Revise Order of Operations for Exit Command
Browse files Browse the repository at this point in the history
  • Loading branch information
robinje committed Sep 28, 2024
1 parent b994411 commit d118487
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ func ExecuteQuitCommand(character *Character, tokens []string) bool {
// Send goodbye message
character.Player.ToPlayer <- "\n\rGoodbye!"

// Notify room
SendRoomMessage(character.Room, fmt.Sprintf("\n\r%s has left.\n\r", character.Name))

// Remove character from the room
character.Room.Mutex.Lock()
delete(character.Room.Characters, character.ID)
Expand All @@ -84,6 +81,9 @@ func ExecuteQuitCommand(character *Character, tokens []string) bool {
delete(character.Server.Characters, character.ID)
character.Server.Mutex.Unlock()

// Notify room
SendRoomMessage(character.Room, fmt.Sprintf("\n\r%s has left.\n\r", character.Name))

// Save character state to database
err := character.Server.Database.WriteCharacter(character)
if err != nil {
Expand Down

0 comments on commit d118487

Please sign in to comment.