Skip to content

Fire hooks when timed punishments are applied or removed - #193

Merged
plally merged 1 commit into
masterfrom
feat/cfc-timed-punishments
Jun 12, 2026
Merged

Fire hooks when timed punishments are applied or removed#193
plally merged 1 commit into
masterfrom
feat/cfc-timed-punishments

Conversation

@plally

@plally plally commented Jun 11, 2026

Copy link
Copy Markdown
Member

Summary

  • Fires CFC_TimedPunishments_Punished (steamID64, punishment, expiration, issuer, reason) in TP.Punish after writing to the local DB
  • Fires CFC_TimedPunishments_Unpunished (steamID64, punishment) in TP.Unpunish after removing from the local DB

This allows external addons to react to timed punishment changes without patching this module. Specifically intended for gm_audit_glua integration.

Test plan

  • Apply a timed punishment to a player and verify CFC_TimedPunishments_Punished fires with correct args
  • Remove a timed punishment and verify CFC_TimedPunishments_Unpunished fires
  • Confirm existing punishment behaviour (enable/disable, DB writes) is unchanged

Fires CFC_TimedPunishments_Punished and CFC_TimedPunishments_Unpunished
so external addons (e.g. gm_audit_glua) can react to punishment changes
without patching this module.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds addon-facing hooks around timed punishment state changes so external modules can react without patching timed punishments internals (per PR description, for gm_audit_glua integration).

Changes:

  • Fire CFC_TimedPunishments_Punished after persisting a new timed punishment.
  • Fire CFC_TimedPunishments_Unpunished after removing a timed punishment from persistence.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 31 to 35
function TP.Punish( steamID64, punishment, expiration, issuer, reason )
Data:createPunishment( punishment, steamID64, expiration, issuer, reason )
hook.Run( "CFC_TimedPunishments_Punished", steamID64, punishment, expiration, issuer, reason )

local ply = player.GetBySteamID64( steamID64 )
Comment on lines 47 to 51
function TP.Unpunish( steamID64, punishment )
Data:removePunishment( punishment, steamID64 )
hook.Run( "CFC_TimedPunishments_Unpunished", steamID64, punishment )

local ply = player.GetBySteamID64( steamID64 )
@plally
plally merged commit 8ad037b into master Jun 12, 2026
3 checks passed
@plally
plally deleted the feat/cfc-timed-punishments branch June 12, 2026 15:30
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