1 sharedlibrarycore Server
RaidMax edited this page 2023-05-20 22:09:21 -05:00

Server Public class

Diagram

  flowchart LR
  classDef interfaceStyle stroke-dasharray: 5 5;
  classDef abstractStyle stroke-width:4px
  subgraph SharedLibraryCore
  SharedLibraryCore.Server[[Server]]
  class SharedLibraryCore.Server abstractStyle;
  end
  subgraph SharedLibraryCore.Interfaces
  SharedLibraryCore.Interfaces.IGameServer[[IGameServer]]
  class SharedLibraryCore.Interfaces.IGameServer interfaceStyle;
  end
SharedLibraryCore.Interfaces.IGameServer --> SharedLibraryCore.Server

Members

Properties

Public properties

Type Name Methods
List<ChatInfo> ChatHistory get, protected set
ClientHistoryInfo ClientHistory get
int ClientNum get
List<EFClient> Clients get, protected set
IReadOnlyList<EFClient> ConnectedClients get
Map CurrentMap get, set
bool CustomCallback get, protected set
long EndPoint get
IEventParser EventParser get, set
SemaphoreSlim EventProcessing get
Game GameCode get
Game GameName get, set
string GamePassword get, protected set
string Gametype get, set
string GametypeName get
string Hostname get, protected set
string IP
this is actually the listen address now
get, protected set
string Id get
bool IsInitialized get, set
bool IsLegacyGameIntegrationEnabled get
long LegacyDatabaseId get
string ListenAddress get
int ListenPort get
string LogPath get, protected set
ILogger Logger get
IManager Manager get, protected set
Map Map get
List<Map> Maps get, protected set
Nullable<DateTime> MatchEndTime get, protected set
Nullable<DateTime> MatchStartTime get, protected set
int MaxClients get, protected set
string Password get
string PerformanceBucket get, init
int Port get, protected set
int PrivateClientSlots get, protected set
IRConParser RconParser get, set
IRConConnection RemoteConnection get, protected set
List<Report> Reports get, set
IPEndPoint ResolvedIpEndPoint get, protected set
bool RestartRequested get, set
ServerConfiguration ServerConfig get
string ServerName get
bool Throttled get, protected set
string Version get, protected set
string Website get, protected set
string WorkingDirectory get, protected set

Methods

Public methods

Returns Name
Task Ban(string reason, EFClient target, EFClient origin, bool isEvade)
Perm ban a player from the server
GameEvent Broadcast(...)
Send a message to all players
Task BroadcastAsync(IEnumerable<string> messages, EFClient sender, CancellationToken token)
Task<string``[]> ExecuteCommandAsync(string command, CancellationToken token)
Task ExecuteEvent(GameEvent E)
List<EFClient> GetClientByName(string pName)
Get a player by name
todo: make this an extension
EFClient GetClientByNumber(int clientNumber)
List<EFClient> GetClientsAsList()
Returns list of all current players
Task<long> GetIdForServer(Server server)
void InitializeTokens()
Initalize the macro variables
Task Kick(...)
Task LoadMap(string mapName)
Change the current server map
Task<EFClient> OnClientConnected(EFClient P)
Add a player to the server's player list
Task OnClientDisconnected(EFClient client)
Remove player by client number
Task<bool> ProcessUpdatesAsync(CancellationToken token)
Task SetDvarAsync(string name, object value, CancellationToken token)
Task TempBan(string reason, TimeSpan length, EFClient target, EFClient origin)
Temporarily ban a player ( default 1 hour ) from the server
void ToAdmins(string message)
Send a message to all admins on the server
string ToString()
Task Unban(string reason, EFClient targetClient, EFClient originClient)
Unban a player by npID / GUID
Task Warn(string reason, EFClient target, EFClient origin)

Protected methods

Returns Name
void InitializeAutoMessages()
Initialize the messages to be broadcasted
Task<bool> ProcessEvent(GameEvent E)
Process any server event
Task<bool> ScriptLoaded()
Task Tell(string message, EFClient targetClient)
Send a message to a particular players

Details

Inheritance

Nested types

Enums

  • Game

Constructors

Server

Source code

