diff --git a/src/AlternateLife.RageMP.Net/Elements/Entities/Entity.cs b/src/AlternateLife.RageMP.Net/Elements/Entities/Entity.cs index 343e161..8962d04 100644 --- a/src/AlternateLife.RageMP.Net/Elements/Entities/Entity.cs +++ b/src/AlternateLife.RageMP.Net/Elements/Entities/Entity.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; +using System.Linq; using System.Numerics; using System.Threading.Tasks; using AlternateLife.RageMP.Net.Data; @@ -243,6 +244,11 @@ public void ResetSharedData(string key) SetSharedData(key, null); } + public IReadOnlyDictionary GetAllData() + { + return _data.ToDictionary(x => x.Key, x => x.Value); + } + public bool TryGetData(string key, out object data) { Contract.NotEmpty(key, nameof(key)); diff --git a/src/AlternateLife.RageMP.Net/Interfaces/IEntity.cs b/src/AlternateLife.RageMP.Net/Interfaces/IEntity.cs index 3c2db98..d17fe8a 100644 --- a/src/AlternateLife.RageMP.Net/Interfaces/IEntity.cs +++ b/src/AlternateLife.RageMP.Net/Interfaces/IEntity.cs @@ -243,6 +243,12 @@ public interface IEntity /// This entity was deleted before void ResetSharedData(string key); + /// + /// Returns every stored data of the entity + /// + /// Copy of all stored data + IReadOnlyDictionary GetAllData(); + /// /// Get data of the entity. ///