mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-29 00:32:43 +00:00
24 lines
533 B
C#
24 lines
533 B
C#
using QSB.Messaging;
|
|
using QSB.Utility;
|
|
|
|
namespace QSB.API.Messages;
|
|
|
|
public class AddonDataMessage : QSBMessage<(int hash, byte[] data, bool receiveLocally)>
|
|
{
|
|
public AddonDataMessage(int hash, object data, bool receiveLocally) : base((hash, data.ToBytes(), receiveLocally)) { }
|
|
|
|
public override void OnReceiveLocal()
|
|
{
|
|
if (Data.receiveLocally)
|
|
{
|
|
OnReceiveRemote();
|
|
}
|
|
}
|
|
|
|
public override void OnReceiveRemote()
|
|
{
|
|
var obj = Data.data.ToObject();
|
|
AddonDataManager.OnReceiveDataMessage(Data.hash, obj, From);
|
|
}
|
|
}
|