Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions EXILED/Exiled.API/Features/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1229,17 +1229,24 @@ public bool IsSpawnProtected
protected HealthStat CustomHealthStat { get; set; }

/// <summary>
/// Converts LabApi player to EXILED player.
/// Converts ReferenceHub to Player.
/// </summary>
/// <param name="player">The LabApi player.</param>
/// <param name="hub">The ReferenceHub.</param>
/// <returns>EXILED player.</returns>
public static implicit operator Player(LabApi.Features.Wrappers.Player player) => Get(player);
public static implicit operator Player(ReferenceHub hub) => Get(hub);

/// <summary>
/// Converts LabApi player to EXILED player.
/// </summary>
/// <param name="player">The LabApi player.</param>
/// <returns>EXILED player.</returns>
public static implicit operator Player(LabApi.Features.Wrappers.Player player) => Get(player);

/// <summary>
/// Converts EXILED player to LabApi player.
/// </summary>
/// <param name="player">The EXILED player.</param>
/// <returns>LabApi player.</returns>
public static implicit operator LabApi.Features.Wrappers.Player(Player player) => LabApi.Features.Wrappers.Player.Get(player?.ReferenceHub);

/// <summary>
Expand Down Expand Up @@ -1435,7 +1442,7 @@ public static Player Get(string args)
/// </summary>
/// <param name="apiPlayer">The <see cref="LabApi.Features.Wrappers.Player"/> class.</param>
/// <returns>A <see cref="Player"/> or <see langword="null"/> if not found.</returns>
public static Player Get(LabApi.Features.Wrappers.Player apiPlayer) => Get(apiPlayer.ReferenceHub);
public static Player Get(LabApi.Features.Wrappers.Player apiPlayer) => Get(apiPlayer?.ReferenceHub);

/// <summary>
/// Try-get a player given a <see cref="CommandSystem.ICommandSender"/>.
Expand Down
Loading