LabAPI icon indicating copy to clipboard operation
LabAPI copied to clipboard

[BUG] Player.Items gives InvalidCastException

Open gamendegamer321 opened this issue 1 year ago • 1 comments

When getting the items for a player an invalid cast exception is thrown. This also means that things like Player.Clear do not work.

Error I got while trying to clear a player:

[2025-02-24 21:03:24.043 +01:00] [ERROR] [SpawnItems] [SpawnItems] [Event: SetRankRoleItem] System.InvalidCastException: Specified cast is not valid.
                                   at (wrapper castclass) System.Object.__castclass_with_cache(object,intptr,intptr)
                                   at LabApi.Features.Wrappers.Player.get_Items () [0x00035] in <c20488a5a42a492c931d89475bee91cb>:0
                                   at LabApi.Features.Wrappers.Player.ClearItems () [0x00000] in <c20488a5a42a492c931d89475bee91cb>:0
                                   at LabApi.Features.Wrappers.Player.ClearInventory (System.Boolean clearAmmo, System.Boolean clearItems) [0x0000c] in <c20488a5a42a492c931d89475bee91cb>:0
                                   at SpawnItems.EventHandlers+<>c__DisplayClass3_0.<SetItems>b__0 () [0x000f2] in <8196af5b232e404795ca612496e295f1>:0```

gamendegamer321 avatar Feb 24 '25 20:02 gamendegamer321

Fixed in next version

davidsebesta1 avatar Mar 09 '25 12:03 davidsebesta1