using AcDream.Plugin.Abstractions; namespace AcDream.Plugins.Smoke; public sealed class SmokePlugin : IAcDreamPlugin { private IPluginHost? _host; private int _entitiesSeen; public void Initialize(IPluginHost host) { _host = host; _host.Log.Info("smoke plugin initialized"); } public void Enable() { _host?.Log.Info("smoke plugin enabled"); if (_host is not null) { _host.Events.EntitySpawned += OnEntitySpawned; _host.Log.Info($"smoke plugin sees {_entitiesSeen} entities (replay count at subscribe)"); } } public void Disable() { if (_host is not null) _host.Events.EntitySpawned -= OnEntitySpawned; _host?.Log.Info($"smoke plugin disabled (saw {_entitiesSeen} entities total)"); } private void OnEntitySpawned(WorldEntitySnapshot snapshot) => _entitiesSeen++; }