diff --git a/QSB/API/IQSBAPI.cs b/QSB/API/IQSBAPI.cs index 6e484d34..88641367 100644 --- a/QSB/API/IQSBAPI.cs +++ b/QSB/API/IQSBAPI.cs @@ -52,15 +52,16 @@ public interface IQSBAPI /// The unique key of the data you want to access. /// The data requested. If key is not valid, returns default. T GetCustomData(uint playerId, string key); - + /// /// Sends a message containing arbitrary data to every player. /// /// The type of the data being sent. This type must be serializable. /// The unique key of the message. /// The data to send. + /// The player to send this message to. (0 is the host, uint.MaxValue means every player) /// If true, the action given to will also be called on the same client that is sending the message. - void SendMessage(string messageType, T data, bool receiveLocally = false); + void SendMessage(string messageType, T data, uint to = uint.MaxValue, bool receiveLocally = false); /// /// Registers an action to be called when a message is received. diff --git a/QSB/API/QSBAPI.cs b/QSB/API/QSBAPI.cs index edc68959..3fa844d5 100644 --- a/QSB/API/QSBAPI.cs +++ b/QSB/API/QSBAPI.cs @@ -27,8 +27,8 @@ public class QSBAPI : IQSBAPI public void SetCustomData(uint playerId, string key, T data) => QSBPlayerManager.GetPlayer(playerId).SetCustomData(key, data); public T GetCustomData(uint playerId, string key) => QSBPlayerManager.GetPlayer(playerId).GetCustomData(key); - public void SendMessage(string messageType, T data, bool receiveLocally = false) - => new AddonDataMessage(messageType, data, receiveLocally).Send(); + public void SendMessage(string messageType, T data, uint to = uint.MaxValue, bool receiveLocally = false) + => new AddonDataMessage(messageType, data, receiveLocally) {To = to} .Send(); public void RegisterHandler(string messageType, Action handler) => AddonDataManager.RegisterHandler(messageType, handler);