🚧 clean up listeners

This commit is contained in:
2023-10-09 09:17:43 +03:00
parent c214b6ca7f
commit 5d812d7acc
4 changed files with 21 additions and 2 deletions
+8 -1
View File
@@ -19,7 +19,7 @@ using Ragon.Protocol;
namespace Ragon.Client
{
public sealed class RagonEntity
public sealed class RagonEntity: IDisposable
{
private delegate void OnEventDelegate(RagonPlayer player, RagonBuffer serializer);
@@ -266,5 +266,12 @@ namespace Ragon.Client
OwnershipChanged?.Invoke(prevOwner, player);
}
public void Dispose()
{
_events.Clear();
_listeners.Clear();
_localListeners.Clear();
}
}
}