Skip to content

feat(server/storage): emit characterDeleted when a character is deleted - #779

Merged
ChatDisabled merged 1 commit into
Qbox-project:mainfrom
mri-Qbox-Brasil:feat/storage-character-deleted
Sep 30, 2026
Merged

ChatDisabled merged 1 commit into
Qbox-project:mainfrom
mri-Qbox-Brasil:feat/storage-character-deleted

Conversation

@mur4i

@mur4i mur4i commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Description

Fires qbx_core:server:characterDeleted with the citizenid from storage.deletePlayer when the deletion succeeds.

Emitting it from storage covers every deletion path: the built-in character menu, the DeleteCharacter export, and external character resources that call the storage module directly.

This lets a resource clean up its own per-character data instead of adding its tables to characterDataTables. It also covers data the table list cannot express, such as rows keyed by phone number or app accounts, and avoids the first-boot Table 'x' does not exist in database warning for resources that create their tables on start.

AddEventHandler('qbx_core:server:characterDeleted', function(citizenid)
end)

It is a server-only TriggerEvent. characterDataTables is unchanged, so this is purely additive.

Related Issues

Relates to #398 and #478.

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Breaking change

Testing

On a local Qbox server, with a listener in a phone resource that wipes the character's phone data:

  • Built-in character menu: event received, phone data removed.
  • External character resource calling storage.deletePlayer: event received, phone data removed.
  • exports.qbx_core:DeleteCharacter: event received, 7 rows across 7 tables removed.

Checklist

Fire qbx_core:server:characterDeleted with the citizenid from
storage.deletePlayer once the transaction succeeds. Emitting it from
storage covers every deletion path, including external character
resources that call the storage module directly, and lets resources
clean up their own per-character data instead of listing their tables
in characterDataTables.
@mur4i
mur4i marked this pull request as ready for review September 29, 2026 04:36
@ChatDisabled
ChatDisabled merged commit 1825a3c into Qbox-project:main Sep 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants