Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/AlternateLife.RageMP.Net/Elements/Entities/Entity.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -243,6 +244,11 @@ public void ResetSharedData(string key)
SetSharedData(key, null);
}

public IReadOnlyDictionary<string, object> GetAllData()
{
return _data.ToDictionary(x => x.Key, x => x.Value);
}

public bool TryGetData(string key, out object data)
{
Contract.NotEmpty(key, nameof(key));
Expand Down
6 changes: 6 additions & 0 deletions src/AlternateLife.RageMP.Net/Interfaces/IEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,12 @@ public interface IEntity
/// <exception cref="EntityDeletedException">This entity was deleted before</exception>
void ResetSharedData(string key);

/// <summary>
/// Returns every stored data of the entity
/// </summary>
/// <returns>Copy of all stored data</returns>
IReadOnlyDictionary<string, object> GetAllData();

/// <summary>
/// Get data of the entity.
/// </summary>
Expand Down