Skip to content

Commit

Permalink
[Exiled::API] Added WhitelistedPlayers, SetIntercomDisplayTextForTa…
Browse files Browse the repository at this point in the history
…rgetOnly and ResetIntercomDisplayText (#6)

* Sync Changes

* Suggestion

Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com>

---------

Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com>
  • Loading branch information
NotZer0Two and Misaka-ZeroTwo authored Aug 1, 2024
1 parent 04bffe8 commit 0698e6e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
13 changes: 13 additions & 0 deletions EXILED/Exiled.API/Extensions/MirrorExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace Exiled.API.Extensions
using PlayerRoles;
using PlayerRoles.FirstPersonControl;
using PlayerRoles.PlayableScps.Scp049.Zombies;
using PlayerRoles.Voice;
using RelativePositioning;

using Respawning;
Expand Down Expand Up @@ -181,6 +182,18 @@ public static void PlayGunSound(this Player player, Vector3 position, ItemType i
player.Connection.Send(message);
}

/// <summary>
/// Sets <see cref="Features.Intercom.DisplayText"/> that only the <paramref name="target"/> player can see.
/// </summary>
/// <param name="target">Only this player can see Display Text.</param>
/// <param name="text">Text displayed to the player.</param>
public static void SetIntercomDisplayTextForTargetOnly(this Player target, string text) => target.SendFakeSyncVar(IntercomDisplay._singleton.netIdentity, typeof(IntercomDisplay), nameof(IntercomDisplay.Network_overrideText), text);

/// <summary>
/// Resync <see cref="Features.Intercom.DisplayText"/>.
/// </summary>
public static void ResetIntercomDisplayText() => ResyncSyncVar(IntercomDisplay._singleton.netIdentity, typeof(IntercomDisplay), nameof(IntercomDisplay.Network_overrideText));

/// <summary>
/// Sets <see cref="Room.Color"/> of a <paramref name="room"/> that only the <paramref name="target"/> player can see.
/// </summary>
Expand Down
5 changes: 5 additions & 0 deletions EXILED/Exiled.API/Features/Server.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ public static bool IsWhitelisted
set => ServerConsole.WhiteListEnabled = value;
}

/// <summary>
/// Gets the list of user IDs of players currently whitelisted.
/// </summary>
public static HashSet<string> WhitelistedPlayers => WhiteList.Users;

/// <summary>
/// Gets a value indicating whether or not this server is verified.
/// </summary>
Expand Down

0 comments on commit 0698e6e

Please sign in to comment.