diff --git a/modules/framework/es_extended/client.lua b/modules/framework/es_extended/client.lua index 6ba9534..ce90f27 100644 --- a/modules/framework/es_extended/client.lua +++ b/modules/framework/es_extended/client.lua @@ -2,6 +2,7 @@ if GetResourceState('es_extended') ~= 'started' then return end ESX = exports["es_extended"]:getSharedObject() +Callback = Callback or Require("lib/utility/shared/callbacks.lua") Framework = Framework or {} @@ -18,11 +19,10 @@ Framework.GetPlayerData = function() return ESX.GetPlayerData() end ---<-- TODO swap to internal callback system ---This will return a table of all the jobs in the framework. ---@return table Framework.GetFrameworkJobs = function() - local jobs = lib.callback.await('community_bridge:Callback:GetFrameworkJobs', false) + local jobs = Callback.Trigger('community_bridge:Callback:GetFrameworkJobs', false) return jobs end diff --git a/modules/framework/es_extended/server.lua b/modules/framework/es_extended/server.lua index d8d05dc..32583d3 100644 --- a/modules/framework/es_extended/server.lua +++ b/modules/framework/es_extended/server.lua @@ -2,6 +2,7 @@ if GetResourceState('es_extended') ~= 'started' then return end Prints = Prints or Require("lib/utility/shared/prints.lua") +Callback = Callback or Require("lib/utility/shared/callbacks.lua") ESX = exports["es_extended"]:getSharedObject() @@ -452,8 +453,7 @@ AddEventHandler("playerDropped", function() TriggerEvent("community_bridge:Server:OnPlayerUnload", src) end) ---<-- TODO swap to internal callback system -lib.callback.register('community_bridge:Callback:GetFrameworkJobs', function(source) +Callback.Register('community_bridge:Callback:GetFrameworkJobs', function(source) return Framework.GetFrameworkJobs() or {} end) diff --git a/modules/inventory/core_inventory/client.lua b/modules/inventory/core_inventory/client.lua index 95a5d27..ffa4b4c 100644 --- a/modules/inventory/core_inventory/client.lua +++ b/modules/inventory/core_inventory/client.lua @@ -1,6 +1,7 @@ ---@diagnostic disable: duplicate-set-field if GetResourceState('core_inventory') ~= 'started' then return end local core = exports.core_inventory +Callback = Callback or Require("lib/utility/shared/callbacks.lua") Inventory = Inventory or {} @@ -12,8 +13,7 @@ Inventory.GetItemInfo = function(item) if not frameworkName then return {} end local dataRepack = {} if frameworkName == 'es_extended' then - --<-- TODO swap to internal callback system - local callbackData = lib.callback.await('community_bridge:Callback:core_inventory', false) + local callbackData = Callback.Trigger('community_bridge:Callback:core_inventory', false) -- really really wish this inventory allowed me to pull the item list client side.... dataRepack = callbackData[item] if not dataRepack then return {} end diff --git a/modules/inventory/core_inventory/server.lua b/modules/inventory/core_inventory/server.lua index ef67251..b35868c 100644 --- a/modules/inventory/core_inventory/server.lua +++ b/modules/inventory/core_inventory/server.lua @@ -3,6 +3,7 @@ if GetResourceState('core_inventory') ~= 'started' then return end Inventory = Inventory or {} Inventory.Stashes = Inventory.Stashes or {} +Callback = Callback or Require("lib/utility/shared/callbacks.lua") local core = exports.core_inventory ---This will add an item, and return true or false based on success @@ -244,9 +245,8 @@ Inventory.GetImagePath = function(item) return imagePath or "https://avatars.githubusercontent.com/u/47620135" end ----<-- TODO swap to internal callback system ---This is used for the esx users, documentation doesnt show a client side available option for the inventory so we use jank callbacks to get this. -lib.callback.register('community_bridge:Callback:core_inventory', function(source) +Callback.Register('community_bridge:Callback:core_inventory', function(source) local items = core:getItemsList() return items or {} end) diff --git a/modules/phone/okokPhone/client.lua b/modules/phone/okokPhone/client.lua index 0472ca7..90b8c0a 100644 --- a/modules/phone/okokPhone/client.lua +++ b/modules/phone/okokPhone/client.lua @@ -2,6 +2,7 @@ local resourceName = "okokPhone" if GetResourceState(resourceName) == 'missing' then return end Phone = Phone or {} +Callback = Callback or Require("lib/utility/shared/callbacks.lua") ---This will get the name of the Phone system being being used. ---@return string @@ -15,8 +16,7 @@ end ---@param message string ---@return boolean Phone.SendEmail = function(email, title, message) - --<-- TODO swap to internal callback system - local success = lib.callback.await('community_bridge:Callback:okokPhone:sendEmail', false, email, title, message) --[[ @as boolean ]] + local success = Callback.Trigger('community_bridge:Callback:okokPhone:sendEmail', false, email, title, message) return success end diff --git a/modules/phone/okokPhone/server.lua b/modules/phone/okokPhone/server.lua index 30d4250..03b4e07 100644 --- a/modules/phone/okokPhone/server.lua +++ b/modules/phone/okokPhone/server.lua @@ -17,6 +17,7 @@ local resourceName = "okokPhone" if GetResourceState(resourceName) == 'missing' then return end Phone = Phone or {} +Callback = Callback or Require("lib/utility/shared/callbacks.lua") ---This will get the name of the Phone system being being used. ---@return string @@ -53,8 +54,7 @@ Phone.SendEmail = function(src, email, title, message) return success end ---<-- TODO swap to internal callback system -lib.callback.register('community_bridge:Callback:okokPhone:sendEmail', function(src, email, title, message) +Callback.Register('community_bridge:Callback:okokPhone:sendEmail', function(src, email, title, message) return Phone.SendEmail(src, email, title, message) end)