Interface IServerAPI
- Namespace
- Vintagestory.API.Server
- Assembly
- VintagestoryAPI.dll
API for general Server features
public interface IServerAPI
- Extension Methods
Properties
Config
The servers current configuration as configured in the serverconfig.json. You can set the values but you need to call MarkDirty() to have them saved
IServerConfig Config { get; }
Property Value
CurrentRunPhase
Returns the servers current run phase
EnumServerRunPhase CurrentRunPhase { get; }
Property Value
IsDedicated
Returns whether the current server a dedicated server
bool IsDedicated { get; }
Property Value
IsShuttingDown
Determines if the server process has been asked to terminate. Use this when you need to save data in a method registered using RegisterOnSave() before server quits.
bool IsShuttingDown { get; }
Property Value
- bool
true if server is about to shutdown
Logger
Returns a logging interface to log any log level message
ILogger Logger { get; }
Property Value
Players
All players known to the server (which joined at least once while the server was running)
IServerPlayer[] Players { get; }
Property Value
ServerIp
The ip adress the server is listening at
string ServerIp { get; }
Property Value
ServerUptimeMilliseconds
Server uptime in milliseconds
long ServerUptimeMilliseconds { get; }
Property Value
ServerUptimeSeconds
Returns the number of seconds the server has been running since last restart
int ServerUptimeSeconds { get; }
Property Value
- int
Server uptime in seconds
TotalReceivedBytes
long TotalReceivedBytes { get; }
Property Value
TotalSentBytes
long TotalSentBytes { get; }
Property Value
TotalWorldPlayTime
Returns the number of seconds the current world has been running. This is the playtime displayed on the singleplayer world list.
int TotalWorldPlayTime { get; }
Property Value
Methods
AddPhysicsTickable(IPhysicsTickable)
Remove an entity from the physics ticking system on the server.
void AddPhysicsTickable(IPhysicsTickable entityBehavior)
Parameters
entityBehavior
IPhysicsTickable
AddServerThread(string, IAsyncServerSystem)
Allows mods to add a ServerThread. Useful for off-thread tasks which must be run continuously (at specified intervals) while the server is running. Calling code simply needs to implement IAsyncServerSystem
void AddServerThread(string threadname, IAsyncServerSystem system)
Parameters
threadname
stringsystem
IAsyncServerSystem
LoadMiniDimension(IMiniDimension)
Add the specified dimension to the LoadedMiniDimensions, and return its index.
A mini dimension is a small set of blocks up to 4096x4096x4096 used for schematic previews, vehicles etc
int LoadMiniDimension(IMiniDimension blocks)
Parameters
blocks
IMiniDimension
Returns
LogBuild(string, params object[])
Log given message with type = EnumLogType.Build
void LogBuild(string message, params object[] args)
Parameters
LogChat(string, params object[])
Log given message with type = EnumLogType.Chat
void LogChat(string message, params object[] args)
Parameters
LogDebug(string, params object[])
Log given message with type = EnumLogType.Debug
void LogDebug(string message, params object[] args)
Parameters
LogError(string, params object[])
Log given message with type = EnumLogType.Error
void LogError(string message, params object[] args)
Parameters
LogEvent(string, params object[])
void LogEvent(string message, params object[] args)
Parameters
LogFatal(string, params object[])
Log given message with type = EnumLogType.Fatal
void LogFatal(string message, params object[] args)
Parameters
LogNotification(string, params object[])
Log given message with type = EnumLogType.Notification
void LogNotification(string message, params object[] args)
Parameters
LogVerboseDebug(string, params object[])
Log given message with type = EnumLogType.VerboseDebug
void LogVerboseDebug(string message, params object[] args)
Parameters
LogWarning(string, params object[])
Log given message with type = EnumLogType.Warning
void LogWarning(string message, params object[] args)
Parameters
MarkConfigDirty()
Marks the config dirty for saving
void MarkConfigDirty()
PauseThread(string, int)
Does a blocking wait until given thread is paused. Returns true if the thread was paused within given time
bool PauseThread(string threadname, int waitTimeoutMs = 5000)
Parameters
Returns
RemovePhysicsTickable(IPhysicsTickable)
Add an entity to the physics ticking system on the server.
void RemovePhysicsTickable(IPhysicsTickable entityBehavior)
Parameters
entityBehavior
IPhysicsTickable
ResumeThread(string)
Resumes a previously paused thread
void ResumeThread(string threadname)
Parameters
threadname
string
SetMiniDimension(IMiniDimension, int)
Set the specified dimension at the specified LoadedMiniDimensions index, and return its index
A mini dimension is a small set of blocks up to 4096x4096x4096 used for schematic previews, vehicles etc
int SetMiniDimension(IMiniDimension miniDimension, int index)
Parameters
miniDimension
IMiniDimensionindex
int
Returns
ShutDown()
Gracefully shuts down the server
void ShutDown()