-
Notifications
You must be signed in to change notification settings - Fork 13
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
SwiftlyS2 Version
v1.0.3
Game
Counter-Strike 2
Operating System
Linux
Bug Description
GetPlayer in IPlayerManagerService interface states that it would return null if the player doesn't exist, but its type is IPlayer instead of IPlayer?.
| /// <summary> | |
| /// Retrieves the player associated with the specified player ID. | |
| /// </summary> | |
| /// <param name="playerid">The unique identifier of the player to retrieve. Must be a valid player ID.</param> | |
| /// <returns>An <see cref="IPlayer"/> instance representing the player with the specified ID, or <c>null</c> if no such | |
| /// player exists.</returns> | |
| public IPlayer GetPlayer( int playerid ); |
Also the implementation just instantiates a new Player instead of validating if it is valid.
swiftlys2/managed/src/SwiftlyS2.Core/Modules/Players/PlayerManagerService.cs
Lines 21 to 24 in 1e44570
| public IPlayer GetPlayer( int playerid ) | |
| { | |
| return new Player(playerid); | |
| } |
Steps to Reproduce
Swiftly API usage.
Expected Behavior
Either the documentation comments needs to be updated, or the method should return null when the passed playerid isn't valid (the better approach as we may face exceptions if referencing an invalid entity).
Actual Behavior
GetPlayer always return a Player instance regardless its valid.
Logs/Console Output
Plugin Information
No response
Additional Context
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Status
Done