Skip to content
Merged
Changes from 1 commit
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
10 changes: 1 addition & 9 deletions EXILED/Exiled.CustomItems/API/Features/CustomItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ namespace Exiled.CustomItems.API.Features
/// </summary>
public abstract class CustomItem
{
private static Dictionary<Type, CustomItem?> typeLookupTable = new();
private static Dictionary<string, CustomItem?> stringLookupTable = new();
private static Dictionary<uint, CustomItem?> idLookupTable = new();

Expand Down Expand Up @@ -163,12 +162,7 @@ public virtual ItemType Type
/// </summary>
/// <param name="t">The <see cref="System.Type"/> type.</param>
/// <returns>The <see cref="CustomItem"/> matching the search, <see langwod="null"/> if not registered.</returns>
public static CustomItem? Get(Type t)
{
if (!typeLookupTable.ContainsKey(t))
typeLookupTable.Add(t, Registered.FirstOrDefault(i => i.GetType() == t));
return typeLookupTable[t];
}
public static CustomItem? Get(Type t) => Registered.FirstOrDefault(i => i.GetType() == t);

/// <summary>
/// Tries to get a <see cref="CustomItem"/> with a specific ID.
Expand Down Expand Up @@ -770,7 +764,6 @@ public virtual void Give(Player player, Item item, bool displayMessage = true)
/// </summary>
public virtual void Init()
{
typeLookupTable.Add(GetType(), this);
stringLookupTable.Add(Name, this);
idLookupTable.Add(Id, this);

Expand All @@ -784,7 +777,6 @@ public virtual void Destroy()
{
UnsubscribeEvents();

typeLookupTable.Remove(GetType());
stringLookupTable.Remove(Name);
idLookupTable.Remove(Id);
}
Expand Down