Class Server
A set of tools to easily work with the server.
Inheritance
Inherited Members
Namespace: Exiled.API.Features
Assembly: Exiled.API.dll
Syntax
public static class Server
Properties
| Improve this Doc View SourceBroadcast
Gets the cached Broadcast component.
Declaration
public static Broadcast Broadcast { get; }
Property Value
Type | Description |
---|---|
Broadcast |
BuildType
Gets a value indicating the type of build this server is hosted on.
Declaration
public static Version.VersionType BuildType { get; }
Property Value
Type | Description |
---|---|
GameCore.Version.VersionType |
Frametime
Gets the actual frametime of the server.
Declaration
public static double Frametime { get; }
Property Value
Type | Description |
---|---|
System.Double |
FriendlyFire
Gets or sets a value indicating whether or not friendly fire is enabled.
Declaration
public static bool FriendlyFire { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
See Also
| Improve this Doc View SourceHost
Gets the player's host of the server. Might be null when called when the server isn't loaded.
Declaration
public static Player Host { get; }
Property Value
Type | Description |
---|---|
Player |
IpAddress
Gets the Ip address of the server.
Declaration
public static string IpAddress { get; }
Property Value
Type | Description |
---|---|
System.String |
IsBeta
Gets a value indicating whether or not this server is on a beta version of SCP:SL.
Declaration
public static bool IsBeta { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsDedicated
Gets a value indicating whether or not this server is a dedicated server.
Declaration
public static bool IsDedicated { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsHeavilyModded
Gets or sets a value indicating whether the server is marked as Heavily Modded.
Declaration
public static bool IsHeavilyModded { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsIdleModeEnabled
Gets or sets a value indicating whether or not idle mode is enabled.
Declaration
public static bool IsIdleModeEnabled { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsVerified
Gets a value indicating whether or not this server is verified.
Declaration
public static bool IsVerified { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsWhitelisted
Gets or sets a value indicating whether or not this server has the whitelist enabled.
Declaration
public static bool IsWhitelisted { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
LateJoinEnabled
Gets a value indicating whether or not late join is enabled.
Declaration
public static bool LateJoinEnabled { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
LateJoinTime
Gets the late join time, in seconds. If a player joins less than this many seconds into a game, they will be given a random class.
Declaration
public static float LateJoinTime { get; }
Property Value
Type | Description |
---|---|
System.Single |
MaxPlayerCount
Gets or sets the maximum number of players able to be on the server.
Declaration
public static int MaxPlayerCount { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Name
Gets or sets the name of the server.
Declaration
public static string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String |
PermissionsHandler
Gets the RemoteAdmin permissions handler.
Declaration
public static PermissionsHandler PermissionsHandler { get; }
Property Value
Type | Description |
---|---|
PermissionsHandler |
PlayerCount
Gets the number of players currently on the server.
Declaration
public static int PlayerCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
See Also
| Improve this Doc View SourcePluginAssemblies
Gets a dictionary that pairs assemblies with their associated plugins.
Declaration
public static Dictionary<Assembly, IPlugin<IConfig>> PluginAssemblies { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.Reflection.Assembly, IPlugin<IConfig>> |
Port
Gets the port of the server.
Declaration
public static ushort Port { get; }
Property Value
Type | Description |
---|---|
System.UInt16 |
SendSpawnMessage
Gets the cached SendSpawnMessage System.Reflection.MethodInfo.
Declaration
public static MethodInfo SendSpawnMessage { get; }
Property Value
Type | Description |
---|---|
System.Reflection.MethodInfo |
SessionVariables
Gets the dictionary of the server's session variables.
Session variables can be used to save temporary data. Data is stored in a System.Collections.Generic.Dictionary<TKey, TValue>. The key of the data is always a System.String, whereas the value can be any System.Object. The data stored in a session variable can be accessed by different assemblies; it is recommended to uniquely identify stored data so that it does not conflict with other plugins that may also be using the same name. Data saved with session variables is not being saved on server restart. If the data must be saved after a restart, a database must be used instead.
Declaration
public static Dictionary<string, object> SessionVariables { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, System.Object> |
StreamingAllowed
Gets a value indicating whether or not streaming of this version is allowed.
Declaration
public static bool StreamingAllowed { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Tps
Gets the actual ticks per second of the server.
Declaration
public static double Tps { get; }
Property Value
Type | Description |
---|---|
System.Double |
Version
Gets the server's version.
Declaration
public static string Version { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
| Improve this Doc View SourceExecuteCommand(String, CommandSender)
Executes a server command.
Declaration
public static string ExecuteCommand(string command, CommandSender sender = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | command | The command to be run. |
CommandSender | sender | The CommandSender running the command. |
Returns
Type | Description |
---|---|
System.String | Command response, if there is one; otherwise, null. |
Restart()
Restarts the server, reconnects all players.
Declaration
public static void Restart()
See Also
| Improve this Doc View SourceRestartRedirect(UInt16)
Redirects players to a server on another port, restarts the current server.
Declaration
public static bool RestartRedirect(ushort redirectPort)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | redirectPort | The port to redirect players to. |
Returns
Type | Description |
---|---|
System.Boolean | true if redirection was successful; otherwise, false. |
Remarks
If the returned value is false, the server won't restart.
RunCommand(String, CommandSender)
Runs a server command.
Declaration
[Obsolete("Use Server.ExecuteCommand() instead.")]
public static void RunCommand(string command, CommandSender sender = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | command | The command to be run. |
CommandSender | sender | The CommandSender running the command. |
Shutdown()
Shutdowns the server, disconnects all players.
Declaration
public static void Shutdown()
See Also
| Improve this Doc View SourceShutdownRedirect(UInt16)
Redirects players to a server on another port, shutdowns the current server.
Declaration
public static bool ShutdownRedirect(ushort redirectPort)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | redirectPort | The port to redirect players to. |
Returns
Type | Description |
---|---|
System.Boolean | true if redirection was successful; otherwise, false. |
Remarks
If the returned value is false, the server won't shutdown.
TryGetSessionVariable<T>(String, out T)
Safely gets an System.Object from SessionVariables, then casts it to T
.
Declaration
public static bool TryGetSessionVariable<T>(string key, out T result)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key of the object to get. |
T | result | When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter is used. |
Returns
Type | Description |
---|---|
System.Boolean | true if the SessionVariables contains an element with the specified key; otherwise, false. |
Type Parameters
Name | Description |
---|---|
T | The returned object type. |