public Server(ILogger<Server> logger, ILogger deprecatedLogger, ServerConfiguration config, IManager mgr, IRConConnectionFactory rconConnectionFactory, IGameLogReaderFactory gameLogReaderFactory, IServiceProvider serviceProvider)
Arguments
Type Name Description
ILogger<Server> logger
ILogger deprecatedLogger
ServerConfiguration config
IManager mgr
IRConConnectionFactory rconConnectionFactory
IGameLogReaderFactory gameLogReaderFactory
IServiceProvider serviceProvider

Methods

Kick [1/2]

Source code

public abstract Task Kick(string reason, EFClient target, EFClient origin, EFPenalty originalPenalty)
Arguments
Type Name Description
string reason
EFClient target
EFClient origin
EFPenalty originalPenalty

ExecuteCommandAsync

Source code

public abstract Task<string> ExecuteCommandAsync(string command, CancellationToken token)
Arguments
Type Name Description
string command
CancellationToken token

SetDvarAsync

Source code

public abstract Task SetDvarAsync(string name, object value, CancellationToken token)
Arguments
Type Name Description
string name
object value
CancellationToken token

GetClientsAsList

Source code

public List<EFClient> GetClientsAsList()
Summary

Returns list of all current players

Returns

OnClientConnected

Source code

public abstract Task<EFClient> OnClientConnected(EFClient P)
Arguments
Type Name Description
EFClient P EFClient pulled from memory reading
Summary

Add a player to the server's player list

Returns

True if player added successfully, false otherwise

OnClientDisconnected

Source code

public abstract Task OnClientDisconnected(EFClient client)
Arguments
Type Name Description
EFClient client
Summary

Remove player by client number

Returns

true if removal succeeded, false otherwise

GetClientByName

Source code

public List<EFClient> GetClientByName(string pName)
Arguments
Type Name Description
string pName EFClient name to search for
Summary

Get a player by name todo: make this an extension

Returns

Matching player if found

ProcessUpdatesAsync

Source code

public virtual Task<bool> ProcessUpdatesAsync(CancellationToken token)
Arguments
Type Name Description
CancellationToken token

ProcessEvent

Source code

protected abstract Task<bool> ProcessEvent(GameEvent E)
Arguments
Type Name Description
GameEvent E Event
Summary

Process any server event

Returns

True on sucess

ExecuteEvent

Source code

public abstract Task ExecuteEvent(GameEvent E)
Arguments
Type Name Description
GameEvent E

Broadcast [1/2]

Source code

public GameEvent Broadcast(string message, EFClient sender)
Arguments
Type Name Description
string message Message to be sent to all players
EFClient sender Client that initiated the broadcast
Summary

Send a message to all players

Broadcast [2/2]

Source code

public void Broadcast(IEnumerable<string> messages, EFClient sender)
Arguments
Type Name Description
IEnumerable<string> messages
EFClient sender

BroadcastAsync

Source code

public async Task BroadcastAsync(IEnumerable<string> messages, EFClient sender, CancellationToken token)
Arguments
Type Name Description
IEnumerable<string> messages
EFClient sender
CancellationToken token

Tell

Source code

protected async Task Tell(string message, EFClient targetClient)
Arguments
Type Name Description
string message Message to send
EFClient targetClient EFClient to send message to
Summary

Send a message to a particular players

ToAdmins

Source code

public void ToAdmins(string message)
Arguments
Type Name Description
string message Message to send out
Summary

Send a message to all admins on the server

Kick [2/2]

Source code

public Task Kick(string reason, EFClient target, EFClient origin)
Arguments
Type Name Description
string reason Reason for kicking
EFClient target EFClient to kick
EFClient origin Client initating the kick
Summary

Kick a player from the server

TempBan

public abstract Task TempBan(string reason, TimeSpan length, EFClient target, EFClient origin)
Arguments
Type Name Description
string reason Reason for banning the player
TimeSpan length Duration of the ban
EFClient target The client to ban
EFClient origin The client performing the ban
Summary

Temporarily ban a player ( default 1 hour ) from the server

Ban

