API: GetIsHost

This commit is contained in:
JohnCorby 2023-08-01 18:08:09 -07:00
parent ef6061664f
commit 37a0d4c853
3 changed files with 12 additions and 1 deletions

View File

@ -14,6 +14,11 @@ public interface IQSBAPI
/// </summary>
uint GetLocalPlayerID();
/// <summary>
/// Returns if the current player is the host.
/// </summary>
bool GetIsHost();
/// <summary>
/// Returns the name of a given player.
/// </summary>

View File

@ -14,6 +14,11 @@ public interface IQSBAPI
/// </summary>
uint GetLocalPlayerID();
/// <summary>
/// Returns if the current player is the host.
/// </summary>
bool GetIsHost();
/// <summary>
/// Returns the name of a given player.
/// </summary>
@ -52,7 +57,7 @@ public interface IQSBAPI
/// <param name="key">The unique key of the data you want to access.</param>
/// <returns>The data requested. If key is not valid, returns default.</returns>
T GetCustomData<T>(uint playerId, string key);
/// <summary>
/// Sends a message containing arbitrary data to every player.
/// </summary>

View File

@ -17,6 +17,7 @@ public class QSBAPI : IQSBAPI
}
public uint GetLocalPlayerID() => QSBPlayerManager.LocalPlayerId;
public bool GetIsHost() => QSBCore.IsHost;
public string GetPlayerName(uint playerId) => QSBPlayerManager.GetPlayer(playerId).Name;
public uint[] GetPlayerIDs() => QSBPlayerManager.PlayerList.Select(x => x.PlayerId).ToArray();