Skip to content
This repository was archived by the owner on Apr 19, 2025. It is now read-only.

Commit 594a3d8

Browse files
committed
Revert "fix(server): update source for lib.logger (#1537)"
This reverts commit 80e5ac8. Expecting people to have tested their changes is a good meme.
1 parent dde282e commit 594a3d8

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

modules/inventory/server.lua

+8-8
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,7 @@ function Inventory.AddItem(inv, item, count, metadata, slot, cb)
11131113
}, true)
11141114

11151115
if invokingResource then
1116-
lib.logger(inv.player.source, 'addItem', ('"%s" added %sx %s to "%s"'):format(invokingResource, count, item.name, inv.label))
1116+
lib.logger(inv.owner, 'addItem', ('"%s" added %sx %s to "%s"'):format(invokingResource, count, item.name, inv.label))
11171117
end
11181118

11191119
success = true
@@ -1135,7 +1135,7 @@ function Inventory.AddItem(inv, item, count, metadata, slot, cb)
11351135
inv:syncSlotsWithClients(toSlot, true)
11361136

11371137
if invokingResource then
1138-
lib.logger(inv.player.source, 'addItem', ('"%s" added %sx %s to "%s"'):format(invokingResource, added, item.name, inv.label))
1138+
lib.logger(inv.owner, 'addItem', ('"%s" added %sx %s to "%s"'):format(invokingResource, added, item.name, inv.label))
11391139
end
11401140

11411141
for i = 1, #toSlot do
@@ -1315,7 +1315,7 @@ function Inventory.RemoveItem(inv, item, count, metadata, slot, ignoreTotal)
13151315
local invokingResource = server.loglevel > 1 and GetInvokingResource()
13161316

13171317
if invokingResource then
1318-
lib.logger(inv.player.source, 'removeItem', ('"%s" removed %sx %s from "%s"'):format(invokingResource, removed, item.name, inv.label))
1318+
lib.logger(inv.owner, 'removeItem', ('"%s" removed %sx %s from "%s"'):format(invokingResource, removed, item.name, inv.label))
13191319
end
13201320

13211321
return true
@@ -1544,7 +1544,7 @@ local function dropItem(source, playerInventory, fromData, data)
15441544
TriggerClientEvent('ox_inventory:createDrop', -1, dropId, Inventory.Drops[dropId], playerInventory.open and source, slot)
15451545

15461546
if server.loglevel > 0 then
1547-
lib.logger(playerInventory.player.source, 'swapSlots', ('%sx %s transferred from "%s" to "%s"'):format(data.count, toData.name, playerInventory.label, dropId))
1547+
lib.logger(playerInventory.owner, 'swapSlots', ('%sx %s transferred from "%s" to "%s"'):format(data.count, toData.name, playerInventory.label, dropId))
15481548
end
15491549

