Only disable panicbunker for admins with AdminFlags.Admin (#33879)

* Only disable panicbunker for admins with AdminFlags.Admin

* nicer curly braces
This commit is contained in:
slarticodefast
2024-12-18 14:15:04 +01:00
committed by GitHub
parent 6b99493e80
commit e7294bdf4f
4 changed files with 28 additions and 15 deletions

View File

@@ -18,7 +18,7 @@ public interface ISharedAdminManager
/// </param>
/// <returns><see langword="null" /> if the player is not an admin.</returns>
AdminData? GetAdminData(EntityUid uid, bool includeDeAdmin = false);
/// <summary>
/// Gets the admin data for a player, if they are an admin.
/// </summary>
@@ -37,24 +37,30 @@ public interface ISharedAdminManager
/// <remarks>
/// When used by the client, this only returns accurate results for the player's own entity.
/// </remarks>
/// <param name="includeDeAdmin">
/// Whether to check flags even for admins that are current de-adminned.
/// </param>
/// <returns>True if the player is and admin and has the specified flags.</returns>
bool HasAdminFlag(EntityUid player, AdminFlags flag)
bool HasAdminFlag(EntityUid player, AdminFlags flag, bool includeDeAdmin = false)
{
var data = GetAdminData(player);
return data != null && data.HasFlag(flag);
var data = GetAdminData(player, includeDeAdmin);
return data != null && data.HasFlag(flag, includeDeAdmin);
}
/// <summary>
/// See if a player has an admin flag.
/// </summary>
/// <remarks>
/// When used by the client, this only returns accurate results for the player's own session.
/// </remarks>
/// <param name="includeDeAdmin">
/// Whether to check flags even for admins that are current de-adminned.
/// </param>
/// <returns>True if the player is and admin and has the specified flags.</returns>
bool HasAdminFlag(ICommonSession player, AdminFlags flag)
bool HasAdminFlag(ICommonSession player, AdminFlags flag, bool includeDeAdmin = false)
{
var data = GetAdminData(player);
return data != null && data.HasFlag(flag);
var data = GetAdminData(player, includeDeAdmin);
return data != null && data.HasFlag(flag, includeDeAdmin);
}
/// <summary>
@@ -71,7 +77,7 @@ public interface ISharedAdminManager
{
return GetAdminData(uid, includeDeAdmin) != null;
}
/// <summary>
/// Checks if a player is an admin.
/// </summary>