mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-06 01:00:16 +00:00
25 lines
751 B
C#
25 lines
751 B
C#
using System;
|
|
using QSB.API.Messages;
|
|
using QSB.Messaging;
|
|
using QSB.Player;
|
|
|
|
namespace QSB.API;
|
|
|
|
public class QSBAPI : IQSBAPI
|
|
{
|
|
public uint GetLocalPlayerID() => QSBPlayerManager.LocalPlayerId;
|
|
|
|
public void SetCustomData<T>(uint playerId, string key, T data) => QSBPlayerManager.GetPlayer(playerId).SetCustomData(key, data);
|
|
public T GetCustomData<T>(uint playerId, string key) => QSBPlayerManager.GetPlayer(playerId).GetCustomData<T>(key);
|
|
|
|
public void SendMessage<T>(string messageType, T data, bool receiveLocally = false)
|
|
{
|
|
new AddonDataMessage(messageType, data, receiveLocally).Send();
|
|
}
|
|
|
|
public void RegisterHandler<T>(string messageType, Action<uint, T> handler)
|
|
{
|
|
AddonDataManager.RegisterHandler(messageType, handler);
|
|
}
|
|
}
|