15501550
if server.syncInventory then server.syncInventory(playerInventory) end
@@ -1697,7 +1697,7 @@ lib.callback.register('ox_inventory:swapItems', function(source, data)
16971697
toData, fromData = Inventory.SwapSlots(fromInventory, toInventory, data.fromSlot, data.toSlot) --[[@as table]]
16981698

16991699
if server.loglevel > 0 then
1700-
lib.logger(playerInventory.player.source, 'swapSlots', ('%sx %s transferred from "%s" to "%s" for %sx %s'):format(fromData.count, fromData.name, fromInventory.owner and fromInventory.label or fromInventory.id, toInventory.owner and toInventory.label or toInventory.id, toData.count, toData.name))
1700+
lib.logger(playerInventory.owner, 'swapSlots', ('%sx %s transferred from "%s" to "%s" for %sx %s'):format(fromData.count, fromData.name, fromInventory.owner and fromInventory.label or fromInventory.id, toInventory.owner and toInventory.label or toInventory.id, toData.count, toData.name))
17011701
end
17021702
else return false, 'cannot_carry' end
17031703
else
@@ -1740,7 +1740,7 @@ lib.callback.register('ox_inventory:swapItems', function(source, data)
17401740
end
17411741

17421742
if server.loglevel > 0 then
1743-
lib.logger(playerInventory.player.source, 'swapSlots', ('%sx %s transferred from "%s" to "%s"'):format(data.count, fromData.name, fromInventory.owner and fromInventory.label or fromInventory.id, toInventory.owner and toInventory.label or toInventory.id))
1743+
lib.logger(playerInventory.owner, 'swapSlots', ('%sx %s transferred from "%s" to "%s"'):format(data.count, fromData.name, fromInventory.owner and fromInventory.label or fromInventory.id, toInventory.owner and toInventory.label or toInventory.id))
17441744
end
17451745
end
17461746

@@ -1790,7 +1790,7 @@ lib.callback.register('ox_inventory:swapItems', function(source, data)
17901790
end
17911791

17921792
if server.loglevel > 0 then
1793-
lib.logger(playerInventory.player.source, 'swapSlots', ('%sx %s transferred from "%s" to "%s"'):format(data.count, fromData.name, fromInventory.owner and fromInventory.label or fromInventory.id, toInventory.owner and toInventory.label or toInventory.id))
1793+
lib.logger(playerInventory.owner, 'swapSlots', ('%sx %s transferred from "%s" to "%s"'):format(data.count, fromData.name, fromInventory.owner and fromInventory.label or fromInventory.id, toInventory.owner and toInventory.label or toInventory.id))
17941794
end
17951795
end
17961796

@@ -2393,7 +2393,7 @@ RegisterServerEvent('ox_inventory:giveItem', function(slot, target, count)
23932393
if Inventory.AddItem(toInventory, item, count, data.metadata, toSlot) then
23942394
if Inventory.RemoveItem(fromInventory, item, count, data.metadata, slot) then
23952395
if server.loglevel > 0 then
2396-
lib.logger(fromInventory.player.source, 'giveItem', ('"%s" gave %sx %s to "%s"'):format(fromInventory.label, count, data.name, toInventory.label))
2396+
lib.logger(fromInventory.owner, 'giveItem', ('"%s" gave %sx %s to "%s"'):format(fromInventory.label, count, data.name, toInventory.label))
23972397
end
23982398

23992399
return

modules/shops/server.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ lib.callback.register('ox_inventory:buyItem', function(source, data)
271271

272272
if server.loglevel > 0 then
273273
if server.loglevel > 1 or fromData.price >= 500 then
274-
lib.logger(playerInv.player.source, 'buyItem', ('"%s" %s'):format(playerInv.label, message:lower()), ('shop:%s'):format(shop.label))
274+
lib.logger(playerInv.owner, 'buyItem', ('"%s" %s'):format(playerInv.label, message:lower()), ('shop:%s'):format(shop.label))
275275
end
276276
end
277277

server.lua

+3-3
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ lib.addCommand({'additem', 'giveitem'}, {
456456
source = Inventory(source) or { label = 'console', owner = 'console' }
457457

458458
if server.loglevel > 0 then
459-
lib.logger(source.player.source, 'admin', ('"%s" gave %sx %s to "%s"'):format(source.label, count, item.name, inventory.label))
459+
lib.logger(source.owner, 'admin', ('"%s" gave %sx %s to "%s"'):format(source.label, count, item.name, inventory.label))
460460
end
461461
end
462462
end)
@@ -484,7 +484,7 @@ lib.addCommand('removeitem', {
484484
source = Inventory(source) or {label = 'console', owner = 'console'}
485485

486486
if server.loglevel > 0 then
487-
lib.logger(source.player.source, 'admin', ('"%s" removed %sx %s from "%s"'):format(source.label, args.count, item.name, inventory.label))
487+
lib.logger(source.owner, 'admin', ('"%s" removed %sx %s from "%s"'):format(source.label, args.count, item.name, inventory.label))
488488
end
489489
end
490490
end)
@@ -512,7 +512,7 @@ lib.addCommand('setitem', {
512512
source = Inventory(source) or {label = 'console', owner = 'console'}
513513

514514
if server.loglevel > 0 then
515-
lib.logger(source.player.source, 'admin', ('"%s" set "%s" %s count to %sx'):format(source.label, inventory.label, item.name, args.count))
515+
lib.logger(source.owner, 'admin', ('"%s" set "%s" %s count to %sx'):format(source.label, inventory.label, item.name, args.count))
516516
end
517517
end
518518
end)

0 commit comments

Comments
 (0)