1
0

IClientAdminManager.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using Content.Shared.Administration;
  2. namespace Content.Client.Administration.Managers
  3. {
  4. /// <summary>
  5. /// Manages server admin permissions for the local player.
  6. /// </summary>
  7. public interface IClientAdminManager
  8. {
  9. /// <summary>
  10. /// Fired when the admin status of the local player changes, such as losing admin privileges.
  11. /// </summary>
  12. event Action AdminStatusUpdated;
  13. /// <summary>
  14. /// Gets the admin data for the client, if they are an admin.
  15. /// </summary>
  16. /// <param name="includeDeAdmin">
  17. /// Whether to return admin data for admins that are current de-adminned.
  18. /// </param>
  19. /// <returns><see langword="null" /> if the player is not an admin.</returns>
  20. AdminData? GetAdminData(bool includeDeAdmin = false);
  21. /// <summary>
  22. /// Checks whether the local player is an admin.
  23. /// </summary>
  24. /// <returns>true if the local player is an admin, false otherwise even if they are deadminned.</returns>
  25. bool IsActive();
  26. /// <summary>
  27. /// Checks whether the local player has an admin flag.
  28. /// </summary>
  29. /// <param name="flag">The flags to check. Multiple flags can be specified, they must all be held.</param>
  30. /// <returns>False if the local player is not an admin, inactive, or does not have all the flags specified.</returns>
  31. bool HasFlag(AdminFlags flag);
  32. /// <summary>
  33. /// Check if a player can execute a specified console command.
  34. /// </summary>
  35. bool CanCommand(string cmdName);
  36. /// <summary>
  37. /// Check if the local player can open the VV menu.
  38. /// </summary>
  39. bool CanViewVar();
  40. /// <summary>
  41. /// Check if the local player can spawn stuff in with the entity/tile spawn panel.
  42. /// </summary>
  43. bool CanAdminPlace();
  44. /// <summary>
  45. /// Check if the local player can execute server-side C# scripts.
  46. /// </summary>
  47. bool CanScript();
  48. /// <summary>
  49. /// Check if the local player can open the admin menu.
  50. /// </summary>
  51. bool CanAdminMenu();
  52. void Initialize();
  53. /// <summary>
  54. /// Checks if the client is an admin.
  55. /// </summary>
  56. /// <param name="includeDeAdmin">
  57. /// Whether to return admin data for admins that are current de-adminned.
  58. /// </param>
  59. /// <returns>true if the player is an admin, false otherwise.</returns>
  60. bool IsAdmin(bool includeDeAdmin = false)
  61. {
  62. return GetAdminData(includeDeAdmin) != null;
  63. }
  64. }
  65. }