quantum-space-buddies/QSB/API/Messages/AddonDataMessage.cs
2023-08-03 14:55:27 -07:00

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);
}
}