mirror of
https://github.com/chylex/Minecraft-Phantom-Panel.git
synced 2024-11-24 22:42:53 +01:00
16 lines
603 B
C#
16 lines
603 B
C#
using System.Collections.Immutable;
|
|
using Phantom.Agent.Services.Instances;
|
|
using Phantom.Utils.Actor.Event;
|
|
|
|
namespace Phantom.Agent.Services;
|
|
|
|
sealed class AgentState {
|
|
private readonly ObservableState<ImmutableDictionary<Guid, Instance>> instancesByGuid = new (ImmutableDictionary<Guid, Instance>.Empty);
|
|
|
|
public ImmutableDictionary<Guid, Instance> InstancesByGuid => instancesByGuid.State;
|
|
|
|
public void UpdateInstance(Instance instance) {
|
|
instancesByGuid.PublisherSide.Publish(static (instancesByGuid, instance) => instancesByGuid.SetItem(instance.InstanceGuid, instance), instance);
|
|
}
|
|
}
|