Interface ICoreServerAPI
The core api implemented by the server. The main interface for accessing the server. Contains all sub components and some miscellaneous methods.
Inherited Members
Namespace: Vintagestory.API.Server
Assembly: VintagestoryAPI.dll
Syntax
public interface ICoreServerAPI : ICoreAPI, ICoreAPICommon
Properties
| Improve this Doc View SourceEvent
API Component for registering to various Events
Declaration
IServerEventAPI Event { get; }
Property Value
Type | Description |
---|---|
IServerEventAPI |
Groups
Everything related to player groups
Declaration
IGroupManager Groups { get; }
Property Value
Type | Description |
---|---|
IGroupManager |
Network
API for sending/receiving network packets
Declaration
IServerNetworkAPI Network { get; }
Property Value
Type | Description |
---|---|
IServerNetworkAPI |
Permissions
Everything related to roles and privileges
Declaration
IPermissionManager Permissions { get; }
Property Value
Type | Description |
---|---|
IPermissionManager |
PlayerData
World-agnostic player data. You can query this information even when the player is offline
Declaration
IPlayerDataManager PlayerData { get; }
Property Value
Type | Description |
---|---|
IPlayerDataManager |
Server
API Component for accessing server related functionality
Declaration
IServerAPI Server { get; }
Property Value
Type | Description |
---|---|
IServerAPI |
World
API for accessing anything in the game world
Declaration
IServerWorldAccessor World { get; }
Property Value
Type | Description |
---|---|
IServerWorldAccessor |
WorldManager
API Component for access/modify everything game world related
Declaration
IWorldManagerAPI WorldManager { get; }
Property Value
Type | Description |
---|---|
IWorldManagerAPI |
Methods
| Improve this Doc View SourceBroadcastMessageToAllGroups(String, EnumChatType, String)
Sends a chat message to all online players in all of their channels
Declaration
void BroadcastMessageToAllGroups(string message, EnumChatType chatType, string data = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | |
EnumChatType | chatType | |
System.String | data | Custom data to a message to be received by the client |
HandleCommand(IServerPlayer, String)
Calls a command as if given player called it
Declaration
void HandleCommand(IServerPlayer player, string message)
Parameters
Type | Name | Description |
---|---|---|
IServerPlayer | player | |
System.String | message |
InjectConsole(String)
Injects a message or command into the server console input processing system. This lets you run commands or chat as Admin.
Declaration
void InjectConsole(string message)
Parameters
Type | Name | Description |
---|---|---|
System.String | message |
RegisterBlock(Block)
Register a new Block. Must happen before server runphase LoadGame. These are sent to the client during connect, so only need to register them on the server side.
Declaration
void RegisterBlock(Block block)
Parameters
Type | Name | Description |
---|---|---|
Block | block | BlockType to register. The Server assigns a block id and sets block.blockId |
RegisterCommand(String, String, String, ServerChatCommandDelegate, String)
Registers a chat command. When registered on the client you access the command by prefixing a dot (.), on the server it's a slash (/)
Declaration
bool RegisterCommand(string command, string descriptionMsg, string syntaxMsg, ServerChatCommandDelegate handler, string requiredPrivilege = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | command | |
System.String | descriptionMsg | |
System.String | syntaxMsg | |
ServerChatCommandDelegate | handler | |
System.String | requiredPrivilege |
Returns
Type | Description |
---|---|
System.Boolean |
RegisterCommand(ServerChatCommand)
Registers a chat command. When registered on the client you access the command by prefixing a dot (.), on the server it's a slash (/)
Declaration
bool RegisterCommand(ServerChatCommand chatcommand)
Parameters
Type | Name | Description |
---|---|---|
ServerChatCommand | chatcommand |
Returns
Type | Description |
---|---|
System.Boolean |
RegisterCraftingRecipe(GridRecipe)
Registers a new crafting recipe. These are sent to the client during connect, so only need to register them on the server side.
Declaration
void RegisterCraftingRecipe(GridRecipe recipe)
Parameters
Type | Name | Description |
---|---|---|
GridRecipe | recipe |
RegisterItem(Item)
Register a new item type
Declaration
void RegisterItem(Item item)
Parameters
Type | Name | Description |
---|---|---|
Item | item |
RegisterTreeGenerator(AssetLocation, GrowTreeDelegate)
Registers a new tree generator
Declaration
void RegisterTreeGenerator(AssetLocation generatorCode, GrowTreeDelegate genhandler)
Parameters
Type | Name | Description |
---|---|---|
AssetLocation | generatorCode | |
GrowTreeDelegate | genhandler |
RegisterTreeGenerator(AssetLocation, ITreeGenerator)
Registers a new tree generator
Declaration
void RegisterTreeGenerator(AssetLocation generatorCode, ITreeGenerator gen)
Parameters
Type | Name | Description |
---|---|---|
AssetLocation | generatorCode | |
ITreeGenerator | gen |
SendIngameDiscovery(IServerPlayer, String, String, Object[])
Shows a discovery text on the players screen. If text is null the client will try to find a language entry using supplied code prefixed with 'ingamediscovery-' (which is recommended so that the errors are translated to the users local language)
Declaration
void SendIngameDiscovery(IServerPlayer player, string discoveryCode, string text = null, params object[] langparams)
Parameters
Type | Name | Description |
---|---|---|
IServerPlayer | player | |
System.String | discoveryCode | |
System.String | text | |
System.Object[] | langparams | If text is null, these are the arguments passed into the Language translation tool |
SendIngameError(IServerPlayer, String, String, Object[])
Shows a vibrating red text in the players screen. If text is null the client will try to find a language entry using supplied code prefixed with 'ingameerror-' (which is recommended so that the errors are translated to the users local language)
Declaration
void SendIngameError(IServerPlayer player, string errorCode, string text = null, params object[] langparams)
Parameters
Type | Name | Description |
---|---|---|
IServerPlayer | player | |
System.String | errorCode | |
System.String | text | |
System.Object[] | langparams | If text is null, these are the arguments passed into the Language translation tool |
SendMessage(IPlayer, Int32, String, EnumChatType, String)
Sends a chat message only to given player in given groupId
Declaration
void SendMessage(IPlayer player, int groupId, string message, EnumChatType chatType, string data = null)
Parameters
Type | Name | Description |
---|---|---|
IPlayer | player | |
System.Int32 | groupId | |
System.String | message | |
EnumChatType | chatType | |
System.String | data | Custom data to a message to be received by the client |
SendMessageToGroup(Int32, String, EnumChatType, String)
Sends a chat message to all online players in given player group
Declaration
void SendMessageToGroup(int groupid, string message, EnumChatType chatType, string data = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | groupid | |
System.String | message | |
EnumChatType | chatType | |
System.String | data | Custom data to a message to be received by the client |