Table of Contents

Class Server

Namespace
Exiled.API.Features
Assembly
Exiled.API.dll

A set of tools to easily work with the server.

public static class Server
Inheritance
Server
Inherited Members

Properties

Broadcast

Gets the cached Broadcast component.

public static Broadcast Broadcast { get; }

Property Value

Broadcast

BuildType

Gets a value indicating the type of build this server is hosted on.

public static Version.VersionType BuildType { get; }

Property Value

Version.VersionType

Frametime

Gets the actual frametime of the server.

public static double Frametime { get; }

Property Value

double

FriendlyFire

Gets or sets a value indicating whether friendly fire is enabled.

public static bool FriendlyFire { get; set; }

Property Value

bool
See Also

Host

Gets the player's host of the server. Might be null when called when the server isn't loaded.

public static Player Host { get; }

Property Value

Player

IpAddress

Gets the Ip address of the server.

public static string IpAddress { get; }

Property Value

string

IsBeta

Gets a value indicating whether this server is on a beta version of SCP:SL.

public static bool IsBeta { get; }

Property Value

bool

IsDedicated

Gets a value indicating whether this server is a dedicated server.

public static bool IsDedicated { get; }

Property Value

bool

IsHeavilyModded

Gets or sets a value indicating whether the server is marked as Heavily Modded. Read the VSR for more info about its usage.

[Obsolete("This field has been deleted because it used the wrong field (TransparentlyModded)")]
public static bool IsHeavilyModded { get; set; }

Property Value

bool

IsIdleModeEnabled

Gets or sets a value indicating whether idle mode is enabled.

public static bool IsIdleModeEnabled { get; set; }

Property Value

bool

IsTransparentlyModded

Gets or sets a value indicating whether the server is marked as Transparently Modded. It is not used now, wait for a new VSR update.

public static bool IsTransparentlyModded { get; set; }

Property Value

bool

IsVerified

Gets a value indicating whether this server is verified.

public static bool IsVerified { get; }

Property Value

bool

IsWhitelisted

Gets or sets a value indicating whether this server has the whitelist enabled.

public static bool IsWhitelisted { get; set; }

Property Value

bool

LateJoinEnabled

Gets a value indicating whether late join is enabled.

public static bool LateJoinEnabled { get; }

Property Value

bool

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.

public static float LateJoinTime { get; }

Property Value

float

MaxPlayerCount

Gets or sets the maximum number of players able to be on the server.

public static int MaxPlayerCount { get; set; }

Property Value

int

MaxTps

Gets or sets the max ticks per second of the server.

public static short MaxTps { get; set; }

Property Value

short

Name

Gets or sets the name of the server.

public static string Name { get; set; }

Property Value

string

PermissionsHandler

Gets the RemoteAdmin permissions handler.

public static PermissionsHandler PermissionsHandler { get; }

Property Value

PermissionsHandler

PlayerCount

Gets the number of players currently on the server.

public static int PlayerCount { get; }

Property Value

int
See Also

PluginAssemblies

Gets a dictionary that pairs assemblies with their associated plugins.

public static Dictionary<Assembly, IPlugin<IConfig>> PluginAssemblies { get; }

Property Value

Dictionary<Assembly, IPlugin<IConfig>>

Port

Gets the port of the server.

public static ushort Port { get; }

Property Value

ushort

SendSpawnMessage

Gets the cached SendSpawnMessage MethodInfo.

public static MethodInfo SendSpawnMessage { get; }

Property Value

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 Dictionary<TKey, TValue>. The key of the data is always a string, whereas the value can be any 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.

public static Dictionary<string, object> SessionVariables { get; }

Property Value

Dictionary<string, object>

StreamingAllowed

Gets a value indicating whether streaming of this version is allowed.

public static bool StreamingAllowed { get; }

Property Value

bool

Tps

Gets the actual ticks per second of the server.

public static double Tps { get; }

Property Value

double

Version

Gets the server's version.

public static string Version { get; }

Property Value

string

WhitelistedPlayers

Gets the list of user IDs of players currently whitelisted.

public static HashSet<string> WhitelistedPlayers { get; }

Property Value

HashSet<string>

Methods

ExecuteCommand(string, CommandSender)

Executes a server command.

public static string ExecuteCommand(string command, CommandSender sender = null)

Parameters

command string

The command to be run.

sender CommandSender

The CommandSender running the command.

Returns

string

Command response, if there is one; otherwise, null.

Restart()

Restarts the server, reconnects all players.

public static void Restart()
See Also

RestartRedirect(ushort)

Redirects players to a server on another port, restarts the current server.

public static bool RestartRedirect(ushort redirectPort)

Parameters

redirectPort ushort

The port to redirect players to.

Returns

bool

true if redirection was successful; otherwise, false.

Remarks

If the returned value is false, the server won't restart.

Shutdown()

Shutdowns the server, disconnects all players.

public static void Shutdown()
See Also

Shutdown(bool, bool)

Shutdowns the server, disconnects all players.

public static void Shutdown(bool quit, bool suppressShutdownBroadcast = false)

Parameters

quit bool

Indicates whether to terminate the application after shutting down the server.

suppressShutdownBroadcast bool

Indicates whether to suppress the broadcast notification about the shutdown.

See Also

ShutdownRedirect(ushort)

Redirects players to a server on another port, shutdowns the current server.

public static bool ShutdownRedirect(ushort redirectPort)

Parameters

redirectPort ushort

The port to redirect players to.

Returns

bool

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 object from SessionVariables, then casts it to T.

public static bool TryGetSessionVariable<T>(string key, out T result)

Parameters

key string

The key of the object to get.

result T

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

bool

true if the SessionVariables contains an element with the specified key; otherwise, false.

Type Parameters

T

The returned object type.