diff --git a/EXILED/Exiled.API/Features/Lockers/Locker.cs b/EXILED/Exiled.API/Features/Lockers/Locker.cs
index 15fb2ccae..73108359b 100644
--- a/EXILED/Exiled.API/Features/Lockers/Locker.cs
+++ b/EXILED/Exiled.API/Features/Lockers/Locker.cs
@@ -143,7 +143,7 @@ public Vector3 RandomChamberPosition
///
/// The to filter by. If unspecified, all zones are considered.
/// The to filter by. If unspecified, all locker types are considered.
- /// A random object, or null if no matching locker is found.
+ /// A random object, or if no matching locker is found.
public static Locker? Random(ZoneType zone = ZoneType.Unspecified, LockerType lockerType = LockerType.Unknow)
{
IEnumerable filteredLockers = List;
@@ -224,6 +224,7 @@ public void AddItem(Pickup item)
internal static void ClearCache()
{
BaseToExiledLockers.Clear();
+ Chamber.Chambers.Clear();
}
}
}
diff --git a/EXILED/Exiled.API/Features/Map.cs b/EXILED/Exiled.API/Features/Map.cs
index 13d55fc98..666b19815 100644
--- a/EXILED/Exiled.API/Features/Map.cs
+++ b/EXILED/Exiled.API/Features/Map.cs
@@ -82,8 +82,20 @@ DecontaminationController.Singleton.NetworkDecontaminationOverride is Decontamin
///
/// Gets all objects.
///
+ ///
+ /// This method is obsolete. Use instead to retrieve the objects directly.
+ ///
+ [Obsolete("Use Map.ExiledLockers instead")]
public static ReadOnlyCollection Lockers { get; } = Features.Lockers.Locker.BaseToExiledLockers.Keys.ToList().AsReadOnly();
+ ///
+ /// Gets all objects.
+ ///
+ ///
+ /// This metod will be renamed to Lockers when is discontinued.
+ ///
+ public static IReadOnlyCollection ExiledLockers { get; } = Features.Lockers.Locker.List;
+
///
/// Gets all objects.
///
@@ -210,8 +222,28 @@ public static void ResetLightsColor()
///
/// Gets a random .
///
- /// object.
- public static MapGeneration.Distributors.Locker GetRandomLocker() => Lockers.GetRandomValue();
+ ///
+ /// This method is obsolete. Use instead.
+ /// to specify the zone and locker type for more precise filtering.
+ ///
+ /// A object from any zone and of any type.
+ [Obsolete("Use GetRandomLocker(ZoneType, LockerType) instead.")]
+ public static MapGeneration.Distributors.Locker GetRandomLocker() => Features.Lockers.Locker.Random().Base;
+
+ ///
+ /// Gets a random from the specified zone and locker type.
+ ///
+ ///
+ /// The to filter the lockers by. If is provided, lockers from all zones are considered.
+ ///
+ ///
+ /// The to filter the lockers by. If is provided, lockers of any type are considered.
+ ///
+ ///
+ /// A object that matches the specified zone and locker type, or if no matching locker is found.
+ ///
+ public static Lockers.Locker GetRandomLocker(ZoneType zone = ZoneType.Unspecified, LockerType lockerType = LockerType.Unknow) => Features.Lockers.Locker.Random(zone, lockerType);
+
///
/// Gets a random .