Class SettingBase
- Namespace
- Exiled.API.Features.Core.UserSettings
- Assembly
- Exiled.API.dll
A base class for all Server Specific Settings.
public class SettingBase : TypeCastObject<SettingBase>, IWrapper<ServerSpecificSettingBase>- Inheritance
- 
      
      
      SettingBase
- Implements
- 
      IWrapper<ServerSpecificSettingBase>
- Derived
- Inherited Members
- Extension Methods
Properties
Base
Gets the base UserSettings.ServerSpecific.ServerSpecificSettingBase that this class is wrapping.
public ServerSpecificSettingBase Base { get; }Property Value
- ServerSpecificSettingBase
CollectionId
Gets or sets a value controlling if this setting is shared across servers with same Ip address!. Default value is 255.
public byte CollectionId { get; set; }Property Value
Remarks
Settings with this value between 0 and 20 will store the servers Ip (or other unique identifier) instead of port, meaning the client treats a setting between 1.1.1.1:7777 and 1.1.1.1:7778 the same.
If this value is above 20, the aforementioned behavior will not occur and the setting will behave as normal.
Header
Gets or sets the header of this setting.
public HeaderSetting Header { get; set; }Property Value
Remarks
Can be null.
HintDescription
Gets or sets the description of this setting.
public string HintDescription { get; set; }Property Value
Id
Gets or sets the id of this setting.
public int Id { get; set; }Property Value
IsServerOnly
Gets or sets a value indicating whether the setting receives updates from server (and client stops sending updates).
public bool IsServerOnly { get; set; }Property Value
Remarks
Useful for displaying information, you cannot receive updates from a setting with this enabled.
Label
Gets or sets the label of this setting.
public string Label { get; set; }Property Value
List
Gets the list of settings that were used as a prefabs.
public static IReadOnlyCollection<SettingBase> List { get; }Property Value
OnChanged
Gets or sets the action to be executed when this setting is changed.
public Action<Player, SettingBase> OnChanged { get; set; }Property Value
OriginalDefinition
Gets the setting that was sent to players.
public SettingBase OriginalDefinition { get; }Property Value
Remarks
Can be null if this SettingBase is a prefab.
ResponseMode
Gets the response mode of this setting.
public ServerSpecificSettingBase.UserResponseMode ResponseMode { get; }Property Value
- ServerSpecificSettingBase.UserResponseMode
SyncOnJoin
Gets or sets the predicate for syncing this setting when a player joins.
public static Predicate<Player> SyncOnJoin { get; set; }Property Value
SyncedList
Gets the list of all synced settings.
public static IReadOnlyDictionary<Player, ReadOnlyCollection<SettingBase>> SyncedList { get; }Property Value
Methods
Create(ServerSpecificSettingBase)
Creates a new instance of this setting.
public static SettingBase Create(ServerSpecificSettingBase settingBase)Parameters
- settingBaseServerSpecificSettingBase
- A UserSettings.ServerSpecific.ServerSpecificSettingBase instance. 
Returns
- SettingBase
- A new instance of this setting. 
Remarks
This method is used only to create a new instance of SettingBase from an existing UserSettings.ServerSpecific.ServerSpecificSettingBase instance. New setting won't be synced with players.
Create<T>(ServerSpecificSettingBase)
Creates a new instance of this setting.
public static T Create<T>(ServerSpecificSettingBase settingBase) where T : SettingBaseParameters
- settingBaseServerSpecificSettingBase
- AUserSettings.ServerSpecific.ServerSpecificSettingBase instance. 
Returns
- T
- A new instance of this setting. 
Type Parameters
- T
- Type of the setting. 
Remarks
This method is used only to create a new instance of SettingBase from an existing UserSettings.ServerSpecific.ServerSpecificSettingBase instance. New setting won't be synced with players.
Register(Player, IEnumerable<SettingBase>)
Registers all settings from the specified collection to player.
public static IEnumerable<SettingBase> Register(Player player, IEnumerable<SettingBase> settings)Parameters
- playerPlayer
- A player that will receive settings. 
- settingsIEnumerable<SettingBase>
- A collection of settings to register. 
Returns
- IEnumerable<SettingBase>
- A IEnumerable<T> of SettingBase instances that were successfully registered. 
Remarks
This method is used to sync new settings with players.
Register(IEnumerable<SettingBase>, Func<Player, bool>)
Registers all settings from the specified collection.
public static IEnumerable<SettingBase> Register(IEnumerable<SettingBase> settings, Func<Player, bool> predicate = null)Parameters
- settingsIEnumerable<SettingBase>
- A collection of settings to register. 
- predicateFunc<Player, bool>
- A requirement to meet when sending settings to players. 
Returns
- IEnumerable<SettingBase>
- A IEnumerable<T> of SettingBase instances that were successfully registered. 
Remarks
This method is used to sync new settings with players.
SendToAll()
Syncs setting with all players.
public static void SendToAll()SendToAll(Func<Player, bool>)
Syncs setting with all players according to the specified predicate.
public static void SendToAll(Func<Player, bool> predicate)Parameters
SendToPlayer(Player)
Syncs setting with the specified target.
public static void SendToPlayer(Player player)Parameters
- playerPlayer
- Target player. 
SendToPlayer(Player, IEnumerable<SettingBase>)
Syncs specific settings with the specified target.
public static void SendToPlayer(Player player, IEnumerable<SettingBase> settings)Parameters
- playerPlayer
- Target player. 
- settingsIEnumerable<SettingBase>
- Settings to send to the player. 
ToString()
Returns a string representation of this SettingBase.
public override string ToString()Returns
- string
- A string in human-readable format. 
TryGetSetting(Player, int, out SettingBase)
Tries to get the setting with the specified id.
public static bool TryGetSetting(Player player, int id, out SettingBase setting)Parameters
- playerPlayer
- Player who has received the setting. 
- idint
- Id of the setting. 
- settingSettingBase
- A SettingBase instance if found. Otherwise, - null.
Returns
- bool
- trueif the setting was found,- falseotherwise.
TryGetSetting<T>(Player, int, out T)
Tries to get the setting with the specified id.
public static bool TryGetSetting<T>(Player player, int id, out T setting) where T : SettingBaseParameters
- playerPlayer
- Player who has received the setting. 
- idint
- Id of the setting. 
- settingT
- A SettingBase instance if found. Otherwise, - null.
Returns
- bool
- trueif the setting was found,- falseotherwise.
Type Parameters
- T
- Type of the setting. 
Unregister(Player, IEnumerable<SettingBase>)
Removes settings from players.
public static IEnumerable<SettingBase> Unregister(Player player, IEnumerable<SettingBase> settings = null)Parameters
- playerPlayer
- Determines which player will receive this update. 
- settingsIEnumerable<SettingBase>
- Settings to remove. If - null, all settings will be removed.
Returns
- IEnumerable<SettingBase>
- A IEnumerable<T> of SettingBase instances that were successfully removed. 
Remarks
This method is used to unsync settings from players. Using it with Register(Player, IEnumerable<SettingBase>) provides an opportunity to update synced settings.
Unregister(Func<Player, bool>, IEnumerable<SettingBase>)
Removes settings from players.
public static IEnumerable<SettingBase> Unregister(Func<Player, bool> predicate = null, IEnumerable<SettingBase> settings = null)Parameters
- predicateFunc<Player, bool>
- Determines which players will receive this update. 
- settingsIEnumerable<SettingBase>
- Settings to remove. If - null, all settings will be removed.
Returns
- IEnumerable<SettingBase>
- A IEnumerable<T> of SettingBase instances that were successfully removed. 
Remarks
This method is used to unsync settings from players. Using it with Register(IEnumerable<SettingBase>, Func<Player, bool>) provides an opportunity to update synced settings.
UpdateLabelAndHint(string, string, bool, Predicate<Player>)
Sends an updated label and hint to clients.
public void UpdateLabelAndHint(string label, string hint, bool overrideValue = true, Predicate<Player> filter = null)