Skip to content

Commit

Permalink
Fixed "3DStreamRadio_UrlIsAllowed" hook not being called.
Browse files Browse the repository at this point in the history
Co-Authored-By: SligWolf <[email protected]>
  • Loading branch information
Grocel and SligWolf committed Nov 23, 2024
1 parent 08a75b5 commit 47990e1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions data_static/streamradio/version.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
447
1731972171
448
1732383526
18 changes: 9 additions & 9 deletions lua/streamradio_core/hook.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ local LIB = StreamRadioLib.Hook
table.Empty(LIB)

local g_namePrefixMain = "3DStreamRadio_mainHook_"
local g_nameprefixCustom = "3DStreamRadio_"
local g_namePrefixCustom = "3DStreamRadio_"
local g_hooks = {}
local g_orderCounter = 0

function LIB.GetMainHookIdentifier(eventName)
local function getMainHookIdentifier(eventName)
local identifier = g_namePrefixMain .. tostring(eventName or "")
return identifier
end

function LIB.GetCostomHookIdentifier(eventName)
local identifier = g_nameprefixCustom .. tostring(eventName or "")
local function getCustomHookIdentifier(eventName)
local identifier = g_namePrefixCustom .. tostring(eventName or "")
return identifier
end

Expand Down Expand Up @@ -140,7 +140,7 @@ function LIB.Add(eventName, identifier, func, order)
BuildOrder(hookData)

if not hookData.hasHook then
local hookIdentifier = LIB.GetMainHookIdentifier(eventName)
local hookIdentifier = getMainHookIdentifier(eventName)

hook.Remove(eventName, hookIdentifier)
hook.Add(eventName, hookIdentifier, function(...)
Expand Down Expand Up @@ -170,7 +170,7 @@ function LIB.Remove(eventName, identifier)
BuildOrder(hookData)

if table.IsEmpty(byName) then
local hookIdentifier = LIB.GetMainHookIdentifier(eventName)
local hookIdentifier = getMainHookIdentifier(eventName)

hook.Remove(eventName, hookIdentifier)
hookData.hasHook = nil
Expand All @@ -183,17 +183,17 @@ function LIB.Run(eventName, ...)
end

function LIB.AddCustom(eventName, ...)
local eventName = LIB.GetMainHookIdentifier(eventName)
local eventName = getCustomHookIdentifier(eventName)
return LIB.Add(eventName, ...)
end

function LIB.RemoveCustom(eventName, ...)
local eventName = LIB.GetMainHookIdentifier(eventName)
local eventName = getCustomHookIdentifier(eventName)
return LIB.Remove(eventName, ...)
end

function LIB.RunCustom(eventName, ...)
local eventName = LIB.GetMainHookIdentifier(eventName)
local eventName = getCustomHookIdentifier(eventName)
return LIB.Run(eventName, ...)
end

Expand Down

0 comments on commit 47990e1

Please sign in to comment.