WhitelistCondition.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System.Text.Json.Serialization;
  2. using System.Threading.Tasks;
  3. using JetBrains.Annotations;
  4. using Robust.Shared.Network;
  5. namespace Content.Server.Connection.Whitelist;
  6. /// <summary>
  7. /// This class is used to determine if a player should be allowed to join the server.
  8. /// It is used in <see cref="PlayerConnectionWhitelistPrototype"/>
  9. /// </summary>
  10. [ImplicitDataDefinitionForInheritors]
  11. [MeansImplicitUse]
  12. public abstract partial class WhitelistCondition
  13. {
  14. /// <summary>
  15. /// What action should be taken if this condition is met?
  16. /// Defaults to <see cref="ConditionAction.Next"/>.
  17. /// </summary>
  18. [DataField]
  19. public ConditionAction Action { get; set; } = ConditionAction.Next;
  20. }
  21. /// <summary>
  22. /// Determines what action should be taken if a condition is met.
  23. /// </summary>
  24. public enum ConditionAction
  25. {
  26. /// <summary>
  27. /// The player is allowed to join, and the next conditions will be skipped.
  28. /// </summary>
  29. Allow,
  30. /// <summary>
  31. /// The player is denied to join, and the next conditions will be skipped.
  32. /// </summary>
  33. Deny,
  34. /// <summary>
  35. /// The next condition should be checked.
  36. /// </summary>
  37. Next
  38. }