Class MessageApi
A class to send, receive and edit messages
Inheritance
Inherited Members
Namespace: LLBML.Messages
Assembly: LLBModdingLib.dll
Syntax
public static class MessageApi
Methods
RegisterCustomMessage(PluginInfo, UInt16, String, MessageActions)
Register a custom message that will be assiociated with the provided code and call the various actions contained into it's MessageActions
Declaration
public static CustomMessage RegisterCustomMessage(PluginInfo pluginInfo, ushort messageCode, string messageName, MessageActions messageActions)
Parameters
| Type | Name | Description |
|---|---|---|
| BepInEx.PluginInfo | pluginInfo | The BepInEx.PluginInfo of the requesting plugin |
| System.UInt16 | messageCode | The code to register |
| System.String | messageName | The name/reason for the message code |
| MessageActions | messageActions | A MessageActions containing the actions to do when a message with the provided code is received |
Returns
| Type | Description |
|---|---|
| CustomMessage |
RegisterCustomMessage(PluginInfo, UInt16, String, Action<Message>)
Register a custom message that will be assiociated with the provided code and call the provided method when received
Declaration
public static CustomMessage RegisterCustomMessage(PluginInfo pluginInfo, ushort messageCode, string messageName, Action<Message> onReceiveMessageCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| BepInEx.PluginInfo | pluginInfo | The BepInEx.PluginInfo of the requesting plugin |
| System.UInt16 | messageCode | The code to register |
| System.String | messageName | The name/reason for the message code |
| System.Action<Message> | onReceiveMessageCallback | The method to call when receiving the message |
Returns
| Type | Description |
|---|---|
| CustomMessage |
SubscribeToVanillaMessage(PluginInfo, Msg, String, MessageActions)
Subscribe to a vanilla message and calls back the actions in the MessageActions
Declaration
public static CustomMessage SubscribeToVanillaMessage(PluginInfo pluginInfo, Msg messageCode, string messageName, MessageActions messageActions)
Parameters
| Type | Name | Description |
|---|---|---|
| BepInEx.PluginInfo | pluginInfo | The BepInEx.PluginInfo of the requesting plugin |
| Msg | messageCode | The code to subscribe to |
| System.String | messageName | The name/reason for the message code |
| MessageActions | messageActions | A MessageActions containing the actions to do when a message with the provided code is received |
Returns
| Type | Description |
|---|---|
| CustomMessage |
SubscribeToVanillaMessage(PluginInfo, Msg, String, Action<Message>)
Subscribe to a vanilla message and calls back the actions in the MessageActions
Declaration
public static CustomMessage SubscribeToVanillaMessage(PluginInfo pluginInfo, Msg messageCode, string messageName, Action<Message> onReceiveMessageCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| BepInEx.PluginInfo | pluginInfo | The BepInEx.PluginInfo of the requesting plugin |
| Msg | messageCode | The code to subscribe to |
| System.String | messageName | The name/reason for the message code |
| System.Action<Message> | onReceiveMessageCallback | The method to call when receiving the message |
Returns
| Type | Description |
|---|---|
| CustomMessage |
UnregisterCustomMessage(PluginInfo, UInt16)
Removes the custom message associated with a code
Declaration
public static bool UnregisterCustomMessage(PluginInfo pluginInfo, ushort messageCode)
Parameters
| Type | Name | Description |
|---|---|---|
| BepInEx.PluginInfo | pluginInfo | The BepInEx.PluginInfo of the requesting plugin |
| System.UInt16 | messageCode | The code to unregister |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the message was successfuly unregistered, false otherwise |
UnsubscribeToVanillaMessage(PluginInfo, Byte, CustomMessage)
Removes the custom message associated with a code
Declaration
public static bool UnsubscribeToVanillaMessage(PluginInfo pluginInfo, byte messageCode, CustomMessage customMessage)
Parameters
| Type | Name | Description |
|---|---|---|
| BepInEx.PluginInfo | pluginInfo | The BepInEx.PluginInfo of the requesting plugin |
| System.Byte | messageCode | The code that was subscribe to |
| CustomMessage | customMessage | The customMessage to unregister |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the message was successfuly unregistered, false otherwise |