public abstract Task Ban(string reason, EFClient target, EFClient origin, bool isEvade)
Arguments
Type Name Description
string reason The reason for the ban
EFClient target The person to ban
EFClient origin The person who banned the target
bool isEvade obsolete
Summary

Perm ban a player from the server

Warn

Source code

public abstract Task Warn(string reason, EFClient target, EFClient origin)
Arguments
Type Name Description
string reason
EFClient target
EFClient origin

Unban

public abstract Task Unban(string reason, EFClient targetClient, EFClient originClient)
Arguments
Type Name Description
string reason reason for unban
EFClient targetClient client being unbanned
EFClient originClient client performing the unban
Summary

Unban a player by npID / GUID

Returns

LoadMap

Source code

public async Task LoadMap(string mapName)
Arguments
Type Name Description
string mapName Non-localized map name
Summary

Change the current server map

InitializeTokens

public abstract void InitializeTokens()
Summary

Initalize the macro variables

InitializeAutoMessages

Source code

protected void InitializeAutoMessages()
Summary

Initialize the messages to be broadcasted

ToString

Source code

public override string ToString()

ScriptLoaded

Source code

protected async Task<bool> ScriptLoaded()

GetIdForServer

Source code

public abstract Task<long> GetIdForServer(Server server)
Arguments
Type Name Description
Server server

GetClientByNumber

Source code

public EFClient GetClientByNumber(int clientNumber)
Arguments
Type Name Description
int clientNumber

Properties

EndPoint

public long EndPoint { get; }

LegacyDatabaseId

public abstract long LegacyDatabaseId { get; }

Id

public virtual string Id { get; }

Manager

public IManager Manager { get; protected set; }

Logger

public ILogger Logger { get; }

ServerConfig

public ServerConfiguration ServerConfig { get; }

Maps

public List<Map> Maps { get; protected set; }

Reports

public List<Report> Reports { get; set; }

ChatHistory

public List<ChatInfo> ChatHistory { get; protected set; }

ClientHistory

public ClientHistoryInfo ClientHistory { get; }

GameName

public Game GameName { get; set; }

GameCode

public virtual Game GameCode { get; }

MatchEndTime

public Nullable<DateTime> MatchEndTime { get; protected set; }

MatchStartTime

public Nullable<DateTime> MatchStartTime { get; protected set; }

Hostname

public string Hostname { get; protected set; }

ServerName

public virtual string ServerName { get; }

Website

public string Website { get; protected set; }

Gametype

public string Gametype { get; set; }

GametypeName

public string GametypeName { get; }

GamePassword

public string GamePassword { get; protected set; }

PrivateClientSlots

public int PrivateClientSlots { get; protected set; }

CurrentMap

public Map CurrentMap { get; set; }

Map

public virtual Map Map { get; }

ClientNum

public int ClientNum { get; }

MaxClients

public int MaxClients { get; protected set; }

Clients

public List<EFClient> Clients { get; protected set; }

ConnectedClients

public virtual IReadOnlyList<EFClient> ConnectedClients { get; }

Password

public string Password { get; }

Throttled

public bool Throttled { get; protected set; }

CustomCallback

public bool CustomCallback { get; protected set; }

IsLegacyGameIntegrationEnabled

public virtual bool IsLegacyGameIntegrationEnabled { get; }

WorkingDirectory

public string WorkingDirectory { get; protected set; }

RemoteConnection

public IRConConnection RemoteConnection { get; protected set; }

RconParser

public IRConParser RconParser { get; set; }

EventParser

public IEventParser EventParser { get; set; }

LogPath

public string LogPath { get; protected set; }

RestartRequested

public bool RestartRequested { get; set; }

EventProcessing

public SemaphoreSlim EventProcessing { get; }

IP

public string IP { get; protected set; }
Summary

this is actually the listen address now

ListenAddress

public virtual string ListenAddress { get; }

ResolvedIpEndPoint

public IPEndPoint ResolvedIpEndPoint { get; protected set; }

Version

public string Version { get; protected set; }

IsInitialized

public bool IsInitialized { get; set; }

Port

public int Port { get; protected set; }

ListenPort

public virtual int ListenPort { get; }

PerformanceBucket

public string PerformanceBucket { get; init; }

Generated with ModularDoc