[This is preliminary documentation and is subject to change.]
Core of an fCraft server. Manages startup/shutdown, online player
sessions, global events and scheduled tasks.
Namespace: fCraftAssembly: fCraft (in fCraft.dll) Version: 0.6.3.5 (0.6.3.5)
Syntax
| C# |
public static class Server
Members
| All Members | Fields | Properties | Methods | Events |
| Member | Description | |
|---|---|---|
| BackupData()()()() | ||
| BindIPEndPointCallback(ServicePoint, IPEndPoint, Int32) | ||
| CancelShutdown()()()() | Attempts to cancel the shutdown timer. | |
| CheckConnectionsInterval | ||
| CheckIdlesInterval | Interval at which Server checks for idle players (to kick idlers). | |
| CountPlayers(Boolean) | Counts online players, optionally including hidden ones. | |
| CountVisiblePlayers(Player) | Counts online players whom the given observer can see. | |
| CPUUsageLastMinute | ||
| CPUUsageTotal | ||
| ExternalIP | External IP address of this machine, as reported by checkip.dyndns.org
Same as InternalIP, if dyndns check was not carried out or has failed. | |
| FindPlayerExact(Player, String, Boolean) | ||
| FindPlayerOrPrintMatches(Player, String, Boolean, Boolean) | Find player by name using autocompletion.
Returns null and prints message if none or multiple players matched.
Raises Player.SearchingForPlayer event, which may modify search results. | |
| FindPlayers(String, Boolean) | Finds a player by name, using autocompletion.
Returns ALL matching players, including hidden ones. | |
| FindPlayers(Player, String, Boolean) | Finds a player by name, using autocompletion. Does not include hidden players. | |
| GCInterval | Interval at which Server checks whether forced garbage collection is needed. | |
| GetArg(ArgKey) | Returns value of a given command-line argument (if present). Use HasArg to check flag arguments. | |
| GetArgList()()()() | Produces a list of arguments that were passed to this instance of fCraft. | |
| GetArgString()()()() | Produces a string containing all recognized arguments that wereset/passed to this instance of fCraft. | |
| GetRandomString(Int32) | Returns a cryptographically secure random string of given length. | |
| HasArg(ArgKey) | Checks whether a command-line argument was set. | |
| Initialized | Occurs when the server has been initialized. | |
| Initializing | Occurs when the server is about to be initialized. | |
| InitLibrary(IEnumerable<(Of <<'(String>)>>)) | Reads command-line switches and sets up paths and logging.
This should be called before any other library function.
Note to frontend devs: Subscribe to log-related events before calling this.
Does not raise any events besides Logger.Logged.
Throws exceptions on failure. | |
| InitServer()()()() | Initialized various server subsystems. This should be called after InitLibrary and before StartServer.
Loads config, PlayerDB, IP bans, AutoRank settings, builds a list of commands, and prepares the IRC bot.
Raises Server.Initializing and Server.Initialized events, and possibly Logger.Logged events.
Throws exceptions on failure. | |
| InternalIP | Internal IP address that the server's bound to (0.0.0.0 if not explicitly specified by the user). | |
| IsMonitoringCPUUsage | ||
| IsRunning | ||
| IsShuttingDown | Whether the server is currently being shut down. | |
| MakePlayerConnectedMessage(Player, Boolean, World) | ||
| Message(String, array<Object>[]()[][]) | Broadcasts a message to all online players.
Shorthand for Server.Players.Message | |
| Message(Player, String, array<Object>[]()[][]) | Broadcasts a message to all online players except one.
Shorthand for Server.Players.Except(except).Message | |
| PlayerListChanged | Occurs when the player list has just changed (any time players connected or disconnected). | |
| Players | List of online players.
This property is volatile and can change when players connect/disconnect,
so cache a reference if you need to refer to the same snapshot of the
playerlist more than once. | |
| Port | Number of the local listening port. | |
| RequestGC()()()() | Informs the server that garbage collection should be performed.
Actual collection is done on the background task thread, asynchronously, as needed. | |
| SearchingForPlayer | Occurs when a player is searching for players (with autocompletion).
The list of players in the search results may be replaced. | |
| SessionConnected | Occurs any time a new session has connected, but before any communication is done. | |
| SessionConnecting | Occurs any time the server receives an incoming connection (cancelable). | |
| SessionDisconnected | Occurs when a connection is closed or lost. | |
| Shutdown(ShutdownParams, Boolean) | Initiates the server shutdown with given parameters. | |
| ShutdownBegan | Occurs when the server is about to start shutting down. | |
| ShutdownEnded | Occurs when the server finished shutting down. | |
| Started | Occurs when the server has just started. | |
| Starting | Occurs when the server is about to start. | |
| StartServer()()()() | Starts the server:
Creates Console pseudoplayer, loads the world list, starts listening for incoming connections,
sets up scheduled tasks and starts the scheduler, starts the heartbeat, and connects to IRC.
Raises Server.Starting and Server.Started events.
May throw an exception on hard failure. | |
| StartTime | Time when the server started (UTC). Used to check uptime. | |
| Uri | Minecraft.net connection URL.
May be null (if heartbeat is disabled, or first heartbeat has not been sent yet). |